jhughes4
asked on
XML parsing with JSP, but not really JSP.
Hello Experts.
I have a peculiar question. I have a group of Siebel people who have to parse an XML message. Siebel uses its own proprietary language for coding, but underneath its JSP. The problem is that no one is familiar with JSP. So with the limited knowledge of JSP and Siebel not able to parse using a utility like DOM, can someone provide some sample code that would parse this XML…PLEASE! Thank you in advance. If I could assign 1000 points to this I would.
<Transaction TargetApplicationName="Str ing" DateTimeStamp="2001-12-17T 09:30:47.0 Z" TransactionIndicator="Stri ng">
<Object2>
<Contact searchspec="String" Transaction="Create">
<AgentNumber>111111</Agent Number>
<ContactType>PY</ContactTy pe>
<AgentType>FEO</AgentType>
<AgentTypeDescription>Part Time</AgentTypeDescription >
<AgentStatus>A</AgentStatu s>
<AgentStatusDescription>Ac tive</Agen tStatusDes cription>
<FillerField1>String</Fill erField1>
<FillerField2>String</Fill erField2>
<PersonalInformation>
<FirstName>Bob</FirstName>
<MiddleName>M</MiddleName>
<LastName>Smith</LastName>
<Suffix>Jr</Suffix>
<Designation>LUTUF;ABC</De signation>
<PreferredName>Willina</Pr eferredNam e>
<EmailAddress>sasdsad@abc. com</Email Address>
</PersonalInformation>
<ListOfAccount_BusinessAdd ress>
<AddressTypeCode>O</Addres sTypeCode>
<AddressLine1>3041</Addres sLine1>
<AddressLine2>Cochran</Add ressLine2>
<City>some city </City>
<State>some state</State>
<Zip>10845</Zip>
<FillerField1>String</Fill erField1>
<FillerField2>String</Fill erField2>
<AddressTypeCode>M</Addres sTypeCode>
<AddressLine1>3042</Addres sLine1>
<AddressLine2>Cochran</Add ressLine2>
<City>somecity</City>
<State>somestate</State>
<Zip>10845</Zip>
<FillerField1>String</Fill erField1>
<FillerField2>String</Fill erField2>
</ListOfAccount_BusinessAd dress>
<RoleInformation>
<UniqueProducerNumber>1123 3433</Uniq ueProducer Number>
<ProducerExpirationDate>03 /21/2006</ ProducerEx pirationDa te>
<LDAPId>String</LDAPId>
<CandidateCode>ABC</Candid ateCode>
<AgencyName>AAAA Ins Company</AgencyName>
<SecondaryLegacyNumber>111 1</Seconda ryLegacyNu mber>
</RoleInformation>
<OrganizationDetails>
<CodeType>DIV</CodeType>
<Code>01</Code>
<CodeDescription>Test Div 01</CodeDescription>
<CodeType>DIS</CodeType>
<Code>01</Code>
<CodeDescription>Test District 01</CodeDescription>
<CodeType>OFF</CodeType>
<Code>08</Code>
<CodeDescription>Test Office</CodeDescription>
<CodeType>ST</CodeType>
<Code>CA</Code>
<CodeDescription>adsfasdf< /CodeDescr iption>
<CodeType></CodeType>
<Code></Code>
<CodeDescription></CodeDes cription>
</OrganizationDetails>
<PhoneInformation>
<PhoneType>W</PhoneType>
<PhoneNumber>111111111</Ph oneNumber>
</PhoneInformation>
<AwardInformation>
<AwardType>AG</AwardType>
<AwardDate>03/21/2006</Awa rdDate>
<AwardType>FA</AwardType>
<AwardDate>03/22/2006</Awa rdDate>
<AwardType>DE</AwardType>
<AwardDate>03/23/2006</Awa rdDate>
<AwardType></AwardType>
<AwardDate></AwardDate>
</AwardInformation>
</Contact>
</Object2>
</Transaction>
I have a peculiar question. I have a group of Siebel people who have to parse an XML message. Siebel uses its own proprietary language for coding, but underneath its JSP. The problem is that no one is familiar with JSP. So with the limited knowledge of JSP and Siebel not able to parse using a utility like DOM, can someone provide some sample code that would parse this XML…PLEASE! Thank you in advance. If I could assign 1000 points to this I would.
<Transaction TargetApplicationName="Str
<Object2>
<Contact searchspec="String" Transaction="Create">
<AgentNumber>111111</Agent
<ContactType>PY</ContactTy
<AgentType>FEO</AgentType>
<AgentTypeDescription>Part
<AgentStatus>A</AgentStatu
<AgentStatusDescription>Ac
<FillerField1>String</Fill
<FillerField2>String</Fill
<PersonalInformation>
<FirstName>Bob</FirstName>
<MiddleName>M</MiddleName>
<LastName>Smith</LastName>
<Suffix>Jr</Suffix>
<Designation>LUTUF;ABC</De
<PreferredName>Willina</Pr
<EmailAddress>sasdsad@abc.
</PersonalInformation>
<ListOfAccount_BusinessAdd
<AddressTypeCode>O</Addres
<AddressLine1>3041</Addres
<AddressLine2>Cochran</Add
<City>some city </City>
<State>some state</State>
<Zip>10845</Zip>
<FillerField1>String</Fill
<FillerField2>String</Fill
<AddressTypeCode>M</Addres
<AddressLine1>3042</Addres
<AddressLine2>Cochran</Add
<City>somecity</City>
<State>somestate</State>
<Zip>10845</Zip>
<FillerField1>String</Fill
<FillerField2>String</Fill
</ListOfAccount_BusinessAd
<RoleInformation>
<UniqueProducerNumber>1123
<ProducerExpirationDate>03
<LDAPId>String</LDAPId>
<CandidateCode>ABC</Candid
<AgencyName>AAAA Ins Company</AgencyName>
<SecondaryLegacyNumber>111
</RoleInformation>
<OrganizationDetails>
<CodeType>DIV</CodeType>
<Code>01</Code>
<CodeDescription>Test Div 01</CodeDescription>
<CodeType>DIS</CodeType>
<Code>01</Code>
<CodeDescription>Test District 01</CodeDescription>
<CodeType>OFF</CodeType>
<Code>08</Code>
<CodeDescription>Test Office</CodeDescription>
<CodeType>ST</CodeType>
<Code>CA</Code>
<CodeDescription>adsfasdf<
<CodeType></CodeType>
<Code></Code>
<CodeDescription></CodeDes
</OrganizationDetails>
<PhoneInformation>
<PhoneType>W</PhoneType>
<PhoneNumber>111111111</Ph
</PhoneInformation>
<AwardInformation>
<AwardType>AG</AwardType>
<AwardDate>03/21/2006</Awa
<AwardType>FA</AwardType>
<AwardDate>03/22/2006</Awa
<AwardType>DE</AwardType>
<AwardDate>03/23/2006</Awa
<AwardType></AwardType>
<AwardDate></AwardDate>
</AwardInformation>
</Contact>
</Object2>
</Transaction>
ASKER
I don't think that the JSTL is available to Siebel. Is there another way? Can you also provide the java code? thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hav a look at the discussions...
https://www.experts-exchange.com/questions/11250375/DOM-vs-SAX.html
https://www.experts-exchange.com/questions/10337464/SAX-vs-DOM.html
https://www.experts-exchange.com/questions/11250375/DOM-vs-SAX.html
https://www.experts-exchange.com/questions/10337464/SAX-vs-DOM.html
As this is JSP I will guess the latter and say that you should use the JSTL libs http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html
--------------------------
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<c:import var='xml' url='message.xml'/><!-- import your message file-->
<x:parse xml="${xml}" var="doc" />
<table>
<tr>
<!-- now use standard xpath to traverse the document -->
<td><x:out select="$doc/Transaction/O
<td><x:out select="$doc//FirstName"/>
</tr>
</table>
--------------------------
If you need some java code to parse it then I can provide a utility class for that too.