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>

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.