0

Hi,
Please correct me here about xml, I am still new to it:
-It should have start and closing tags, i.e <start></end>; avoid short cuts like <tag/> like in html.
-xml schema is an xml document, it abides by xml rules.
So how comes that we have something like: <xs:attribute name="lang" type="xs:string"/> in an xml schema.
I was expecting: <xs:attribute name="lang" type="xs:string"/> </s:attribute>

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Mike Askew
0

Right so,

<xs:attribute name="lang" type="xs:string"/>

Would create an xml attribute looking like this:

<RandomNode lang=""></RandomNode>

Which is perfectly acceptable if we want to create a blank attribute. What your referring to would be used when we wish to apply a value to that attribute and in that case it goes like you state.

<xs:attribute name="lang" type="xs:string"/>ValueHere</s:attribute>

Would create:

<RandomNode lang="ValueHere"></RandomNode>

Basically using the /> is shorthand for the whole node being written out, or thats how I view it.

Not entirely sure why we would need to stay away from using such formats?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.