xerces-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Bertoni <dbert...@apache.org>
Subject Re: Reading non referenced complexTypes from a Schema
Date Mon, 06 Jul 2009 17:24:42 GMT
Andrea009 wrote:
> I have searched through the forums but so far unable to locate anything.
> 
> How can I enumerate complexType declarations in a schema when they do not
> have an element referencing them ?
> 
> e.g. (snippet)
> 
> 	<xs:complexType name="foo_extension">
> 	   <xs:complexContent>
> 	       <xs:extension base="foo">
> 	          <xs:attributeGroup ref="foo_properties"/>
> 	        </xs:extension>
> 	   </xs:complexContent>
> 	</xs:complexType>
> 
> 
> If I include <xs:element name="foo_extension"/> then using the following
> code is fine:
> 
> RefHash3KeysIdPoolEnumerator<SchemaElementDecl> schemaElemEnum =
> grammar->getElemEnumerator();
> 
> and I can loop around getting all the information I require. 
> 
> However an element declaration is not mandatory for the extension to be
> referenced using an xsi:type in the data. I need to read in the schema and
> get all non-referenced complexTypes before I start looking at data. Is there
> a way? I cannot see anything immediately obvious.
Have you tried using the XSModel APIs?  Those are a better fit for 
general schema information than hacking with the internal interfaces. 
They also attempt to mirror the PSVI as described by the schema 
recommendation.

The PSVIWriter sample uses these APIs, so you could take a look at it 
for more information.

Dave

Mime
View raw message