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

xml loop threw file

Guest
Jul 24, 2007 Jul 24, 2007

Copy link to clipboard

Copied

How can I loop threw and display 2 records as separate and store into db. thanx

<Row>
<employee>
<id>232</id>
<firstname>Test1</firstname>
<lastname>test2</lastname>
</employee>
<employee>
<id>231</id>
<firstname>Test1</firstname>
<lastname>test2</lastname>
</employee>
</row>
TOPICS
Advanced techniques

Views

201

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
Guest
Jul 26, 2007 Jul 26, 2007

Copy link to clipboard

Copied

See if this helps:

<cfxml variable="myXml">
<row>
<employee>
<id>232</id>
<firstname>Test1</firstname>
<lastname>test2</lastname>
</employee>
<employee>
<id>231</id>
<firstname>Test1</firstname>
<lastname>test2</lastname>
</employee>
</row>
</cfxml>

<cfoutput>


<cfloop from="1" to="#ArrayLen(XmlSearch(myXml, '//employee'))#" index="i">
<cfloop from="1" to="#ArrayLen(myXml.row.employee .xmlChildren)#" index="j">
#myXml.row.employee
.xmlChildren.xmlName# : #myXml.row.employee .xmlChildren.xmlText#<br />
</cfloop>
<hr />
</cfloop>

</cfoutput>

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
Guest
Oct 22, 2007 Oct 22, 2007

Copy link to clipboard

Copied

LATEST
doesn't work . It is getting same output. If you put different value in firstname and lastname it is not getting correct result. it is getting same result even if you change value for first name and lastname in second time.

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