Examples of XML and DTD constraints-product catalog DTD

Source: Internet
Author: User
Tags cdata

It Programmer development Essentials-all kinds of resources download list, history of the most IT resources, personal collection summary. product.dtd File:

<!--Product Catalog DTD--<! ENTITY table "Desks" > <! ENTITY price "100.0" > <! ENTITY Street "Chinatown" > <! ENTITY% product "Specifications+,options?" > <! ENTITY% category "(handtool| table| shop-professional) "> <! ELEMENT Catalog (product+) > <! ELEMENT product (%product;,price+,notes?) > <! ELEMENT Specifications (#PCDATA) > <! ELEMENT options (#PCDATA) > <! ELEMENT Price (#PCDATA) > <! ELEMENT notes (#PCDATA) > <! ATTLIST Catalog ID ID #REQUIRED > <! Attlist Product name CDATA #IMPLIED category%category; "Handtool" Partnum CDATA #IMPLIED Plant (pittsburgh| milwaukee| Chicago) "Chicago" Inventory CDATA #FIXED "Instock" > <! ATTLIST Specifications Weight CDATA #IMPLIED power CDATA #IMPLIED > & lt;! Attlist Options Finish (metal| polished| Matte) "Matte" aDapter (included| optional| notapplicable) "Included" Case (hardshell| Soft| notapplicable) "Hardshell" > <! Attlist price MSRP CDATA #IMPLIED Wholesale CDATA "All" street CDATA #IMPLIED shipping CDATA #IMPLIED >

product.xml File:

<?xml version= "1.0" encoding= "Utf-8"?> <!

DOCTYPE Catalog SYSTEM "PRODUCT.DTD" >

<catalog id= "cata1" >

   <product category= "Handtool" >

      <specifications weight= "2.0kg" > Wrench </specifications>

      <price street= "Hong Kong Street" >80.0</price >

      <notes> This is a wrench </notes>

   </product>

   <product category= "Table" >

       < specifications>&table;</specifications>

       <price street= "&street;" wholesale= "section" > &price;</price>

   </product>

</catalog>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.