You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Andrea009 <an...@group1software.co.uk> on 2009/07/06 18:05:56 UTC

Reading non referenced complexTypes from a Schema

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.

Thanks for your help.

Andrea




-- 
View this message in context: http://www.nabble.com/Reading-non-referenced-complexTypes-from-a-Schema-tp24358291p24358291.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


Re: Reading non referenced complexTypes from a Schema

Posted by Andrea009 <an...@group1software.co.uk>.


David Bertoni wrote:
> 
> 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
> 

Thanks! Our current model hasnt been anywhere near the XSModel. Ive taken
over a old project and its been an uphill struggle to get to grips with all
the various interfaces. Ive had a quick peep at the XSModel and it looks as
if it will open up many of our current restrictions. It does seem to be
exactly what is required although now I have a lot of code to rewrite and
figure out.

Andrea


-- 
View this message in context: http://www.nabble.com/Reading-non-referenced-complexTypes-from-a-Schema-tp24358291p24372078.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


Re: Reading non referenced complexTypes from a Schema

Posted by David Bertoni <db...@apache.org>.
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