Topic: xml: when to use attributes vs text (and doctype/validation) |
|
---|---|
Author | Thread |
Obsessive-Compulsive (I) Inmate From: |
posted 05-01-2006 23:00
warning: Confused. 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> 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: <!-- 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> |
Paranoid (IV) Inmate From: Cold Sweden |
posted 05-02-2006 11:27
quote:
quote:
quote:
quote:
code: <!-- todo3 --> <TodoList> <item group="post"> <date year="2006" month="05" day="01"/> <title>xml attribute vs text</title> <text> Post this thread. </text> </item> <item group="foo"> <date year="2006" month="05" day="01"/> <title>bar</title> <text> Foobar. </text> </item> </TodoList>
code: <![CDATA[not an <element/> and not an &entity-reference;]]>
|