Element-centric presentation
Data is stored between start tag and end tag of XML elements.
Recommendation to store data.
Example:
<Customers>
<Customer>
<custid>1</custid>
<contactname>Allen,
Michael</contactname>
</Customer>
<Customer>
<custid>2</custid>
<contactname>Hassall,
Mark</contactname>
</Customer>
</Customers>
Attribute-centric
presentation
Data is stored inside of element tags.
Recommendation to store metadata
Example:
<Customers>
<Customer custid="1"
contactname="Allen, Michael" />
<Customer custid="2"
contactname="Hassall, Mark" />
</Customers>
Mixed presentation
XML
documents can contain both element-centric and attribute-centric presentation.
Example:
<Customers>
<Customer>
<custid>1</custid>
<contactname>Allen,
Michael</contactname>
</Customer>
<Customer custid="2"
contactname="Hassall, Mark" />
<Customers>
Prolog
Denoting
the XML version & encoding
Must
be the first line of the XML document
Example:
<?xml version="1.0" encoding="ISO-8859-15"?>
Namespaces
Declared
in the root element
Can
have alias
Example:
<Employees
xmlns:emp="EmployeesCompanyA">
<emp:Employee>
<emp:employeeid>1</emp:employeeid>
</emp:Employee>
</Employees>
Special characters
<,
>, &, ", '
Use
& as escape character and end with a semicolon.
Example:
$lt; is equivalent to <
Another
option: use XML CDATA section as <![CDATA[…]]>
The
characters in the … is treated as literal character
Example:
<Product><![CDATA[<<&>"
']]></Product>
Comment
Syntax: <!-- this is a comment -->
Syntax: <!-- this is a comment -->
Example:
<Customers>
<!-- this is a comment -->
<Customer custid="1" contactname="Allen, Michael" />
<Customer custid="2" contactname="Hassall, Mark" />
</Customers>
Processing
Instructions
Syntax: <?instruction?>
Instruction
for application that process the XML document.
Example:
<?xml-stylesheet
type="text/xsl" href="/style1.xsl"?>
XSD (XML Schema
Description) Document
Describe
the metadata of other XML documents
Can
specify: constraints, data type, element names, # of occurrence for elements.
Schema
of XSD document is predefined
Typed XML document
When
have a predefined schema (from XSD document)
XML Document Validation
A process of checking if the XML document is complied with a schema (in XSD document)
Reference:
XML 1.0 document Map on MSDN: http://msdn.microsoft.com/en-us/library/ms256153(v=vs.110).aspx
70-461 Training Kit
No comments:
Post a Comment