다음을 통해 공유


Figure 1

Figure 1 invoice.ns.dtd

  <?xml version="1.0" encoding="UTF-8"?>

<!— default prefix if not specified —>
<!ENTITY % ns-prefix-nc "i">
<!ENTITY % ns-prefix "%ns-prefix-nc;:"> 
<!ENTITY % Invoice "%ns-prefix;Invoice">
<!ENTITY % InvoiceID "%ns-prefix;InvoiceID">
<!ENTITY % CustomerName "%ns-prefix;CustomerName">
<!ENTITY % LineItems "%ns-prefix;LineItems">
<!ENTITY % LineItem "%ns-prefix;LineItem">
<!ENTITY % Sku "%ns-prefix;Sku">
<!ENTITY % Description "%ns-prefix;Description">
<!ENTITY % Price "%ns-prefix;Price">
<!ENTITY % xmlns "xmlns:%ns-prefix-nc;">

<!ELEMENT %Invoice; (%InvoiceID;, %CustomerName;, %LineItems;)>
<!ATTLIST %Invoice;
          %xmlns; CDATA #REQUIRED>
<!ELEMENT %InvoiceID; (#PCDATA)>
<!ELEMENT %CustomerName; (#PCDATA)>
<!ELEMENT %LineItems; (%LineItem;)*>
<!ELEMENT %LineItem; (%Sku;, %Description;, %Price;)>
<!ELEMENT %Sku; (#PCDATA)>
<!ELEMENT %Description; (#PCDATA)>
<!ELEMENT %Price; (#PCDATA)>

Figure 2 invoice.ns.xml

  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE g:Invoice SYSTEM "invoice-ns.dtd" [
  <!ENTITY % ns-prefix-nc "g">
]>
<g:Invoice xmlns:g="urn:www-develop-com:invoices">
   <g:InvoiceID>1000</g:InvoiceID>
   <g:CustomerName>Jane Smith</g:CustomerName>
   <g:LineItems>
      <g:LineItem>
         <g:Sku>134</g:Sku>
         <g:Description>Dons Boxers</g:Description>
         <g:Price>9.95</g:Price>
      </g:LineItem>
      <g:LineItem>
         <g:Sku>153</g:Sku>
         <g:Description>Rice Krispy COM Object</g:Description>
         <g:Price>10000.00</g:Price>
      </g:LineItem>
      <g:LineItem>
         <g:Sku>171</g:Sku>
         <g:Description>Caffeinated Beverages</g:Description>
         <g:Price>0.00</g:Price>
      </g:LineItem>
   </g:LineItems>
</g:Invoice>