Skip to main content
January 18, 2010
Question

Convert XML to Regular Text Variable

  • January 18, 2010
  • 2 replies
  • 817 views

I have an XML file I have parsed thru to extract particular values.

XMLParse(xf.carts.cart.header.shiptotal)

I am using the above tag to extract values, but this also extracts the XML code with the value. Although it displays on the screen as the value, in the html it has all the standard xml code as well.

The above looks like this in HTML:

<?xml version="1.0" encoding="UTF-8"?>
<ShipTotal>13.95</ShipTotal>

I need it to look like this:
13.95

All I need is the variable amount - is there a tag to extract only the value?

Thanks.

Chuck


This topic has been closed for replies.

2 replies

January 18, 2010

I have tried several of those examples on that page, to no avail.

Like to the: ToString() command - still brings back XML code in the view source.

Anyone have the particular "MAGIC" command to use to just get the value of the XML variable back without any other xml code?

Thanks.

Chuck

Inspiring
January 18, 2010

I have tried several of those examples on that page, to no avail.

Like to the: ToString() command - still brings back XML code in the view source.

Anyone have the particular "MAGIC" command to use to just get the value of the XML variable back without any other xml code?

This page - http://livedocs.adobe.com/coldfusion/8/htmldocs/XML_08.html#1127795 - has everything you need.  That tells you how to explicitly address nodes / values etc.

Also this one is helpful too: http://livedocs.adobe.com/coldfusion/8/htmldocs/XML_16.html#1140176. xpath is handy for extracting series of nodes / data within them.

--

Adam


Inspiring
January 18, 2010

There's a section in the docs covering what you need to know:

http://livedocs.adobe.com/coldfusion/8/htmldocs/XML_01.html

--

Adam