You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Blankenship, David" <Da...@kla-tencor.com> on 2000/07/14 18:15:31 UTC

entity resolution with schema validation

Xerces version 1.1.2
JDK 1.3 (SUN for Windows)

I am implementing a system in which I need to keep the xml and schema
files under revision control. To do this I have implemented a
EntityResolver to intercept the requests for external entities and
retrieve the files from revision control. The problem is that this
does not work for schema validation.

I would like to propose the following change to fix this problem:

in the method
org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar 
FILE: org\apache\xerces\validators\common\XMLValidator.java
LINE: 2052

current code:

            // expand it before passing it to the parser
            loc = fEntityHandler.expandSystemId(loc);
            try {
                parser.parse( loc );
            }catch( IOException e ) {
                e.printStackTrace();
            }catch( SAXException e ) {
                //e.printStackTrace();
                reportRecoverableXMLError(167, 144, e.getMessage() );
            }

changed to:

            // expand it before passing it to the parser
            InputSource source =
parser.getEntityResolver().resolveEntity("", loc);
            try {
                parser.parse( source );
            }catch( IOException e ) {
                e.printStackTrace();
            }catch( SAXException e ) {
                //e.printStackTrace();
                reportRecoverableXMLError(167, 144, e.getMessage() );
            }

or something that achieve the same results.



Also, I noticed that the org.apache.xerces.dom.NodeContainer class is
missing from the xerces.jar and from the 1.1.2 source. What is the
future of this class? Can I rely on it returning in the next release?
It is still in the documentation.

Thanks

David Blankenship
KLA-Tencor Control Solutions

NodeContainer (was Re: entity resolution with schema validation)

Posted by Arnaud Le Hors <le...@us.ibm.com>.
> > Also, I noticed that the org.apache.xerces.dom.NodeContainer class is
> > missing from the xerces.jar and from the 1.1.2 source. What is the
> > future of this class? Can I rely on it returning in the next release?
> > It is still in the documentation.

You really should avoid relying on the internals but if you really have
to here is the info you need:

NodeContainer no longer exists. Instead you should use ParentNode or
ChildAndParentNode depending on what you need. I assume the names are
explicit enough for what they stand for!
-- 
Arnaud  Le Hors - IBM Cupertino, XML Technology Group

Re: entity resolution with schema validation

Posted by Eric Ye <er...@locus.apache.org>.
----- Original Message -----
From: "Blankenship, David" <Da...@kla-tencor.com>
To: <xe...@xml.apache.org>
Cc: "Atkins, Nathan" <Na...@kla-tencor.com>; "Hatcher, Stephen"
<St...@kla-tencor.com>
Sent: Friday, July 14, 2000 9:15 AM
Subject: entity resolution with schema validation


> Xerces version 1.1.2
> JDK 1.3 (SUN for Windows)
>
> I am implementing a system in which I need to keep the xml and schema
> files under revision control. To do this I have implemented a
> EntityResolver to intercept the requests for external entities and
> retrieve the files from revision control. The problem is that this
> does not work for schema validation.
>
> I would like to propose the following change to fix this problem:
>
> in the method
> org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar
> FILE: org\apache\xerces\validators\common\XMLValidator.java
> LINE: 2052
>
> current code:
>
>             // expand it before passing it to the parser
>             loc = fEntityHandler.expandSystemId(loc);
>             try {
>                 parser.parse( loc );
>             }catch( IOException e ) {
>                 e.printStackTrace();
>             }catch( SAXException e ) {
>                 file://e.printStackTrace();
>                 reportRecoverableXMLError(167, 144, e.getMessage() );
>             }
>
> changed to:
>
>             // expand it before passing it to the parser
>             InputSource source =
> parser.getEntityResolver().resolveEntity("", loc);
>             try {
>                 parser.parse( source );
>             }catch( IOException e ) {
>                 e.printStackTrace();
>             }catch( SAXException e ) {
>                 file://e.printStackTrace();
>                 reportRecoverableXMLError(167, 144, e.getMessage() );
>             }
>
> or something that achieve the same results.
>
>

Yes, yours is better, I'll put it in after some testing.

>
> Also, I noticed that the org.apache.xerces.dom.NodeContainer class is
> missing from the xerces.jar and from the 1.1.2 source. What is the
> future of this class? Can I rely on it returning in the next release?
> It is still in the documentation.
>
the xerces internal DOM implementation has undergone some major
restructuring lately, and NodeContainer class is factored out, so that
usually means its' permanently gone.  The best strategy is not to use these
internal implementation classes. Thanks for reporting this, we'll fix the
documentation accordingly.

_____


Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org