Hello,
 
This is probably very old news, but let me ask anyway :
 
I've got the following XML doc :
 
<?xml version="1.0" standalone="yes" ?>
<!DOCTYPE PORT [
   <!ELEMENT PNAME (#PCDATA)>
   <!ELEMENT PDESCRIPTION (#PCDATA)>
   <!ELEMENT PORT (PNAME,PDESCRIPTION)>
]>
<PORT>
  <PNAME>bzz</PNAME>
  <PDESCRIPTION>bzz</PDESCRIPTION>
</PORT>
 
 
and when I set the validation to true with 1.0.4 parser, I get an error : org.xml.sax.SAXParseException: The content of element type "PORT" must match "(PNAME,PDESCRIPTION)".
When I use 1.0.3, everything works as it should.
 
Is that a known problem with 1.0.4 ? Is the validation more stable in 1.0.3 ?
 
Thanks,
Jarek
 
PS> Here's my sample source :
 
import org.xml.sax.SAXException;
import org.xml.sax.Parser;
import org.xml.sax.InputSource;
import org.apache.xerces.parsers.SAXParser;
import java.io.*;
 

public class DTD
{
 
    public static void main(String argv[])
    {
        //
 
        try
            {
                SAXParser parser = new SAXParser();
 
                try {
                    parser.setFeature("http://xml.org/sax/features/validation",
                                      true);
                } catch (SAXException e) {
                    System.err.println("error in setting up parser feature");
                }
                parser.setDTDHandler(new Handler());
                parser.setContentHandler(new Handler());
                parser.setErrorHandler(new Handler());
                String fileName=argv[0];
                File file=new File(fileName);
                FileInputStream fis=new FileInputStream(file);
                InputSource is=new InputSource(fis);
                parser.parse(is);
               
            }
        catch(Exception e)
            {
                System.err.println("Exception : " + e);
            }
    }
};
 
 
 
 
 
 
 

Reply via email to