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 Esther Parrilla Endrino <es...@deimos-space.com> on 2003/06/16 10:30:01 UTC

Support for Namespaces in Xerces C

Hello all,

I asked a couple of days ago here in the list about Xerces 2.2.0 support 
for validating using Namespaces and somebody told me it was possible.
I have been looking for an example but I have not found how can I set 
that feature on.

I am using the following classes to set on the features I need:

...

	parser->setFeature(XMLUni::fgDOMNamespaces, doNamespaces);

	parser->setFeature(XMLUni::fgXercesSchema, doSchema);

	parser->setFeature(XMLUni::fgXercesSchemaFullChecking, 							schemaFullChecking);

     	parser->setFeature(XMLUni::fgDOMValidation, true);

	parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
							                 	 
parser->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, 
propertyValue);

...

Could I set support for Namespaces on in the same way?

Thanks in advance,

esther


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


Re: Support for Namespaces in Xerces C

Posted by Esther Parrilla Endrino <es...@deimos-space.com>.
Hi Gareth!

Thanks for your help, yes, I have tried with DOMPrint and the code is 
right!!!!
So the problem is in my application...

regards,

esther

Gareth Reakes wrote:

>Hi,
>	I have copy and pasted your example (filled in the bits to make it 
>well formed) and the following line correctly validates them
>
>./DOMPrint -s -n -f demo3.xml
>
>
><root-element xmlns="http://www.foo.com/namespace" 
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>xsi:schemaLocation="http://www.foo.com/namespace
>demo3.xsd" >string</root-element>
>
>
><xsd:schema targetNamespace="http://www.foo.com/namespace" 
>xmlns="http://www.foo.com/namespace" 
>xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
>elementFormDefault="qualified" attributeFormDefault="unqualified">
>
><xsd:element name="root-element" type="xsd:string" />
>
></xsd:schema>
>
>
>
>Gareth
>
>
>On Mon, 16 Jun 2003, Esther Parrilla Endrino wrote:
>
>  
>
>>Thanks Gareth and all in the list,
>>
>>I have taken a look at DOMPrint and changed some code I think I have 
>>found the problem, I have set to true the support for namespaces and the 
>>error that I get is the following:
>>
>>
>>"Schema in myschema.xsd has a different target namespace from the one 
>>specified in the instance document"
>>
>>In my example I validate a XML file against its schema but this schema 
>>referes to anothe schema that contains the definition of simplex and 
>>complex types...
>>
>>Here I type the root element and its attributtes for each file...
>>
>>XML file
>>---------
>>
>><root-element xmlns="http://www.foo.com/namespace" 
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>>xsi:schemaLocation="http://www.foo.com/namespace
>>myschema.xsd">
>>
>>XSD schema that validates the file (myschema.xsd)
>>--------------------------------------------------
>>
>><xsd:schema targetNamespace="http://www.foo.com/namespace" 
>>xmlns="http://www.foo.com/namespace" 
>>xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
>>elementFormDefault="qualified" attributeFormDefault="unqualified">
>>	<xsd:include schemaLocation="./definition.xsd"/>
>>
>>
>>XSD schema that defines complex and simple types (definition.xsd)
>>-------------------------------------------------------------------
>>
>><xsd:schema targetNamespace="http://www.foo.com/namespace" 
>>xmlns="http://www.foo.com/namespace" 
>>xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
>>elementFormDefault="qualified" attributeFormDefault="unqualified">
>>
>>
>>Has anybody an idea of what is going wrong? I thought all references 
>>were good so I do not understand what is the meaning of the error I get! :(
>>
>>Thanks in advance,
>>
>>esther
>>
>>
>>Gareth Reakes wrote:
>>    
>>
>>>Hi,
>>>	the code you provide seems about right. Take a look at DOMPrint. 
>>>It provides the exact code.
>>>
>>>Gareth
>>>
>>>
>>>
>>>On Mon, 16 Jun 2003, Esther Parrilla Endrino wrote:
>>>
>>>
>>>      
>>>
>>>>Hello all,
>>>>
>>>>I asked a couple of days ago here in the list about Xerces 2.2.0 support 
>>>>for validating using Namespaces and somebody told me it was possible.
>>>>I have been looking for an example but I have not found how can I set 
>>>>that feature on.
>>>>
>>>>I am using the following classes to set on the features I need:
>>>>
>>>>...
>>>>
>>>>	parser->setFeature(XMLUni::fgDOMNamespaces, doNamespaces);
>>>>
>>>>	parser->setFeature(XMLUni::fgXercesSchema, doSchema);
>>>>
>>>>	parser->setFeature(XMLUni::fgXercesSchemaFullChecking, 							schemaFullChecking);
>>>>
>>>>    	parser->setFeature(XMLUni::fgDOMValidation, true);
>>>>
>>>>	parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
>>>>							                 	 
>>>>parser->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, 
>>>>propertyValue);
>>>>
>>>>...
>>>>
>>>>Could I set support for Namespaces on in the same way?
>>>>
>>>>Thanks in advance,
>>>>
>>>>esther
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>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
>>
>>
>>
>>    
>>
>
>  
>


