Say I have a schema as follows: (only a part of it):

<xs:complexType name="EquityTradeType" id="ET.0">
  <xs:sequence>
    <xs:element name="msgHdr" type="MsgHdrType" id="MH.0"/>
    <xs:element name="eqtyBlock" type="EquityBlockType" id="EB.0"/>
    <xs:element name="eqtyAlloc" type="EquityAllocType" id="EA.0" 
maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

and I'm parsing an XML file with an element of type EquityTradeType.
<gtsEquityTrade>
  <msgHdr> 
    ..
    ..
  </msgHdr>
  <eqtyBlock> 
    ..
    ..
  </eqtyBlock>
  <eqtyAlloc> 
    ..
    ..
  </eqtyAlloc>

Then ofcourse, the SAXParser reports the element name eg "msgHdr" etc as it 
encounters them. However, if I'm doing schema-based parsing, should it not be 
possible to get the "id" from the parser? After all, it has the full schema map 
in memory, which it is using for validation etc.

This would be very convenient for dumping this info into a struct as a switch 
statement can be used instead of the cumbersome if (strcmp(name, "msgHdr")==0) 
etc. as I can convert the ID into a number.

Thanks for your help!
Vijay


  



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to