Jump to content

Translating embedded xml


michaelloveusa
 Share

Recommended Posts

Hi there - I am trying to deal with a response that I am getting from a webservice that has a string element that contains xml as such: <GetAmountDueResponse xmlns="http://www.changemeback.com"> <GetAmountDueResult><![CDATA[<amountsdue resultstatus=0" resultdescr="Successful" xmlns="http://www.changemeback.com/schemas/AmountsDue"> <revobjs> <revobj id="271968" pin="033719689" lendershortdescr="" lenderdescr="" serviceshortdescr="" servicedescr="" dirtyreadchecksum="1628" situsfreeformaddr="18151 E 6TH AVE" situscitystatezip="AURORA, CA 82311-9402" situsstreetnumber="18151" situsstreetnumbersfx="" situspredirectional="East" situsstreetname="6TH" situsstreettype="Avenue" situspostdirectional="" situsunittype="" situsunitnumber="" situscity="AURORA" situstateabbrev="CA" situspostalcd="82311-9402" /> </revobjs> <parties> <party id="271968006" revobjid="271968" name="MODULAR SPACES" nameprefix="" firstname="" middlename="" lastname="MODULAR SPACES" namesuffix="" attention="MODULAR SPACES" legalpartytype="102055" legalpartytypedesc="Proprietorship" addresstype="101600" deliveryaddr1="1200 SWEDESFORD RD" deliveryaddr2="BERWYN PA 19312-1078" address="1200 SWEDESFORD" citystatezip="BERWYN, CA 23312-1078" streetnumber="1200" predirectional="" streetname="SWEDESFORD" streettype="RD" postdirectional="" unittype="" unitnumber="" city="BERWYN" state="California" stateabbrev="CA" zipcode="23312-1078" country="" /> </parties> <taxbills> <taxbill id="6714081" revobjid="271968" taxyear="2009" billnumber="200903371968901" tscertificatenumber="" dirtyreadchecksum="1628"> <duedates> <duedate inst="1" datedue="3/2/2009" fulldatedue="4/30/2009" /> <duedate inst="2" datedue="6/15/2009" fulldatedue="4/30/2009" /> </duedates> <flags> <flag flagobjecttype="100252" id="15008893" /> </flags> </taxbill> </taxbills> <allocs> <alloc revobjid="271968" taxbillid="6714081" rolltype="1000002" revenuesource="290019" type="290085" cd="290090" inst="1" amount="2897.88" fullamount="2897.88" /> <alloc revobjid="271968" taxbillid="6714081" rolltype="1000002" revenuesource="290019" type="290085" cd="290090" inst="2" amount="2897.85" fullamount="2897.85" /> <alloc revobjid="271968" taxbillid="6714081" rolltype="1000002" revenuesource="290019" type="290087" cd="1000501" inst="1" amount="5.00" fullamount="5.00" /> <alloc revobjid="271968" taxbillid="6714081" rolltype="1000002" revenuesource="290019" type="290087" cd="1000501" inst="2" amount="5.00" fullamount="5.00" /> </allocs></amountsdue>]]></GetAmountDueResult> </GetAmountDueResponse> I have derived an xsd for it, but I need to know how to get the elements out of the string. Ideas?Thanks! Mike

Link to comment
Share on other sites

Try this:

 [/size][size="2"] <xsl:output method="xml" [font="Courier New"][size="2"][font="Courier New"][size="2"]cdata-section-elements="GetAmountDueResult"[/size][/font][/size][/font][size="2"]/>[/size][/size][size="2"]
<xsl:template match="GetAmountDueResult"><xsl:copy><xsl:value-of disable-output-escaping="yes" select="."/></xsl:copy></xsl:template >[/size][size="2"]

Link to comment
Share on other sites

That didn't post correctly. Here it is again:

<xsl:output method="xml" cdata-section-elements="GetAmountDueResult"/>

<xsl:template match="GetAmountDueResult"><xsl:copy><xsl:value-of disable-output-escaping="yes" select="."/></xsl:copy></xsl:template >

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...