Hi,
You need a targetnamespace. It wont be in a namespace otherwise - this is what is causing your error, your schema is not in the same namespace as the one you are trying to include. Xerces is correctly pointing this out to you. Can I suggest you take a look at a schema tutorial, and if you still have problems we take this off line? The section of the primer that deals with this is at
http://www.w3.org/TR/xmlschema-0/#UnqualLocals
Regards,
Gareth
Mirko Braun wrote:
Hi Gareth,
There is no targetNamespace. Here are the code fragments of my xml document and the schemas.
XML-Document:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="A.xsd"> ...
Schema A:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:include schemaLocation="xhtml.xsd"/>....
...<xsd:element maxOccurs="unbounded" minOccurs="0" type="p" name="p"/>
Schema B (xhtml.xsd):
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
and i set the following features for the DOMBuilder:
pToParser->setFeature(xercesc::XMLUni::fgXercesSchema,true); pToParser->setFeature(xercesc::XMLUni::fgXercesSchemaFullChecking, true);
Thanks in advance, Mirko
-----Ursprüngliche Nachricht-----
Von: Gareth Reakes [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 1. Dezember 2004 11:47
An: [EMAIL PROTECTED]
Betreff: Re: AW: AW: include Schema in a Schema
Hi,
Mirko Braun wrote:
How have you defined that they are in the same namespace? You don't appear to have declared an xsi:schemaLocation attribute.Hi Gareth,
thanks for your answer. I bound a prefix as you suggested and declared a namespace. But in this case the parser generates also an error message. The parser does not accept the namespace for the Schema B in connection with the include element. The parser suggests the import element. But my Schema A und the Schema B have the same namespace. Consequently i think it is right to use the include element.
Gareth
Do you have any further ideas?
Thanks in advance, Mirko
-----Ursprüngliche Nachricht----- Von: Gareth Reakes [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 30. November 2004 16:53 An: [EMAIL PROTECTED] Betreff: Re: AW: include Schema in a Schema
Hey,
You don't seem to bound the prefix as I suggested. Is there any part ofthank you very much for your answer. But i was not able to solve my problem.
my answer that requires further explanation? Let me try using your schema fragment as an example:
Note here that the default namespace is the null namespace. You areSchema A:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:include schemaLocation="xhtml.xsd"/>
The Schema A uses one XHTML tag (<p>) (defined in Schema B) as a part of a ComplexType (please see below) definition.
<xsd:element maxOccurs="unbounded" minOccurs="0" type="p" name="p"/>
trying to look up p in the null namespace, so it is not using p from schema B. You need to bind a prefix to the xhtml namespace. A rewritten version (I have not tested it, so forgive typos) might look like
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="whatever the namespace is"> <xsd:include schemaLocation="xhtml.xsd"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" type="xhtml:p" name="p"/>
Gareth
Schema xhtml (Schema B):
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!--Version: 01.14.04--> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Errormessages of Xercesc 2-3-0:
"Type not Found in :p" "Untyped element :p"
Can somebody help me?
Thanks in advance, Mirko
-----Ursprüngliche Nachricht----- Von: Gareth Reakes [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 4. November 2004 16:41 An: [EMAIL PROTECTED] Betreff: Re: include Schema in a Schema
Hi,
you are trying to reference p in the null namespace. You need to bind a prefix to the xhtml namespace and then reference it via that prefix.
Gareth
Mirko Braun wrote:
Hi all,
i would like to parse a XML file validating against a Schema A. And
this Schema A includes another Schema B (defines XHTML tags) . The code below shows the include mechanism of Schema B
in Schema A.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:include schemaLocation="xhtml.xsd"/>
The Schema A uses one XHTML tag (<p>) as a part of a ComplexType (please see below) definition.
<xsd:element maxOccurs="unbounded" minOccurs="0" type="p" name="p"/>
When i parse my XML file. The parser create following error messages:
"Type not Found in :p" "Untyped element :p"
Can anybody help me?
Thanks in advance,
Mirko
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Gareth Reakes, Managing Director Parthenon Computing
+44-1865-811184 http://www.parthcomp.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]