Jump to content

What are the reserved words in XML?


Madison320

Recommended Posts

I've been going thru the XML tutorial and the fact that I don't know which words are reserved makes it very difficult for me to understand.

 

For example in the following code is "xs" a reserved word? Is "element" a reserved word? "complexType"?

 

<xs:element name="note"><xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence></xs:complexType></xs:element>

Link to comment
Share on other sites

No, no words are reserved in XML. What you're showing is part of XSL, an XML-based language which does have particular keywords. However, the namespace (xs:) allows it to be distinguished from other XML formats that have the same keywords.

Link to comment
Share on other sites

No, no words are reserved in XML. What you're showing is part of XSL, an XML-based language which does have particular keywords. However, the namespace (xs:) allows it to be distinguished from other XML formats that have the same keywords.

 

Thanks for the quick response, unfortunately I'm still totally confused! :)

 

So is this code XSL? How would I know that by looking at it? It seems like there ought to be a way to distinguish what XML-based language I'm looking at:

 

<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType></xs:element></xs:schema>

 

Also this page appears to be full of reserved words but it makes it sound like it's generic XML.

 

http://www.w3schools.com/schema/schema_elements_ref.asp

Link to comment
Share on other sites

That reference is for XSD, not generic XML. With XML, you define your own tags and attributes. The schema is what defines that, the schema says what elements there are, what children they have, what attributes they have, etc. XSD is also valid XML, but the purpose of a XSD document is to style and lay out the XML data for display. A XSD sheet is to an XML document what a CSS sheet is to an HTML document, just more confusing. Everything with XML is more confusing.

Link to comment
Share on other sites

That reference is for XSD, not generic XML. With XML, you define your own tags and attributes. The schema is what defines that, the schema says what elements there are, what children they have, what attributes they have, etc. XSD is also valid XML, but the purpose of a XSD document is to style and lay out the XML data for display. A XSD sheet is to an XML document what a CSS sheet is to an HTML document, just more confusing. Everything with XML is more confusing.

 

Does the XSD schema document have a universal set of reserved words? Element? xs? Record? I keep running into these words and I can't figure out if they have meaning or are they just made up by the user like a variable.

 

Thanks!

Link to comment
Share on other sites

I don't think element and record are reserved words, they're just concepts. With HTML as an example, elements are things like <div>, <table>, <form>, etc. A record in XML would be a set of elements that compose.. well, a record. An XML document is typically a set of multiple records, and each record has 1 or more elements.

Link to comment
Share on other sites

I don't think element and record are reserved words, they're just concepts. With HTML as an example, elements are things like <div>, <table>, <form>, etc. A record in XML would be a set of elements that compose.. well, a record. An XML document is typically a set of multiple records, and each record has 1 or more elements.

 

I saw <record> in an Excel schema example. I'm assuming the element "record" was defined by Excel somehow since Excel "acts differently" when it sees the element "record". So that makes sense because it's Excel making it a reserved word, not XML. But I'm still a unclear on where you find these reserved words for any particular XML language.

 

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...