You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Bettina Reck <Be...@gmx.de> on 2005/03/24 08:53:17 UTC

evaluate path to schema dynamically

Hi all,

I am using the SAX2XMLReader class for parsing a XML file. Now I am
searching for a possibility to implement the following feature:
the schema files are stored in one directory but there may be several
different versions (e.g. "schemaVersion1.xsd", schemaVersion2.xsd" ...). The
XML file "knows" to which schema it belongs to - as it is coded in the
xsi:noNamespaceSchemaLocation attribute - but the path to the directory is
given by the application.

At the moment I am using setProperty() to tell my parser where to look for
the corresponding schema files. But this method requires to set the full
path together with the name of the schema file. But my application should be
able to handle XML files of different versions by itself so that the user
doesn't have to specify the name of the schema file to look for. 

Is there a possibility to only let the parser know where to look for the
schema file, the right version of the schema file (name given in the
noNamespaceSchemaLocation atribute) is then picked up by the parser itself?

Thanks for any help,
Bettina

-- 
"Happy ProMail" bis 24. M�rz: http://www.gmx.net/de/go/promail
Zum 6. Geburtstag gibt's GMX ProMail jetzt 66 Tage kostenlos!

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: evaluate path to schema dynamically

Posted by Alberto Massari <am...@datadirect.com>.
Hi Bettina,
you can use an EntityResolver to have your program resolve the schema path 
for the parser. Have a look at the Redirect sample.

Alberto

At 08.53 24/03/2005 +0100, Bettina Reck wrote:
>Hi all,
>
>I am using the SAX2XMLReader class for parsing a XML file. Now I am
>searching for a possibility to implement the following feature:
>the schema files are stored in one directory but there may be several
>different versions (e.g. "schemaVersion1.xsd", schemaVersion2.xsd" ...). The
>XML file "knows" to which schema it belongs to - as it is coded in the
>xsi:noNamespaceSchemaLocation attribute - but the path to the directory is
>given by the application.
>
>At the moment I am using setProperty() to tell my parser where to look for
>the corresponding schema files. But this method requires to set the full
>path together with the name of the schema file. But my application should be
>able to handle XML files of different versions by itself so that the user
>doesn't have to specify the name of the schema file to look for.
>
>Is there a possibility to only let the parser know where to look for the
>schema file, the right version of the schema file (name given in the
>noNamespaceSchemaLocation atribute) is then picked up by the parser itself?
>
>Thanks for any help,
>Bettina
>
>--
>"Happy ProMail" bis 24. März: http://www.gmx.net/de/go/promail
>Zum 6. Geburtstag gibt's GMX ProMail jetzt 66 Tage kostenlos!
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org