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 sh...@ubs.com on 2003/05/06 12:00:34 UTC
Using entities with an XML document constrained by xml schema
Hi All,
I am fairly new bee as far as xml schemas are concerned.Following problem has troubled me for last 2 days.I have searched all user archives and web resources but no use.So finally i am sending this to xerces users list.
I have an xml configuration file(Databse configuration etc) which I am validating usign xml schema.
But now I am trying to split the configuration file in different files(mainly static content and not static content like Database config info)so that while deploying the application, the administrator has to deal with little configuration info.
To split the xml file,I am using entity declaration.But some how, the xerces parser does seem to throw exception when it comes across the DOCTYpe declaration
Here is sample xml file.
<?xml version="1.0"?>
<!DOCTYPE root[
<!ENTITY INCLUDE_DB_CONFIG SYSTEM "dbconfig.xml">
]>
<root xmlns="http://www.ubs.com/MyApp/MyConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ubs.com/MyApp/MyConfig
../../../CEFS/batch/config/MyConfigfile.xsd">
&INCLUDE_DB_CONFIG;
<perl-node-configuration>
<perlNode>xxx</perlNode>
</perl-node-configuration>
<application-defaults>
<defaultLanguage>en</defaultLanguage>
<defaultCurrency>EUR</defaultCurrency>
<exchangeScheduleRefreshPeriod>1800000</exchangeScheduleRefreshPeriod>
</application-defaults>
<!-- perl -->
<!-- defaults -->
</root>
So can anybody tell me what I am doing wrong?
And mainly is it possible to use the entities like this with XML document constrained by XML Schema?I am not sure if the processor is expanding the entity before validating.
Any help will be appreciated.
regards,
Shirish
Shirish Sakhare
Application Developer
(CEFS PROJECT)
(CEFS) Corporate Employee Financial Services
UBS AG
Stauffacherstrasse 41
P.O. Box, CH-8004 Zürich
Tel: +41-1-235 56 31
Fax: +41-1-235 54 21
Personal Mail Id:shirish_sakhare@yahoo.com
--------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Using entities with an XML document constrained by xml schema
Posted by "K. Venugopal" <k....@sun.com>.
Hi Shirish ,
shirishchandra.sakhare@ubs.com wrote:
>Hi All,
>I am fairly new bee as far as xml schemas are concerned.Following problem has troubled me for last 2 days.I have searched all user archives and web resources but no use.So finally i am sending this to xerces users list.
>
>I have an xml configuration file(Databse configuration etc) which I am validating usign xml schema.
>But now I am trying to split the configuration file in different files(mainly static content and not static content like Database config info)so that while deploying the application, the administrator has to deal with little configuration info.
>
>To split the xml file,I am using entity declaration.But some how, the xerces parser does seem to throw exception when it comes across the DOCTYpe declaration
>
>
What is the exception you are getting , can you post it . I tried using
jaxp and it works for me .
I have set following properties .
spf.setNamespaceAware(true);
spf.setValidating(true);
SAXParser saxParser = spf.newSAXParser();
saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",xsdFile);
Hope this helps.
Regards
venu
>Here is sample xml file.
>
><?xml version="1.0"?>
><!DOCTYPE root[ <!ENTITY INCLUDE_DB_CONFIG SYSTEM "dbconfig.xml">]>
>
><root xmlns="http://www.ubs.com/MyApp/MyConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ubs.com/MyApp/MyConfig
>../../../CEFS/batch/config/MyConfigfile.xsd">
>
> &INCLUDE_DB_CONFIG;
>
> <perl-node-configuration>
> <perlNode>xxx</perlNode>
> </perl-node-configuration>
>
> <application-defaults>
> <defaultLanguage>en</defaultLanguage>
> <defaultCurrency>EUR</defaultCurrency>
> <exchangeScheduleRefreshPeriod>1800000</exchangeScheduleRefreshPeriod>
> </application-defaults>
>
> <!-- perl -->
>
> <!-- defaults -->
>
></root>
>
>
>So can anybody tell me what I am doing wrong?
>
>And mainly is it possible to use the entities like this with XML document constrained by XML Schema?I am not sure if the processor is expanding the entity before validating.
>
>Any help will be appreciated.
>
>regards,
>Shirish
>
>Shirish Sakhare
>Application Developer
>(CEFS PROJECT)
>(CEFS) Corporate Employee Financial Services
>
>UBS AG
>Stauffacherstrasse 41
>P.O. Box, CH-8004 Zürich
>Tel: +41-1-235 56 31
>Fax: +41-1-235 54 21
>Personal Mail Id:shirish_sakhare@yahoo.com
>--------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>
>