Thanks, that worked.



"Min Lee" <[EMAIL PROTECTED]> on 04/10/2001 01:06:58

Please respond to [EMAIL PROTECTED]



To:   [EMAIL PROTECTED]
cc:
Subject:  Re: No success using JAXP with Xerces to parse and validate a
      schema


Try adding

dbf.setNamespaceAware(true);

>From: [EMAIL PROTECTED]
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED], [email protected]
>Subject: No success using JAXP with Xerces to parse and validate a schema
>Date: Wed, 3 Oct 2001 17:35:58 +0100
>
>I am trying to provide support for schemas to JAXP, because we have to use
>JAXP as the interface to all our XML work..
>
>I'ved tried plugging xerces in under JAXP in order to give JAXP 1.1 schema
>support, but unfortunately it does not seem to work. I've checked that the
>XML and Schema are valid, which they are. I've also run sax.SAXCount  and
>dom.DOMCount on the XML to validate it with xerces.
>
>Using the sample xml/xsd included with xerces I ran  sax.SAXCount  and
>dom.DOMCount on
>
>xerces-1_4_3/data/personal.xsd
>xerces-1_4_3/data/personal-schema.xml
>
>and got
>
>setenv CLASSPATH
>.:/home/husseinp/java/xmlschema/xerces-1_4_3/xerces.jar:/dvl/sw/jaxp-1.1/xalan.jar:/dvl/sw/jaxp-1.1//dvl/sw/jaxp-1.1/jaxp.jar:/dvl/sw/jaxp-1.1/crimson.jar:/home/husseinp/java/xmlschema/xerces-1_4_3/xercesSamples.jar

>
>java dom.DOMCount personal-schema.xml
>personal-schema.xml: 527 ms (37 elems, 14 attrs, 0 spaces, 268 chars)
>java sax.SAXCount personal-schema.xml
>personal-schema.xml: 889 ms (37 elems, 14 attrs, 0 spaces, 268 chars)
>
>
>
>Plugging xerces in to JAXP using custom Java Parser .......
>
>
=================================================================================================================

>class Parser extends java.lang.Object implements org.xml.sax.ErrorHandler
>{
>    private java.lang.String className = "Parser";
>    // Error flag
>    private org.xml.sax.SAXParseException parseError = null;
>
>    public Parser ( java.io.File xmlFile ) throws java.lang.Exception
>    {
>       org.w3c.dom.Document doc = null;
>       System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
>"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
>       javax.xml.parsers.DocumentBuilderFactory dbf =
>javax.xml.parsers.DocumentBuilderFactory.newInstance();
>       dbf.setValidating(true);
>       javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
>       db.setErrorHandler(this);
>       doc = db.parse(xmlFile);
>    }
>    /**
>     * Receive notification of a recoverable error.
>     */
>    public void error ( org.xml.sax.SAXParseException exception )
>    {
>       java.lang.String methodName = new java.lang.String ( className +
>".error " );
>       System.err.println
>          ( methodName + exception.toString ( ) );
>       this.parseError = exception;
>    }
>    /**
>     * Receive notification of a non-recoverable error.
>     */
>    public void fatalError ( org.xml.sax.SAXParseException exception )
>    {
>       java.lang.String methodName = new java.lang.String ( className +
>".fatalError " );
>       System.err.println
>          ( methodName + exception.toString ( ) );
>       this.parseError = exception;
>    }
>    /**
>     * Receive notification of a warning.
>     */
>    public void warning ( org.xml.sax.SAXParseException exception )
>    {
>       java.lang.String methodName = new java.lang.String ( className +
>".warning " );
>       System.err.println
>          ( methodName + exception.toString ( ) );
>       this.parseError = exception;
>    }
>
>    public static void main ( java.lang.String args[] ) throws
>java.lang.Exception
>    {
>       Parser parser = null;
>       parser = new Parser ( new java.io.File ( "personal-schema.xml" ) );
>    }
>}
>
=================================================================================================================

>
>
>I get
>
>
>setenv CLASSPATH
>.:/home/husseinp/java/xmlschema/xerces-1_4_3/xerces.jar:/dvl/sw/jaxp-1.1/xalan.jar:/dvl/sw/jaxp-1.1//dvl/sw/jaxp-1.1/jaxp.jar:/dvl/sw/jaxp-1.1/crimson.jar

>
>javac Parser.java
>java Parser
>Parser.error org.xml.sax.SAXParseException: Element type "personnel" must
>be declared.
>Parser.error org.xml.sax.SAXParseException: Element type "person" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "name" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "family" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "given" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "email" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "link" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "person" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "name" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "family" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "given" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "email" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "link" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "person" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "name" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "family" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "given" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "email" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "link" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "person" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "name" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "family" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "given" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "email" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "link" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "person" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "name" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "family" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "given" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "email" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "link" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "person" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "name" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "family" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "given" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "email" must be
>declared.
>Parser.error org.xml.sax.SAXParseException: Element type "link" must be
>declared.
>
>
>Does anyone have any ideas as to why this is so.
>
>
>Regards
>
>
>Paul.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to