-- 

Esther Parrilla Endrino
Ground Segment Systems Division
e-mail: esther.parrilla@deimos-space.com
tel:  	00 34 91 806 34 57

DEIMOS SPACE S.L.
Ronda de Poniente 19, Edificio Fiteni VI
Tres Cantos (Madrid)
http://www.deimos-space.com


~ Code matters more than comercials ~

--



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


Re: Support for Namespaces in Xerces C

Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hi,
	I have copy and pasted your example (filled in the bits to make it 
well formed) and the following line correctly validates them

./DOMPrint -s -n -f demo3.xml


<root-element xmlns="http://www.foo.com/namespace" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.foo.com/namespace
demo3.xsd" >string</root-element>


<xsd:schema targetNamespace="http://www.foo.com/namespace" 
xmlns="http://www.foo.com/namespace" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">

<xsd:element name="root-element" type="xsd:string" />

</xsd:schema>



Gareth


On Mon, 16 Jun 2003, Esther Parrilla Endrino wrote:

> Thanks Gareth and all in the list,
> 
> I have taken a look at DOMPrint and changed some code I think I have 
> found the problem, I have set to true the support for namespaces and the 
> error that I get is the following:
> 
> 
> "Schema in myschema.xsd has a different target namespace from the one 
> specified in the instance document"
> 
> In my example I validate a XML file against its schema but this schema 
> referes to anothe schema that contains the definition of simplex and 
> complex types...
> 
> Here I type the root element and its attributtes for each file...
> 
> XML file
> ---------
> 
> <root-element xmlns="http://www.foo.com/namespace" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xsi:schemaLocation="http://www.foo.com/namespace
> myschema.xsd">
> 
> XSD schema that validates the file (myschema.xsd)
> --------------------------------------------------
> 
> <xsd:schema targetNamespace="http://www.foo.com/namespace" 
> xmlns="http://www.foo.com/namespace" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> 	<xsd:include schemaLocation="./definition.xsd"/>
> 
> 
> XSD schema that defines complex and simple types (definition.xsd)
> -------------------------------------------------------------------
> 
> <xsd:schema targetNamespace="http://www.foo.com/namespace" 
> xmlns="http://www.foo.com/namespace" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> 
> 
> Has anybody an idea of what is going wrong? I thought all references 
> were good so I do not understand what is the meaning of the error I get! :(
> 
> Thanks in advance,
> 
> esther
> 
> 
> Gareth Reakes wrote:
> > Hi,
> > 	the code you provide seems about right. Take a look at DOMPrint. 
> > It provides the exact code.
> > 
> > Gareth
> > 
> > 
> > 
> > On Mon, 16 Jun 2003, Esther Parrilla Endrino wrote:
> > 
> > 
> >>Hello all,
> >>
> >>I asked a couple of days ago here in the list about Xerces 2.2.0 support 
> >>for validating using Namespaces and somebody told me it was possible.
> >>I have been looking for an example but I have not found how can I set 
> >>that feature on.
> >>
> >>I am using the following classes to set on the features I need:
> >>
> >>...
> >>
> >>	parser->setFeature(XMLUni::fgDOMNamespaces, doNamespaces);
> >>
> >>	parser->setFeature(XMLUni::fgXercesSchema, doSchema);
> >>
> >>	parser->setFeature(XMLUni::fgXercesSchemaFullChecking, 							schemaFullChecking);
> >>
> >>     	parser->setFeature(XMLUni::fgDOMValidation, true);
> >>
> >>	parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
> >>							                 	 
> >>parser->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, 
> >>propertyValue);
> >>
> >>...
> >>
> >>Could I set support for Namespaces on in the same way?
> >>
> >>Thanks in advance,
> >>
> >>esther
> >>
> >>
> >>---------------------------------------------------------------------
> >>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
> 
> 
> 

