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: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
Gareth Reakes, Head of Product Development +44-1865-203192
DecisionSoft Limited http://www.decisionsoft.com
XML Development and Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]