I think this is the perfect situation for my betterXml component:
http://betterxml.riaforge.org
With it you could do this with only a few lines of code (XPath required), ie.
oXml = CreateObject('component', 'betterXmlEditor').init(xmlSource);
// xml string, file or url for the source
oXml.Update('//[EMAIL PROTECTED]"#theId#"]', theContentToAdd); // updates
all elements with id="#theId#" with theContentToAdd (can be either
structure or plain string);
oXml.Write(xmlFilePath);
HTH
Dominic
2008/7/10 Cindi Vinette <[EMAIL PROTECTED]>:
> Sorry for the double-post...
>
>
>> Hello - wondering if anyone can help me...
>>
>> I'm trying to dynamically add a child node to an XML node and all that
>> I know of the parent that I want to add it to is the XmlAttributes.id
>> value
>>
>> Here's the example XML file that I am trying to create:
>>
>> -----------------------------------------------------
>> <?xml version="1.0" encoding="UTF-8"?>
>> <body>
>> <css src="/templates/101/layout.css"/>
>> <layout id="fixed-3col-centered">
>> <div id="outside_a_pageAlign">
>> <div id="outside_b_pageBackground">
>> <div id="outside_c_mainBox">
>> <div id="outside_d_content">
>> <div id="row1_header" />
>> <div id="row2_a_main">
>> <div id="row2_b_container1">
>> <div id="row2_c_column1" />
>> <div id="row2_c_column2">
>> <content id="content1"
>> />
>> </div>
>> <div id="row2_c_column3" />
>> </div>
>> <div id="row2_d_container2"><text
>> id="text_clear"><br
>> clear="all" /></text></div>
>> </div>
>> <div id="row3_footer" />
>> </div>
>> </div>
>> </div>
>> </div>
>> </layout>
>> </body>
>> -----------------------------------------------------
>>
>> For each div that I want to add, I know the parent div ID.
>> This is just one example (it happens to be the most complex).
>> How do I loop over an existing XML structure and find the node that
>> matches the parent ID that I am looking for if I don't know how deep
>> the XML structure could be...
>>
>> I'm thinking i need to create a recursive function, but I can't seem
>> to get the code right...
>>
>> any help would be much appreciated...
>>
>> Thanks!
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308922
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4