OZONE Asylum
Forums
CSS - DOM - XHTML - XML - XSL - XSLT
xml: when to use attributes vs text (and doctype/validation)
This page's ID:
27871
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
warning: Confused. 1) Do I need a doctype for my xml documents? Right now I'm viewing the file in firefox to check that it is well-formed. I think there are two types of doctypes, is one newer/better or just another syntax? After searching it looks like it's DTD, and schema. Should I focus on using schema? Or is there a disadvantage? It looks like Schema is more verbose, but is easier to use in bigger documents, and re-useable. (Or not?) 2) Is the doctype related to XSLT, or is XSLT for xml stylesheets XSL? After some reading it looks like XSL has to do with transforming the document and a stylesheet is a part of that? (And parsing/iterating xml files for output on a xhtml page?) 3) How do I know when something should be an attribute, or text? (CDATA?) Some values seem like they could be either. Here's a couple of examples. If i'm doing anything else wrong schematically tell me. Text might not be the right term, I'm talking about <element>text</element>. From API's, it seems like it's called text (attribute? or element?). Or maybe CDATA?[code]<!-- todo1 --> <TodoList> <item group="post" title="xml attribute vs text"> <date year="2006" month="05" day="01"/> <text> Post this thread. </text> </item> <item group="foo" title="bar"> <date year="2006" month="05" day="01"/> <text> Foobar. </text> </item> </TodoList> [/code]Vs. having group and/or title as text:[code]<!-- todo2 --> <TodoList> <item> <date year="2006" month="05" day="01"/> <title>xml attribute vs text</title> <group>post</group> <text> Post this thread. </text> </item> <item> <date year="2006" month="05" day="01"/> <title>bar</title> <group>foo</group> <text> Foobar. </text> </item> </TodoList> [/code][code]<!-- bookmarks.test.xml, 'item' or 'Group' can be a child of another 'Group' element --> <BookmarkList> <Group name="portal"> <Item name="/."> <url>slashdot.org</url> </Item> </Group> <Group name="programming"> <!-- item in programming, while programming has children of type 'group' --> <Item name="gamedev"> <url>http://www.gamedev.net</url> </Item> <Group name="cpp"> <Item name="c++ STL"> <url>http://foo.com</url> </Item> </Group> <Group name="perl"> <Item name="perlmonks"> <url>perlmonks.foo</url> </Item> </Group> </Group> </BookmarkList>[/code]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »