[Dev] attributes in the xml syntax

Ted Leung twl at osafoundation.org
Tue Jan 25 13:43:09 PST 2005


On Jan 25, 2005, at 10:33 AM, Alec Flett wrote:

>  Another question:
>  it reasonable/accepted/endorsed to say
>
>  <SomeItem itsName="foo" blockName="foo" selectedItemAttribute="bar"/>
>
>  instead of
>
>  <SomeItem itsName="foo">
>    <blockName>foo</blockName>
>    <selectedItemAttribute>bar</selectedItemAttribute>
>  </SomeItem>

Which one you do is a matter of what you are trying to accomplish?

>
>  and so forth?
>  i.e. is it correct to assume that these three statements are 
> identical?
>  * <tag attr="value"/>
>  * <tag><attr>value</attr></tag>
>  * <tag><attr value="value"/></tag> (I just saw this for the first 
> time yesterday)

None of these are the same.

1. an element named "tag" with an attribute named "attr".  The value of 
the attr attribute is value
2. an element named "tag" with a child element named "attr" whose 
content is value
3. an element named "tag" with a child element named "attr" with an 
attribute named "value".  The value of the "value" attribute is value

----
Ted Leung                 Open Source Applications Foundation (OSAF)
PGP Fingerprint: 1003 7870 251F FA71 A59A  CEE3 BEBA 2B87 F5FC 4B42




More information about the Dev mailing list