I have been writing a component that lets you do this kind of thing using
XPath. So you can do things like:

myXML.Insert('XPath of parent','name of tag', value);

or

myXML.Delete('XPath of elements/attributes/comments/etc to delete');

or

myXML.Update('XPath of elements to update', value);

It is incomplete at present and undocumented but will do the thing you want
and more (it is also very efficient due to the use of XPath).

Let me know if you'd like me to send you a copy..

Dominic


On 25/07/07, Lee <[EMAIL PROTECTED]> wrote:
>
> We are having trouble inserting a line into XML when using
> straight string manipulation it blows up on XML Search. We
> are guessing that there is a better
> way to insert the line. Details below.
>
> The existing XML structure shows (partial XML is noted in
> the examples below and does not represent the entire xml
> document):
>
> <ClientReferences>
>
>             <IdValue
> name="ClientReferenceField2_Value">crf2</IdValue>
>
> </ClientReferences>
>
>
> We wish to add another <IdValue> node before the
> ClientReferenceField2_Value attribute as follows:
>
>
>             <IdValue
> name="ClientReferenceField1_Value">crf1</IdValue>
>
>
> The resulting XML structure would show:
>
>
> <ClientReferences>
>
>             <IdValue
> name="ClientReferenceField1_Value">crf1</IdValue>
>
>             <IdValue
> name="ClientReferenceField2_Value">crf2</IdValue>
>
> </ClientReferences>
>
> The full Xpath to <ClientReferences> is as follows:
>
> /BackgroundCheck/BackgroundSearchPackage/Screenings/ClientReferences
>
> Notes:
>
> -          Assume the existing XML document is in a
> ColdFusion structure through the use of XmlParse()
>
> -          The resulting XML should be maintained as a
> ColdFusion structure that will allow Xpath searches using
> XMLSearch()
>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284556
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