• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Xml content element problem

Explorer ,
Mar 04, 2009 Mar 04, 2009

Copy link to clipboard

Copied

hello,

I make a SOAP request using cfhttp and I ‘ve to display the amount I get.
I get the values using the following code:

<CFSet xmlDoc = XMLParse(cfhttp.filecontent)>
<CFDump var="#xmlDoc#">

but
#xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren [1]. Amount#

returns: 29015

i can’t divide this value because it ‘s not numeric
In fact, when I use htmleditformat =>
#htmleditformat (xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren [1]. Amount) #
it returns
<?xml version="1.0" encoding="UTF-8"?> <Amount xmlns=" http://tempuri.org/">29015</ Amount >

How can I get directly the numerical value 29015 so that I can divide it by 100 and display 290,15

thank you in advance
TOPICS
Advanced techniques

Views

483

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Mar 05, 2009 Mar 05, 2009
I found it :-)

the response was XmlText not XmlValue

#xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren
[1].Amount.XmlText# return the correct value ;-)

thanks a lot

MAgic


Votes

Translate

Translate
LEGEND ,
Mar 04, 2009 Mar 04, 2009

Copy link to clipboard

Copied

SamMagic wrote:
> hello,
>
> I make a SOAP request using cfhttp and I ?ve to display the amount I get.
> I get the values using the following code:
>
> <CFSet xmlDoc = XMLParse(cfhttp.filecontent)>
> <CFDump var="#xmlDoc#">
>
> but
> #xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren [1]. Amount#

You can access the value with XmlValue:

#xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren
[1].Amount.XmlValue#

--
Mack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 04, 2009 Mar 04, 2009

Copy link to clipboard

Copied

> #xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren [1]. Amount#

I presume this is a node? IN which case you want thr xmlText of the node,
not the whole thing.

It might be an idea to review the docs on this, to get a clearer
understanding of how it works:
http://livedocs.adobe.com/coldfusion/8/XML_01.html

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 04, 2009 Mar 04, 2009

Copy link to clipboard

Copied

Thanks Mack and Adam for replies :-)

I've already read doc but without success
i've tried

#xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren
[1].Amount.XmlValue#

but it gives me an empty value, nothing to display

even
#len(xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren
[1].Amount.XmlValue)#
returns 0

i'm sure that it s something simple to do but what ??

thanks for your help

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 04, 2009 Mar 04, 2009

Copy link to clipboard

Copied

> #xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren
> [1].Amount.XmlValue#

As per my earlier comment:
>> I presume this is a node?
>> In which case you want the ***xmlText*** of the node, not the whole thing.

(note my emphasis)


> I've already read doc but without success

I think you need to read them a bit more thoroughly. It's pretty well
spelled out here:
http://livedocs.adobe.com/coldfusion/8/htmldocs/XML_08.html#1127795

(which is the fourth page of the stuff I suggested you reading last time)

I'm not trying to be "funny", it is worth reading this stuff throughly:
there's a lot of good info in there.

Read it, try the code, modify the code and try to predict the results, etc.
If you don't completely understand something, stick at it until you do.
Then it'll sink in.


--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 05, 2009 Mar 05, 2009

Copy link to clipboard

Copied

I found it :-)

the response was XmlText not XmlValue

#xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren
[1].Amount.XmlText# return the correct value ;-)

thanks a lot

MAgic


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 09, 2009 Mar 09, 2009

Copy link to clipboard

Copied

LATEST
SamMagic wrote:
> I found it :-)
>
> the response was XmlText not XmlValue
>
> #xmlDoc.XmlRoot.XmlChildren [1]. XmlChildren [1]. XmlChildren
> [1].Amount.XmlText# return the correct value ;-)

Sorry, my mistake. XmlText is correct.

--
Mack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation