Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Unresolved element when validate using DOM format
Unresolved element when validate using DOM format [message #583397] Wed, 11 February 2004 23:09
Joshua Hui is currently offline Joshua HuiFriend
Messages: 23
Registered: July 2009
Junior Member
Hi,

When I parsed the xsd file as DOM and set it to XSDSchema for validation,
it
gave me the following error.

At node [xsd:element], XSD: Element Reference 'http://xyz.com#properties'
is unresolved

However, if I parsed the xsd file directly, it works fine. Any idea?

Here is the XSD file. The properties element does exist in the "xyz.xsd"
schema file in the given location.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:cm="http://xyz.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://xyz.com"
schemaLocation="file:///c:/tmp/xyz.xsd" />
<xsd:element name="Simple30">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="0" ref="cm:properties"/>
</xsd:sequence>
<xsd:attribute name="varchar200" use="optional" default="Hello">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="200" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:schema>

Here is how I validate the schema.

Element schemaElem = xsdDOMObject.getDocumentElement();

if (schemaElem.getLocalName().equals("schema")
&&
XSDConstants.isSchemaForSchemaNamespace(schemaElem.getNamesp aceURI())) {

xsdSchema = xsdFactory.createXSDSchema();
xsdSchema.setElement(schemaElem);
xsdSchema.validate();

// Check the result of parsing schema
checkDiagnostics(xsdSchema);
} else {
// Throw an exception
}

Thanks.

Joshua
Previous Topic:Retreiving the original content of an extended type
Next Topic:How to provide a different schema content
Goto Forum:
  


Current Time: Fri Dec 19 10:16:29 GMT 2014

Powered by FUDForum. Page generated in 0.03517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software