[xsde-users] xs:any and xs:anyAttribute

Jonathan Haws Jonathan.Haws at sdl.usu.edu
Fri Dec 23 00:36:15 EST 2011


Boris and Eric,

I guess my biggest question lies in how to get the sub-schema parsers tied into the main parser.  The wildcard example is not clear to me on how that is done.  

I have generated code in the following manner:

This command is for the sub-schemas:
# xsde cxx-hybrid --generate-parser --generate-serializer --custom-parser --custom-serializer CoT_contact.xsd CoT__flow-tags.xsd CoT_image.xsd CoT_link.xsd CoT_remarks.xsd CoT_request.xsd CoT_sensor.xsd CoT_shape.xsd CoT_spatial.xsd CoT_track.xsd CoT_uid.xsd

This command is for the top-level schema:
# xsde cxx-hybrid --generate-parser --generate-serializer --generate-aggregate --custom-data contact --custom-data link --custom-data image --custom-data _flow-tags --custom-data remarks --custom-data request --custom-data sensor --custom-data shape --custom-data spatial --custom-data track --custom-data uid --root-element detail Event-PUBLIC.xsd

Again, a valid XML has this structure:

<event>
  <point/>
  <detail>
    <!-- Varied schema(s) found in separate file is added here -->
  </detail>
</event>

I don't know if specifying detail as the root-element is correct?  The generated detail parser skeleton contains routines such as _start_any_element and _end_any_element, but I could not find any references to how I tie in all the lower level parsers.

Is this a correct statement:  when the top-level parser gets to the <detail> element, it recognizes that what is in <detail> are xs:any fields.  At this point it hands parsing off to the _start_any_element routine.  When a valid XML tag is found, it pulls the name of that tag and calls the appropriate parser for that tag, then moves onto the next one.  Is that correct?  Will XSD/e generate the function table for that if I provide it the correct options?

Again, what I am looking for is a way to setup a makefile that will generate and tie together all the parsing and serialization code.  Then all I need to do is write the driver.

Thanks!

Jonathan


-----Original Message-----
From: xsde-users-bounces at codesynthesis.com [mailto:xsde-users-bounces at codesynthesis.com] On Behalf Of Jonathan Haws
Sent: Thursday, December 22, 2011 22:26
To: Boris Kolpackov
Cc: xsde-users at codesynthesis.com
Subject: RE: [xsde-users] xs:any and xs:anyAttribute

Here is a quick question:

In the wildcard examples, how does the driver know that the xs:any is an envelope?  It seems that it is fine with how it is setup now, with envelope being the only option.  But let's say that we have two different envelopes - a square and a rectangle.  How does the driver distinguish that when making the call to _post()?

In my situation, I have a number of possibilities.  And the stuff in <detail> can be any number of things - a <color>, a <shape>, or something else.  Is there an example of that?  Or am I missing something?

Thanks!

Jonathan



-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com]
Sent: Thursday, December 22, 2011 05:20
To: Jonathan Haws
Cc: xsde-users at codesynthesis.com
Subject: Re: [xsde-users] xs:any and xs:anyAttribute

Hi Jonathan,

Jonathan Haws <Jonathan.Haws at sdl.usu.edu> writes:

> Anyway, is there an example that would show how this can be done?

Yes, see the 'wildcard' example. As Eric mentioned in his reply, you will need to compile each schema separately. Then you will need to route the widlcard content callbacks to the corresponding parser or serializer. The 'wildcard' example shows how to do this.

Boris




More information about the xsde-users mailing list