-- 
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




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


Re: Support for Namespaces in Xerces C

Posted by Esther Parrilla Endrino <es...@deimos-space.com>.
Thanks Gareth and all in the list,

I have taken a look at DOMPrint and changed some code I think I have 
found the problem, I have set to true the support for namespaces and the 
error that I get is the following:


"Schema in myschema.xsd has a different target namespace from the one 
specified in the instance document"

In my example I validate a XML file against its schema but this schema 
referes to anothe schema that contains the definition of simplex and 
complex types...

Here I type the root element and its attributtes for each file...

XML file
---------

<root-element xmlns="http://www.foo.com/namespace" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.foo.com/namespace
myschema.xsd">

XSD schema that validates the file (myschema.xsd)
--------------------------------------------------

<xsd:schema targetNamespace="http://www.foo.com/namespace" 
xmlns="http://www.foo.com/namespace" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xsd:include schemaLocation="./definition.xsd"/>


XSD schema that defines complex and simple types (definition.xsd)
-------------------------------------------------------------------

<xsd:schema targetNamespace="http://www.foo.com/namespace" 
xmlns="http://www.foo.com/namespace" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">


Has anybody an idea of what is going wrong? I thought all references 
were good so I do not understand what is the meaning of the error I get! :(

Thanks in advance,

esther


Gareth Reakes wrote:
> Hi,
> 	the code you provide seems about right. Take a look at DOMPrint. 
> It provides the exact code.
> 
> Gareth
> 
> 
> 
> On Mon, 16 Jun 2003, Esther Parrilla Endrino wrote:
> 
> 
>>Hello all,
>>
>>I asked a couple of days ago here in the list about Xerces 2.2.0 support 
>>for validating using Namespaces and somebody told me it was possible.
>>I have been looking for an example but I have not found how can I set 
>>that feature on.
>>
>>I am using the following classes to set on the features I need:
>>
>>...
>>
>>	parser->setFeature(XMLUni::fgDOMNamespaces, doNamespaces);
>>
>>	parser->setFeature(XMLUni::fgXercesSchema, doSchema);
>>
>>	parser->setFeature(XMLUni::fgXercesSchemaFullChecking, 							schemaFullChecking);
>>
>>     	parser->setFeature(XMLUni::fgDOMValidation, true);
>>
>>	parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
>>							                 	 
>>parser->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, 
>>propertyValue);
>>
>>...
>>
>>Could I set support for Namespaces on in the same way?
>>
>>Thanks in advance,
>>
>>esther
>>
>>
>>---------------------------------------------------------------------
>>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


Re: Support for Namespaces in Xerces C

Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hi,
	the code you provide seems about right. Take a look at DOMPrint. 
It provides the exact code.

Gareth



On Mon, 16 Jun 2003, Esther Parrilla Endrino wrote:

> Hello all,
> 
> I asked a couple of days ago here in the list about Xerces 2.2.0 support 
> for validating using Namespaces and somebody told me it was possible.
> I have been looking for an example but I have not found how can I set 
> that feature on.
> 
> I am using the following classes to set on the features I need:
> 
> ...
> 
> 	parser->setFeature(XMLUni::fgDOMNamespaces, doNamespaces);
> 
> 	parser->setFeature(XMLUni::fgXercesSchema, doSchema);
> 
> 	parser->setFeature(XMLUni::fgXercesSchemaFullChecking, 							schemaFullChecking);
> 
>      	parser->setFeature(XMLUni::fgDOMValidation, true);
> 
> 	parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
> 							                 	 
> parser->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, 
> propertyValue);
> 
> ...
> 
> Could I set support for Namespaces on in the same way?
> 
> Thanks in advance,
> 
> esther
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 
> 

-- 
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




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