6 Replies Latest reply: Jul 20, 2011 8:43 AM by 716599 RSS

    Generalized Parse XML using DOM java methods

    716599
      *<DataService xmlns="http://www.zsl.com/jque/services/mastercatalogrecord/wsdl/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://www.zsl.com/jque/services/mastercatalogrecord/wsdl/2.0 schemas/MasterCatalogRecord_Action.xsd">*
      *<Transaction>*
      *<Response type="Query">*
      *<MasterCatalogRecord etype="Entity">*
      *<ExternalKeys>*
      *<Key name="MASTERCATALOGNAME" type="string">PARTY</Key>*
      *<Key name="PRODUCTID" type="string">testsfd</Key>*
      *<Key name="PRODUCTIDEXT" type="string">1</Key>*
      *</ExternalKeys>*
      *<EntityData>*
      *<Attribute name="PRODUCTID" type="string">testsfd</Attribute>*
      *<Attribute name="COMPANY_NAME" type="string"></Attribute>*
      *<Attribute name="COMPANY_NAME_TWO" type="string"></Attribute>*
      *</EntityData>*
      *<RelationshipData>*
      *<Relationship>*
      *<RelationType>BrokerAssociationLink</RelationType>*
      *<RelatedEntities>*
      *<MasterCatalogRecord etype="Entity">*
      *<ExternalKeys>*
      *<Key name="MASTERCATALOGNAME" type="string">BROKER_ASSOC</Key>*
      *<Key name="PRODUCTID" type="string">test</Key>*
      *<Key name="PRODUCTIDEXT" type="string"></Key>*
      *</ExternalKeys>*
      *<EntityData>*
      *<Attribute name="PRODUCTID" type="string">test</Attribute>*
      *<Attribute name="ROLE" type="string"></Attribute>*
      *<Attribute name="PRODUCT" type="string"></Attribute>*
      *</EntityData>*
      *</MasterCatalogRecord>*
      *<RelationshipAttributes etype="Entity">*
      *</RelationshipAttributes>*
      *</RelatedEntities>*
      *</Relationship>*
      *<Relationship>*
      *<RelationType>myAddresses</RelationType>*
      *<RelatedEntities>*
      *<MasterCatalogRecord etype="Entity">*
      *<ExternalKeys>*
      *<Key name="MASTERCATALOGNAME" type="string">ADDRESS</Key>*
      *<Key name="PRODUCTID" type="string">asdad</Key>*
      *<Key name="PRODUCTIDEXT" type="string"></Key>*
      *</ExternalKeys>*
      *<EntityData>*
      *<Attribute name="PRODUCTID" type="string">asdad</Attribute>*
      *<Attribute name="LINE_ONE" type="string"></Attribute>*
      *<Attribute name="LINE_TWO" type="string"></Attribute>*
      *</EntityData>*
      *</MasterCatalogRecord>*
      *<RelationshipAttributes etype="Entity">*
      *</RelationshipAttributes>*
      *</RelatedEntities>*
      *</Relationship>*
      *</RelationshipData>*
      *</MasterCatalogRecord>*
      *</Response>*
      *<TransactionResult result="Completed">*
      *<SuccessCount>1</SuccessCount>*
      *</TransactionResult>*
      *</Transaction>*
      *</DataService>*
      I am new to XML parsers and java.
      I need help to parse above xml and form different java object out of it , like MASTERCATALOGNAME party has different attributes and it have related objects such as ADDRESS and BROKER_ASSOC . so i need to set values of this objects by extracting values of attributes from above xml. would it be possible ? if yes , can anyone show me code snippet for same ?


      Thanks.

      Edited by: user8713254 on Jul 17, 2011 6:36 AM

      Edited by: user8713254 on Jul 17, 2011 6:37 AM

      Edited by: user8713254 on Jul 17, 2011 6:38 AM

      Edited by: user8713254 on Jul 17, 2011 6:39 AM