XML Basics |
- XML stands for eXtensible Markup Language.
- XML is designed to transport and store data.
- What is XML?
- XML stands for EXtensible Markup Language
- XML is a markup language much like HTML
- XML was designed to carry data, not to display data
- XML tags are not predefined. You must define your own tags
- XML is designed to be self-descriptive
- XML is a W3C Recommendation
- The Difference Between XML and HTML :
- XML is not a replacement for HTML.
- XML and HTML were designed with different goals:
- XML was designed to transport and store data, with focus on what data is.
- HTML was designed to display data, with focus on how data looks.
- HTML is about displaying information, while XML is about carrying information
- Understanding the Vocabulary:
Well-formed XML:
- Rules of Elements:
- Element names cannot contain white space
- Names cannot start with a number or a punctuation mark
- Names cannot start with xml or variants
- No space after the left angle bracket (<)
- The case of start and closing tags must match
- The first element is the root element
- The root element must have start and closing tags
- All child elements must nest within the root
- Nesting elements cannot overlap
- An empty child element can consist of a single tag
- Declare them in start tags and processing instructions
- Separate multiple declarations with a space
- An attribute consists of a name and an assignment
- Each name must be unique within an element
- You can reuse names throughout a document
- There are no spaces in names
- Use either single or double quotes for assignments
- <Book Type="IT">XML Principles</Book>
- Processing instructions to applications
- Use it to send a command to an external application
- Multiple PIs to applications are allowed
- <?MyDbAppSELECT * FROM orders?>
- Processing instructions to the XML processor – the XML declaration
- It begins with the XML keyword
- It must appear only once per document at the top of the document
- Use it to declare the XML version and character encoding
- <?xml version="1.0" encoding="UTF-8"?>
- Do not embed a comment within a tag
<Books><!--IT--></Books> Error: <Books<!--IT-->></Books>- Use the double hyphen (--) only to open and close the comment
<--Option use–fas option --> Error:<--option use --d as option-->- Do not use a triple hyphen (---) at the end
<---10 Centigrade --> Error: <---10 Centigrade --->
- Reserved Characters:
Reserved Characters | Entity References |
& | & |
< | < |
> | > |
' | ' |
" | " |
Space | |
- What Is an XML Vocabulary?
- Problem: two XML sources cannot be easily combined
- Solution: each XML source shares the same structure, naming, and case
- Guidelines for Creating Vocabularies
- Determine if a vocabulary already exists
- Make your XML easy to read and understand
- Use title case for elements and attribute names
- Avoid abbreviations
No comments:
Post a Comment