0
ColdFusion doesnt like a Dash in XML Nodes?
New Here
,
/t5/coldfusion-discussions/coldfusion-doesnt-like-a-dash-in-xml-nodes/td-p/660690
Mar 23, 2007
Mar 23, 2007
Copy link to clipboard
Copied
One of the SOAP requests I do gives back:
nodes like this:
<weather-conditions weather-summary="Chance Rain Showers">
But if I try to reference them in CF like such:
writeoutput('#XMLContent.dwml.data.parameters.weather.weather-conditions.XmlAttributes["weather-summary"]#');
It doenst like it. I'd rather not use XMLChildren to get around this as its usually messy.
nodes like this:
<weather-conditions weather-summary="Chance Rain Showers">
But if I try to reference them in CF like such:
writeoutput('#XMLContent.dwml.data.parameters.weather.weather-conditions.XmlAttributes["weather-summary"]#');
It doenst like it. I'd rather not use XMLChildren to get around this as its usually messy.

Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
/t5/coldfusion-discussions/coldfusion-doesnt-like-a-dash-in-xml-nodes/m-p/660691#M62376
Mar 23, 2007
Mar 23, 2007
Copy link to clipboard
Copied
Did you try xmlformat?
<cfset writeoutput(xmlformat('<weather-conditions weather-summary="Chance Rain Showers">'))>
<cfset writeoutput(xmlformat('<weather-conditions weather-summary="Chance Rain Showers">'))>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/coldfusion-discussions/coldfusion-doesnt-like-a-dash-in-xml-nodes/m-p/660692#M62377
Mar 23, 2007
Mar 23, 2007
Copy link to clipboard
Copied
Can you just use array notation?
writeoutput('#XMLContent.dwml.data.parameters.weather['weather-conditions'].XmlAttributes["weather-summary"]#');
writeoutput('#XMLContent.dwml.data.parameters.weather['weather-conditions'].XmlAttributes["weather-summary"]#');
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/coldfusion-discussions/coldfusion-doesnt-like-a-dash-in-xml-nodes/m-p/660693#M62378
Mar 23, 2007
Mar 23, 2007
Copy link to clipboard
Copied
Here, associative-array notation is better than dotted
notation. Use
XMLContent["dwml"]["data"]["parameters"]["weather"]["weather-conditions"].XmlAttributes["weather-summary"]
XMLContent["dwml"]["data"]["parameters"]["weather"]["weather-conditions"].XmlAttributes["weather-summary"]
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

