[
Lists Home |
Date Index |
Thread Index
]
Hello again.
I'm having trouble validating an xml file I've created against an xsd I've
made. I'm trying to use a modular design in my XML Schema so that I can get
reuse out of elements I've defined. I'm using XMLSpy Home as my validation
tool.
When I attempt to validate my xml document, I'm getting the message that
it's hitting an unexpected element. Ironically, the unexpected element is in
fact the element it should be expecting. I believe the problem may be
related to namespace (which I'm not very good with).
Can anyone help me with this, or point me in the direction of a page that
might help? Any help would be appreciated. Thanks.
Darren
**relevant code**
[from article.xml - the document being validated]
<?xml version="1.0" encoding="utf-8"?>
<standaloneArticle
xmlns="http://globals.namespace.org/content/xml/xsd/v10/article/single/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://globals.namespace.org/content/xml/xsd/v10/article
/single/ standaloneArticle.xsd">
<article>
...
</article>
</standaloneArticle>
----------------------------------
[from standaloneArticle.xsd]
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema
targetNamespace="http://globals.namespace.org/content/xml/xsd/v10/article/si
ngle/"
xmlns:sar="http://globals.
namespace.org/content/xml/xsd/v10/article/single/"
xmlns:art="http://globals.namespace.org/content/xml/xsd/v10/article/"
xmlns:ref="http://globals.namespace.org/content/xml/xsd/v10/reference/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="qualified">
<!-- import of external definitions -->
<xs:import
namespace="http://globals.namespace.org/content/xml/xsd/v10/article/"
schemaLocation="article.xsd"/>
<xs:import
namespace="http://globals.namespace.org/content/xml/xsd/v10/reference/"
schemaLocation="reference.xsd"/>
<!-- definition of complex type elements -->
<xs:element name="standaloneArticle">
<xs:complexType>
<xs:sequence>
<xs:element ref="art:article" minOccurs="1" maxOccurs="1"/>
<xs:element ref="ref:reference" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
----------------------------------
[from article.xsd]
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema
targetNamespace="http://globals.namespace.org/content/xml/xsd/v10/article/"
xmlns:art="http://globals.namespace.org/content/xml/xsd/v10/article/"
xmlns:aut="http://globals.namespace.org/content/xml/xsd/v10/author/"
xmlns:sty="http://globals.namespace.org/content/xml/xsd/v10/style/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="qualified">
<!-- import of external definitions -->
...
</xs:schema>
|