Hi Jason

Sorry for the slow response to your question.

The character data of a specific element - 'XMLText' in the CFMX model,
'Text' in the standard XML DOM - is itself a node (a child node of the
Element node, to be exact) and is not often sub-divided. However, there is a
method in the DOM specification for exactly this purpose: splitText().

>From the JAXP API documentation on the splitText method:

"Breaks this node into two nodes at the specified offset, keeping both in
the tree as siblings. After being split, this node will contain all the
content up to the offset point. A new node of the same type, which contains
all the content at and after the offset point, is returned. If the original
node had a parent node, the new node is inserted as the next sibling of the
original node. When the offset is equal to the length of this node, the new
node has no data."

CFMX's cut-down DOM implementation doesn't support the splitText method, so
you'll need to access the relevant Java or COM objects directly. See

http://www.devguru.com/Technologies/xmldom/quickref/text_splitText.html

and 

http://www.w3schools.com/dom/dom_text.asp

for the syntax.

Best wishes

Tom

> How does one go about choosing where in the XmlText of a node to place a new
> node?
> 
> For example:
> 
> <cfsavecontent variable="bob">
> <p>One <strong> two <i>three</i> four</strong> five</p>
> </cfsavecontent>
> <cfscript>
> x=XMLParse(bob);
> </cfscript>
> 
> So know I want to add another node (say, another <i>) in between the i and v
> of the five.
> 
> How would one do this?
> 
> Thanks,
> 
> Jason

-----------------+
tom dyson
t: +44 (0)1608 811870
m: +44 (0)7958 752657
http://torchbox.com


-----------------------+
cf-xml mailing list
http://torchbox.com/xml/list.cfm

Reply via email to