Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

XML Documents : Page 4

XML documents are similar to HTML documents. They contain information and markup tags that define the information, and are saved as ASCII text.


advertisement
Well-formed XML
A document that conforms to the XML syntax rules is called "well-formed." If all your tags are correctly formed and follow XML guidelines, then your document is considered a well-formed XML document. That's one of the nice things about XML—you don't need to have a DTD in order to use it.

Begin the Well-formed Document
To begin a well-formed document, type the XML declaration:

<?xml version="1.0" standalone="yes" encoding="UTF-8"?>

If you are embedding XML, it will go after the <HTML> and <HEAD> tags, and before any Javascript.



If you are creating an XML-only document, it will be the first thing in the file.

Version
You must include the version attribute for the XML declaration. The version is currently "1.0." Defining the version lets the browser know that the document that follows is an XML document, using XML 1.0 structure and syntax.

Standalone
The next step is to declare that the document "stands alone." The application that is processing this document knows that it doesn't need to look for a DTD and validate the XML tags.

Encoding
Finally, declare the encoding of the document. In this case, the encoding is UTF-8, which is the default encoding for XML. You can leave off this attribute and the processor will default to UTF-8.

Remember the Root Element
After the declaration, enter the tag for the root element of your document. This is the top-most element, under which all elements are grouped.

Follow XML Syntax
Now, enter the rest of the your content. Remember to follow XML syntax:
  • Remember that capitalization matters;
  • Quote all attribute values;
  • Close all tags;
  • Remember to close empty tags too, like this:

    <br/>

Pretty easy, isn't it? That's all there is to it!



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date