[Home] [By Thread] [By Date] [Recent Entries]


Hi Prasanth Rao,
   When i use DTD in the following way given below, the parser is throwing error saying
    Error:  org.xml.sax.SAXParseException: The content of element type "name" must match "(foo)".
    Error:  org.xml.sax.SAXParseException: The content of element type "foo" must match "(bar)*".
 
    I am able to use   <!ELEMENT name (bar)*> . Actually i want to use  <!ELEMENT name (foo)>.
    What is the solution to use this way.
 
   foo.xml
 ---------------
<?xml version="1.0"?>
<!DOCTYPE foo SYSTEM "foo.dtd">
   <foo>
       <bar>Some text</bar>
       <bar>Some more text</bar>
       <name>
          <bar>Some text</bar>
          <bar>Some more text</bar>
      </name>
  </foo>
 
foo.dtd
--------------
<!ELEMENT foo (bar)*>
<!ELEMENT name (foo)>
<!ELEMENT bar (#PCDATA)>
 
Regards
Raja
 

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member