XML schema type information using libxml2

To begin with, the application I'm working on uses libxml2 to parse XML and to validate this XML against a schema, and I cannot use another XML-parsing library.

The schema contains type information for elements in the XML, and I'm trying to get this type information but am not succeeding.

Example schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="rootElement" type="xsd:integer"/>
</xsd:schema>

Example XML

<rootElement>13</rootElement>

What I want to get from libxml2 is information about the fact that the rootElement can only contain an integer value, as prescribed by the type="xsd:integer" bit.

I'm most interested in the simple types, i.e. xsd:integer, xsd:string, xsd:double, xsd:boolean, etc. If an element is a complex type, the exact type is not important.

Upvotes: 0

Views: 458

Answers (1)

nwellnhof
nwellnhof

Reputation: 33618

The libxml2 API simply doesn't support inspection of schemas, only validation.

Upvotes: 1

Related Questions