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

XML Parsing

New Here ,
Jul 15, 2008 Jul 15, 2008

Copy link to clipboard

Copied

I am having no luck in Coldfusion in getting to the values of PID and ID in the following returned XML file. Any suggestions?

<cfxml variable="test">

<diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

<ProjectDataset xmlns=" http://tempuri.org/ProjectDataset.xsd">
<Project diffgr:id="Project1" msdata:rowOrder="0">
<PID>1234</PID>
<ID>1234</ID>
</Project>
</ProjectDataset>
</diffgr:diffgram>

</cfxml>

Thanks in advance...
TOPICS
Advanced techniques

Views

494

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

LEGEND , Jul 15, 2008 Jul 15, 2008
<cfoutput>
#test['diffgr:diffgram']['ProjectDataset']['Project']['PID']['XMLText']#
#test['diffgr:diffgram']['ProjectDataset']['Project']['ID']['XMLText']#
</cfoutput>

<cfdump var="#test#" format="html">

This should get you started.

Votes

Translate

Translate
LEGEND ,
Jul 15, 2008 Jul 15, 2008

Copy link to clipboard

Copied

<cfoutput>
#test['diffgr:diffgram']['ProjectDataset']['Project']['PID']['XMLText']#
#test['diffgr:diffgram']['ProjectDataset']['Project']['ID']['XMLText']#
</cfoutput>

<cfdump var="#test#" format="html">

This should get you started.

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
New Here ,
Jul 15, 2008 Jul 15, 2008

Copy link to clipboard

Copied

Thanks - that is exactly what I needed.

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
Engaged ,
Jul 15, 2008 Jul 15, 2008

Copy link to clipboard

Copied

Easy:-

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 ,
Jul 15, 2008 Jul 15, 2008

Copy link to clipboard

Copied

Stressed_Simon wrote:
> ...
> <cfset xTest = xmlParse(trim(test))>

I'll point out that xmlParse() is unnecessary here, since the <cfxml...>
tag already creates an xml object in ColdFusion.

It would be use if one was converting an XML string into an xml object.

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
Engaged ,
Jul 15, 2008 Jul 15, 2008

Copy link to clipboard

Copied

LATEST
Good point. Only half read it!

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