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

XML count nodes?

Guest
Aug 28, 2006 Aug 28, 2006

Copy link to clipboard

Copied

Hi everyone,

I'm developing part of a website that will open up an XML / RSS file (downloaded nightly from another site), extract article text and href link, then dump that info into an HTML DIV.

The problem I've having is that I've only been able to get it to work by hard setting a number of articles (nodes) to process.
In the attached code, you can see that I've set it number of items at 10 [see: <cfset numItems = 10>]. Of course when there are more then 10 articles, I'm only seeing 10, and when there's less then 10, the whole script blows up.

Is there a good way to dynmaicly set the #numItems# variable by coutning the nodes under "mydoc.feed.entry.content" in the XML file?

Thanks in advance,

- Ian in Los Angeles


TOPICS
Advanced techniques

Views

649

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

Explorer , Aug 28, 2006 Aug 28, 2006
I think you can use ArrayLen().

Check out this page, it really details all that you can do in Coldfusion as far as manipulating XML objects: http://livedocs.macromedia.com/coldfusion/7/htmldocs/00001514.htm

Specifically, change your numItems line to:

Votes

Translate

Translate
Explorer ,
Aug 28, 2006 Aug 28, 2006

Copy link to clipboard

Copied

I think you can use ArrayLen().

Check out this page, it really details all that you can do in Coldfusion as far as manipulating XML objects: http://livedocs.macromedia.com/coldfusion/7/htmldocs/00001514.htm

Specifically, change your numItems line to:

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
Aug 28, 2006 Aug 28, 2006

Copy link to clipboard

Copied

LATEST
That worked like a charm. Thanks!

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