Definition: In XML technology, you can write a document that constrains the writing of an XML document, which is called an XML constraint.
Function: Constrain the writing of XML documents and validate XML;
Common constraint Techniques: XML DTD (document type definition) documentation type definitions; XML Schema
1 <?XML version= "1.0" encoding= "Utf-8"?>2 <!DOCTYPE Bookshelf SYSTEM "BOOK.DTD">3 <Bookshelf>4 <Book>5 <title>Employment Training Tutorials</title>6 <author>Zhang Xiaoxiang</author>7 <Price>39.00 USD</Price>8 </Book>9 <Book>Ten <title>Web Development</title> One <author>Zhang Xiaoxiang</author> A <Price>29.00 USD</Price> - </Book> - </Bookshelf>
Book.dtd
<! ELEMENT Bookshelf (book +) > <! ELEMENT Book (title, author, Price) > <! ELEMENT title (#PCDATA) > <! ELEMENT author (#PCDATA) > <! ELEMENT Price (#PCDATA) >
16-1-9 Java Learning Note (2) XML constraints