Subject seVar() in XML
From Kiron Joseph <kiron@datadevices.com>
Date Thu, 05 Mar 2020 18:16:20 +0530
Newsgroups xb2net

Hi,

Below XML sample i took from xb2.Net documentation. Added an
additional attribute "TestAttrib" for testing purpose.

I want to make following two changes in this XML using :setVar()

<CurrencyCode>USD</CurrencyCode> to <CurrencyCode>INR</CurrencyCode>

and

<DiscountedCharges TestAttrib="One"> to <DiscountedCharges
TestAttrib="Two">

I tried a lot based on the examples in documentation and new group.
But not yet succeed.

Anybody can help me on this ?

Regards
Kiron



FUNCTION CHANGEXML()
LOCAL cXml,oXml,cXMLFile
*
TEXT INTO cXml TRIMMED
<?xml version="1.0" ?>
<FDXRateReply xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <EstimatedCharges>
        <RateScale>01552</RateScale>
        <RateZone>5</RateZone>
        <CurrencyCode>USD</CurrencyCode>
        <BilledWeight>10.0</BilledWeight>
        <DiscountedCharges TestAttrib="One">
            <BaseCharge>47.75</BaseCharge>
            <TotalDiscount>0.00</TotalDiscount>
            <Surcharges>
                <Fuel>2.63</Fuel>
                <Other>0.00</Other>
            </Surcharges>
            <TotalSurcharge>2.63</TotalSurcharge>
            <NetCharge>50.38</NetCharge>
            <TotalRebate>0.00</TotalRebate>
        </DiscountedCharges>
    </EstimatedCharges>
</FDXRateReply>
ENDTEXT
*
oXML:=xbXMLDocument():New(cXML)
oXML:serializationFormat:=XML_BINDING_ENCODED
*





*
cXML:=oXML:asString()
*
cXMLFile:="TEST.XML"
*
Set Console Off
Set Alternate To (cXMLFile)
Set Alternate On
*
? AllTrim(cXML)
*
Set Alternate Off
Set Alternate To
Set Console On
RETURN Nil //ChangeXML()
XML()

Recent messages in this thread
 
.# seVar() in XML (Current message) Kiron Joseph 05-Mar-2020 07:46 am