You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Papendieck, Thomas" <Th...@opitz-consulting.com> on 2011/08/11 09:55:38 UTC

AW: xerces ignores reader.setProperty(SCHEMA_LOCATION_PROPERTY,"path/to/xsd") - solved

solution is:
InputSource(new FileInputStream(new File(new URI(systemId))));

bye
Thomas
________________________________________
Von: Papendieck, Thomas [Thomas.Papendieck@opitz-consulting.com]
Gesendet: Donnerstag, 11. August 2011 09:12
Bis: j-users@xerces.apache.org
Betreff: AW: xerces ignores reader.setProperty(SCHEMA_LOCATION_PROPERTY,"path/to/xsd")

Hello,

unfortunately John's Idea does not work because 'resolveEntity' is not called in my implementation.

Where do I look next for a solution?


> reader.setEntityResolver(new EntityResolver() {
>
>       @Override
>        public InputSource resolveEntity(String publicId, String systemId)
>                        throws SAXException, IOException {
>                InputSource result = null;
>                // result = get the file from disk or however you need to do it ();
>                return result;
>        }
>});

bye
Thomas
________________________________________
Von: Newman, John W [newmanjw@d3onc.com]
Gesendet: Mittwoch, 10. August 2011 19:05
Bis: j-users@xerces.apache.org
Betreff: RE: xerces ignores reader.setProperty(SCHEMA_LOCATION_PROPERTY,"path/to/xsd")

I believe so yes .. but I'm not 100%

Fire that up in the debugger and see what you get.   Or just add some log statements to see when it's getting called and what values you're getting for public id / system id

-----Original Message-----
From: Papendieck, Thomas [mailto:Thomas.Papendieck@opitz-consulting.com]
Sent: Wednesday, August 10, 2011 1:03 PM
To: j-users@xerces.apache.org
Subject: AW: xerces ignores reader.setProperty(SCHEMA_LOCATION_PROPERTY,"path/to/xsd")

Hello John,

that was fast... ;o)

>  public InputSource resolveEntity(String publicId, String systemId)
Am I right that 'systemId' is (in my case) the path to the xsd as found in the 'xsi:schemaLocation' attribute?

bye
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: AW: xerces ignores reader.setProperty(SCHEMA_LOCATION_PROPERTY,"path/to/xsd") - solved

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Or just pass the systemId directly to the InputSource (i.e. new InputSource
(systemId)) and let the parser deal with the InputStream creation. This
makes it possible for the parser to resolve relative URIs which may appear
in the document you're returning from the resolver. If you only provide an
InputStream the base URI is lost.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Papendieck, Thomas" <Th...@opitz-consulting.com> wrote on
08/11/2011 03:55:38 AM:

> solution is:
> InputSource(new FileInputStream(new File(new URI(systemId))));
>
> bye
> Thomas
> ________________________________________
> Von: Papendieck, Thomas [Thomas.Papendieck@opitz-consulting.com]
> Gesendet: Donnerstag, 11. August 2011 09:12
> Bis: j-users@xerces.apache.org
> Betreff: AW: xerces ignores reader.setProperty
> (SCHEMA_LOCATION_PROPERTY,"path/to/xsd")
>
> Hello,
>
> unfortunately John's Idea does not work because 'resolveEntity' is
> not called in my implementation.
>
> Where do I look next for a solution?
>
>
> > reader.setEntityResolver(new EntityResolver() {
> >
> >       @Override
> >        public InputSource resolveEntity(String publicId, String
systemId)
> >                        throws SAXException, IOException {
> >                InputSource result = null;
> >                // result = get the file from disk or however you
> need to do it ();
> >                return result;
> >        }
> >});
>
> bye
> Thomas
> ________________________________________
> Von: Newman, John W [newmanjw@d3onc.com]
> Gesendet: Mittwoch, 10. August 2011 19:05
> Bis: j-users@xerces.apache.org
> Betreff: RE: xerces ignores reader.setProperty
> (SCHEMA_LOCATION_PROPERTY,"path/to/xsd")
>
> I believe so yes .. but I'm not 100%
>
> Fire that up in the debugger and see what you get.   Or just add
> some log statements to see when it's getting called and what values
> you're getting for public id / system id
>
> -----Original Message-----
> From: Papendieck, Thomas [mailto:Thomas.Papendieck@opitz-consulting.com]
> Sent: Wednesday, August 10, 2011 1:03 PM
> To: j-users@xerces.apache.org
> Subject: AW: xerces ignores reader.setProperty
> (SCHEMA_LOCATION_PROPERTY,"path/to/xsd")
>
> Hello John,
>
> that was fast... ;o)
>
> >  public InputSource resolveEntity(String publicId, String systemId)
> Am I right that 'systemId' is (in my case) the path to the xsd as
> found in the 'xsi:schemaLocation' attribute?
>
> bye
> Thomas
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org