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

ColdFusion doesnt like a Dash in XML Nodes?

New Here ,
Mar 23, 2007 Mar 23, 2007
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.
504
Translate
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
Participant ,
Mar 23, 2007 Mar 23, 2007
Did you try xmlformat?
<cfset writeoutput(xmlformat('<weather-conditions weather-summary="Chance Rain Showers">'))>
Translate
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 23, 2007 Mar 23, 2007
Can you just use array notation?
writeoutput('#XMLContent.dwml.data.parameters.weather['weather-conditions'].XmlAttributes["weather-summary"]#');
Translate
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
Community Expert ,
Mar 23, 2007 Mar 23, 2007
LATEST
Here, associative-array notation is better than dotted notation. Use

XMLContent["dwml"]["data"]["parameters"]["weather"]["weather-conditions"].XmlAttributes["weather-summary"]

Translate
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