> In all my examples, I have been assuming that if data (text) 
> was stored inside of a start and end tag, then there would 
> not also be nested tags at that level.  Obviously that would 
> not always be true.

XHTML is a great example of that, of course. It isn't immediately obvious,
though, if you're learning about XML without looking at a wide variety of
examples of specific XML languages.

> My introduction to XML was through ColdFusion and in CF you 
> do not access the text of an element the same way you would a 
> child element.

No, CF makes things very easy - too easy, sometimes! I would recommend
learning about XML DOM parsing, as it better reflects how the rest of the
world works with XML. Of course, when you don't need that level of
complexity, you will appreciate CF's oversimplification.

> Truthfully, I'm not sure how to iterate over child elements 
> excluding text nodes in JavaScript.  
> I could use getElementsByTagName() but only helps if I know 
> the names of the tags.  What would be the proper way to loop 
> over just the child tags??

You can loop over all of them, and within your loop check the node type and
conditionally exclude the text nodes. You could also return a nodeset using
an XPath expression, which would let you get just the nodes you want. You
could also resolve the problem before you get to the parser, by generating
XML with no extraneous whitespace - that's the approach I'd prefer, since
you actually want XML without whitespace. Don't worry too much about
readability; if you view your XML with an XML-aware viewer, like a browser,
it'll apply indentation for you.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

This email has been processed by SmoothZap - www.smoothwall.net


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281370
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to