Java Reference
In-Depth Information
The exclamation point followed by two dashes is a tag that represents a com-
ment. The text between <!-- and the closing --> will be ignored by an XML parsing
program.
A C OMPLETE XML D OCUMENT
The following sample XML document brings all these concepts together. It contains
a document type declaration, an internal DTD specification, and then the actual
data contents of the document:
<?xml version="1.0" standalone="yes" encoding="UTF-8"?>
<!--- A Book order in XML format -->
<!DOCTYPE Order [
<!ELEMENT Order (LineItem)+>
<!ATTLIST Order orderNumber CDATA #REQUIRED>
<!ELEMENT LineItem (Title, Author+, BookType, Price)>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Author (#PCDATA)>
<!ELEMENT BookType (#PCDATA)>
<!ELEMENT Price (#PCDATA)>
<!ENTITY HARDCOVER "Hardcover">
<!ENTITY PAPERBACK "Paperback">
]>
<Order orderNumber="81332713233407">
<LineItem>
<Title>Debt of Honor</Title>
<Author>Tom Clancy</Author>
<BookType>&PAPERBACK;</BookType>
<Price>$6.99</Price>
</LineItem>
<LineItem>
<Title>The Hunt for Red October</Title>
<Author>Tom Clancy</Author>
<BookType>&HARDCOVER;</BookType>
<Price>$18.99</Price>
</LineItem>
</Order>
Search WWH ::




Custom Search