Parsing XSD Schema from namespace schemaLocation using Xerces CDT

C

christian.eickhoff

Hi,

I have a general question regarding the parsing of XSD files,
referenced within the namespace using Apache Xerces 2.7.0 (CDT). My
current c++ application can parse and validate an XML file and an XSD
schema, both located on my harddisk, against each other without any
problems. I can therefore also parse the schema file and access it the
same way than a common xml file.
The question now is whether Xerces provides the possibility to parse a
schema file that is just references within the namespace declaration
into a DOMDocument for example so that my application can not just
validate both files against each other but it should be able to parse
the entire schema instance as I need to analyze subsections of the xsd
accordingly.
Anybody some idea or some sample code how to realize this?

Best Regards,
Chris
 
J

Joe Kesselman

I'm not sure what you mean by "a schema file that is just references
within the namespace declaration". Namespace URIs are not guaranteed to
be the URI of the schema file which describes the document, which is why
there are separate mechanisms for associating namespaces with schemas.

Parsing a schema into a DOM document is reasonably straightforward once
you have the URIs of the schema files; just point an XML parser at the
schema URIs. Alternatively, you may want to check whether your parser
supports a schema-specific API (Xerces does), or the DOM Level 3 schema
model (I think Xerces does), which is a less-portable approach but which
makes retrieving useful information from the schema somewhat easier.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top