f



Inserting Nodes between Nodes

Hi,

XML novice here with another question. I need to add a XML node like,

[code]
    <child01>
        <child02>
            <text></text>
            <image>image 1</image>
            <image>image 2</image>
        </child02>
    </child01>
[/code]

into this node between the ending </child01> and beginning  <child01>
of the


[code]
    <child01>
        <child02>
            <text></text>
            <image>image 1</image>
            <image>image 2</image>
        </child02>
    </child01>
    <child01>
        <child02>
            <text></text>
            <image>image 1</image>
            <image>image 2</image>
        </child02>
    </child01>
[/code]

Does this make sense? I guess im looking for a way to say/do... make a
new node with the following values and place it between these other
two nodes.

I still am learning XML but i think this can be done.
0
cesar5855 (4)
1/21/2008 8:34:53 AM
comp.text.xml 8781 articles. 0 followers. Post Follow

4 Replies
538 Views

Similar Articles

[PageSpeed] 30

On Jan 21, 12:34 am, cesarcesar <ce...@empiresolutions.net> wrote:
> Hi,
>
> XML novice here with another question. I need to add a XML node like,
>
> [code]
>     <child01>
>         <child02>
>             <text></text>
>             <image>image 1</image>
>             <image>image 2</image>
>         </child02>
>     </child01>
> [/code]
>
> into this node between the ending </child01> and beginning  <child01>
> of the
>
> [code]
>     <child01>
>         <child02>
>             <text></text>
>             <image>image 1</image>
>             <image>image 2</image>
>         </child02>
>     </child01>
>     <child01>
>         <child02>
>             <text></text>
>             <image>image 1</image>
>             <image>image 2</image>
>         </child02>
>     </child01>
> [/code]
>
> Does this make sense? I guess im looking for a way to say/do... make a
> new node with the following values and place it between these other
> two nodes.
>
> I still am learning XML but i think this can be done.

woops sorry, my 2nd XML is wrong. here is the correct.

[code]
<child01>
	<child02>
		<text></text>
		<image>image 1</image>
		<image>image 2</image>
	</child02>
	<child02>
		<text></text>
		<image>image 1</image>
		<image>image 2</image>
	</child02>
</child01>
<child01>
	<child02>
		<text></text>
		<image>image 1</image>
		<image>image 2</image>
	</child02>
	<child02>
		<text></text>
		<image>image 1</image>
		<image>image 2</image>
	</child02>
</child01>
[/code]
0
cesar5855 (4)
1/21/2008 9:04:56 AM
On Jan 21, 12:34 am, cesarcesar <ce...@empiresolutions.net> wrote:
> Hi,
>
> XML novice here with another question. I need to add a XML node like,
>
> [code]
>     <child01>
>         <child02>
>             <text></text>
>             <image>image 1</image>
>             <image>image 2</image>
>         </child02>
>     </child01>
> [/code]
>
> into this node between the ending </child01> and beginning  <child01>
> of the
>
> [code]
>     <child01>
>         <child02>
>             <text></text>
>             <image>image 1</image>
>             <image>image 2</image>
>         </child02>
>     </child01>
>     <child01>
>         <child02>
>             <text></text>
>             <image>image 1</image>
>             <image>image 2</image>
>         </child02>
>     </child01>
> [/code]
>
> Does this make sense? I guess im looking for a way to say/do... make a
> new node with the following values and place it between these other
> two nodes.
>
> I still am learning XML but i think this can be done.

one other thing... i want to do this in PHP if possible, but other
languages are ok.
0
cesar5855 (4)
1/21/2008 9:57:20 AM
cesarcesar wrote:

>     <child01>
>         <child02>
>             <text></text>
>             <image>image 1</image>
>             <image>image 2</image>
>         </child02>
>     </child01>
>     <child01>
>         <child02>
>             <text></text>
>             <image>image 1</image>
>             <image>image 2</image>
>         </child02>
>     </child01>

That snippet is not a well-formed document. As most APIs do only process 
well-formed documents it is not necessarily possible to process the 
above input and change it.
And you have not given us any indication of what programming language 
and what API you want to use.




-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
0
mahotrash (2052)
1/22/2008 12:29:33 PM
cesarcesar wrote:
> one other thing... i want to do this in PHP if possible, but other
> languages are ok.

I don't know PHP, but the standard APIs would be DOM or SAX. For a 
beginner, this task is easier using the DOM tree -- load the document, 
find the point where you want to insert the data, create the node tree 
you want to insert, insert it, write the DOM out as your new document. 
See any good DOM tutorial for details.

With SAX, it's a bit more complicated since you need to code up a state 
machine of some sort that recognizes when you've reached the appropriate 
point in the document and outputs the new content. Again, lots of 
tutorials exist showing the general outlines of this task.

I normally refer folks to http://www.ibm.com/xml for educational 
documents. Other article/tutorial repositiories also exist, or you can 
go looking for hardcopy books on programming with XML.

-- 
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
0
1/22/2008 5:36:49 PM
Reply:

Similar Artilces:

XML Node, HTML Node
hi guys, how can distinguish between XML Node and HTML Node, using attributes or method .. thanks . alhalayqa wrote: > how can distinguish between XML Node and HTML Node, using attributes or > method .. In the XML DOM nodes do not have an id property or a className property while in the HTML DOM nodes do have those properties. On the other hand there are specializations of the XML DOM like the SVG DOM where id or className are properties too. Thus if you parse XML with namespaces with browsers like Mozilla or Opera the parser recognizes namespaces like the XHTML 1 namespace o...

Why treat text nodes as nodes?
One of the things I find most unnatural about most XML APIs is that they try to abstract both elements and text into some kind of "node" object when they have virtually nothing in common. The reason these APIs do it is to make it possible for both text and elements to be children of elements. But there is another way. The XPath/XQuery data model does not allow two consecutive text nodes. As far as I can tell, most XML processing software automatically merges consecutive text nodes. This means that the number of text segments directly under an element is bound by the number of sub-elements plus 1 (PIs and comments may be treated as "pseudo-elements" for this purpose). As a result, it is always possible to associate each text segment with the element immediately preceding it within the parent and associate the first text element with the parent itself. No more text nodes. The only API I know that uses this trick is the ElementTree API for Python by Fredrik Lundh (http://effbot.org/zone/element-index.htm). Each Element object has a text and tail property for the text immediately inside the element and text following it within its parent element. Elements always have a tag, attributes and and zero or more children - which are always other elements. No mixed types. The text and tail attributes are always strings. This model should be very convenient for statically-typed languages like Java or C++. I find it ironic that this idea is probably used only in Pyt...

xsl variable $node/text() but $node can non-node-set help!
I have a variable $value as a parameter in the following template: <xsl:template name="myTemplate"> <xsl:param name="value"/> <xsl:if test="$value"> <xsl:value-of select="$value"/> </xsl:if> </xsl:template> Now i call myTemplate sometimes whit the a parameter $value that is sometimes a text node, and sometimes it is not even a node. Example: <inputDoc> <a>hello</a> <a/> </inputDoc> xsl: <xsl:for-each select="/inputDoc/a"> <xsl:call-template name="myTemplate"> <xsl:with-param name="value" select="./text()"/> </xsl:call-template> </xsl:for-each> So i call myTemplate with parameter $value=a/text() But for the second <a> element in <inputDoc> there is not text() node. This gives me the following error: Cause: javax.xml.transform.TransformerException: The value is not a node-set With line number of the error pointing to the xsl:if in myTemplate. No i tried the function nilled(), but that is XPath 2.0, i only use XPath 1.0 and XSL 1.0 i know a possible solution is this: <xsl:for-each select="/inputDoc/a"> <xsl:choose> <xsl:when test=".[not(node())]"> <xsl:call-template name="myTemplate"> <xsl:with-param name="value" select="false()"/> </xsl:call-template> <...

Text nodes and element nodes query
Hi all, The code below gets me a list of all the nodes within the node object called xml_tags_root. NodeList nl = xml_tags_root.getChildNodes(); The length of nodelist I get is double the number of actual elements! This is because after every element node there is text node which is (I think) the whitespace in the XML document. Is there a way to get only the element nodes? Please advice. thanks, ASD Hi, Look at getElementsByTagName(....) Regards, Arnaud "asd" <arvindsd@yahoo.com> a �crit dans le message news: 1116833345.887839.95270@g47g2000cwa.googlegroups.com... &...

XML DOM: XML/XHTML inside a text node
In my program, I get input from the user and insert it into an XHTML document. Sometimes, this input will contain XHTML, but since I'm inserting it as a text node, xml.dom.minidom escapes the angle brackets ('<' becomes '&lt;', '>' becomes '&gt;'). I want to be able to override this behavior cleanly. I know I could pipe the input through a SAX parser and create nodes to insert into the tree, but that seems kind of messy. Is there a better way? Thanks. On Thu, 2 Nov 2005 noahlt@gmail.com wrote: > In my program, I get input from the us...

XSLT Select nodes without text-node children whose names starts with specifix text
Question on XSL expression Got this XML: <Body> <Page> <Line no="9" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="10" detail="true"> <onefield>onefieldstext</onefield> <fgman9>fgmanfieldstext</fgman9> <twofield>twofieldstext</twofield> </Line> <Line no="11" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="12" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> <Line no="13" detail="true"> <onefield>onefieldstext</onefield> <fgman5>fgmanfieldstext</fgman5> <twofield>twofieldstext</twofield> </Line> <Line no="14" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line> </Page> </Body> I would select the <Line/> nodes without text-node children whose names is starting with "fgman" - in this example it is all <Line/> _except_ <fgman9/> and <fgman5/> in <Line/> with @no of 10 and 13. I know that this works: &...

Get XML values from nodes and child nodes
Hi everybody. My XML file is: <Locatore> <NumeroProgressivo>001</NumeroProgressivo> <CodiceFiscale>CSTNDA69P90H523R</CodiceFiscale> <PersoneFisiche> <Cognome>CAST</Cognome> <Nome>NADIR</Nome> <Sesso>F</Sesso> <DataNascita>10091979</DataNascita> <ComuneNascita>RONCA</ComuneNascita> <ProvinciaNascita>BL</ProvinciaNascita> </PersoneFisiche> </Locatore> <Locatore> <NumeroProgressivo>002</NumeroProgressivo> <CodiceFiscale>PRSGRI74L29F443L</CodiceFiscale> <PersoneFisiche> <Cognome>PERISSI</Cognome> <Nome>IGOR</Nome> <Sesso>M</Sesso> <DataNascita>29071970</DataNascita> <ComuneNascita>MONTE</ComuneNascita> <ProvinciaNascita>SA</ProvinciaNascita> </PersoneFisiche> </Locatore> I need to get in ONE RECORD, both node value and his child nodes values, like this 001 | CSTNDA69P90H523R | CAST | NADIR | F | 10091979 | RONCA | BL 002 | PRSGRI74L29F443L | PERISSI | IGOR | M | 29071970 | MONTE | SA ..... With this: SELECT X.valore.query('NumeroProgressivo').value('.', 'VARCHAR(20)') as NumeroProgressivo, X.valore.query('CodiceFiscale').value('.', 'VARCHAR(16)') as CodiceFiscale FROM Tbulk CROSS APPLY Tbulk.nodes('Fornitura/Documento/S...

How to find non-existing nodes or nodes with no text
Ok, this must be simple but the more i search the more i don't find. It's about SimpleXML and PHP. How to find non-existing nodes or nodes with no text My XML file looks a little bit like this: i.e. 1 <discography> <CD> <title></title> <year>1978</year> </CD> </discography> i.e. 2: <discography> <CD> <year>1978</year> </CD> </discography> In i.e. 1, the tag <title> is empty. How do i test for empty tags in PHP? In i.e. 2, the tag <title> doesn't even exist. How do i ...

select nodes with child node A and child node B
I have an XML document that has multiple childe nodes like the one at the end of this message What syntax would I use with selectNodes to select all viewentry nodes that have an entrydata child node with a name attribute equal to "CourseOrMeetingName" that has a text childe node with the text Course ABC AND that also have an entrydata child with a name attribute equal to Start Date that has a datetime child node with the text 20070110 I was trying something like //viewentry[ (entrydata[@name='CourseOrMeetingName'][text='Course ABC']) and (entrydata[@name='StartDate'][datetime='20070110'])]" <viewentry position="1" unid="E5FE575692CAB4CD852572140052F751" noteid="893A" siblings="24"> <entrydata columnnumber="0" name="CourseOrMeetingName"> <text>Course ABC</text></entrydata> <entrydata columnnumber="1" name="StartDate"> <datetime>20070110</datetime></entrydata> <entrydata columnnumber="2" name="City"> <text>West chester</text></entrydata> <entrydata columnnumber="3" name="FirstName"> <text>Joe</text></entrydata> <entrydata columnnumber="4" name="MiddleName"> <text></text></entrydata> <entrydata columnnumber="5" name="LastName"> <text>...

Getting all nodes and node details from xml using xquery
Hi, I haev the following code: DECLARE @x xml SET @x=' <Root> <row id="1"><name>Larry</name><oflw>some text</oflw></row> <row id="2"><name>Joe</name></row> <row id="3" /> </Root> ' exec sp_xml_preparedocument @idoc OUTPUT, @x SELECT * FROM OPENXML(@idoc, '/Root') This gives the following details id parentid nodetype localname prefix namespaceuri datatype pr...

selecting nodes between other nodes
Hi! <root> <foo>bar</foor> <blah /> <blah2 /> <a> <b /> <c /> </> </root> I want to select everything between <foo> and <a>. Is this possible? Timo In article <2jbjjhFvf4ttU1@uni-berlin.de>, Timo Nentwig <tcn@spamgourmet.org> wrote: % <root> % <foo>bar</foor> % <blah /> % <blah2 /> % <a> % <b /> % <c /> % </> % </root> % I want to select everything between <foo> and <a>. Is this possible? How about <xsl:stylesheet xmlns:xsl = 'http://www.w3.org/1999/XSL/Transform' version = '1.0'> <xsl:template match='*[preceding-sibling::foo and following-sibling::a]'> <xsl:copy-of select = '.'/> </xsl:template> <xsl:template match='text()'/> </xsl:stylesheet> ? -- Patrick TJ McPhee East York Canada ptjm@interlog.com ...

extracting text from an XML node
Hi, suppose i get the simple xml sample: <foo> 1 <bar>2</bar> 3 </foo> Now suppose i want to extract all the text of only the 'foo' node, ie expected result is '1 3'. I tried both <xsl:template match="foo"> <xsl:value-of select="text()" /> </xsl:template> and <xsl:template match="foo"> <xsl:value-of select="." /> </xsl:template> but the former lead to '1' and the latter to '1 2 3' (using xsltproc & firefox). What did i missed ? thanks, -Nicolas nicolas.edel@gmail.com wrote: > Now suppose i want to extract all the text of only the 'foo' node That isn't a built-in concept; you have to recast it as "all the text nodes which are immediate children of the 'foo' node". (The built-in text value of an element, as you discovered, is the value of all text contained in it, directly or indirectly). Note too that the whitespace (line breaks and indentation) will be part of the the text nodes unless you explicitly strip that away. <xsl:value-of select="text()" /> didn't work because value-of returns the contents of only the first matching node. This is one case where xsl:for-each is appropriate, to explicitly iterate through the text children. -- Joe Kesselman / Beware the fury of a patient man. -- John Dryden On Nov 30, 12:34 am, Joseph Kesselman <kesh...

xslt help needed with element nodes embedded in text node
I'm but an amateur with xsl stylesheets. I need some help to the output of text nodes with embedded element nodes like the following: <uf><ns>This</ns> example</uf> <uf>Another <ns>This</ns> example</uf> <uf>Another <ns>This</ns></uf> I need to output the ns strings in italics. <xsl:apply-templates select="./uf" /> <xsl:template match="ns"> <i><xsl:value-of select="." /></i> </xsl:template> As long as the xml file is exported in lines as above the output is ok: "This example". (In this email I don't indicate the italicised part string.) But lately the document server hosting the application that contains xml files of the sort above changed the export of xml files. Now there are line breaks at each new element boundary: <uf> <ns>This</> example </uf> With my xsl code I get an additional space at the beginning and the end of the phrase: " This example ". I tried to get rid of them with <xsl:template match="text()"> <xsl:value-of select="normalize-space()" /> </xsl:template> But this results in "Thisexample". What is to be done? (There is no option to substitute the mandatory spaces with &#160;). Volker I tried <xsl:strip-space elements="uf" />. It doesn't help either. Volker Volker Le...

problem with child text node when constraining other child node types
I'm struggling with whether or not it is possible to represent the following construct in a dtd. I have an element X that I want to contain 3 types of child elements. Child Element A should have a 0 or 1 constraint, Child element B should have a 0-n constraint. I also want X to be able to contain text, resulting in xml that the following <X> <A/> <B/> <B/> child text of element X also possible </X?> I've got the following, but can't seem to figure out a way to also allow for a text child node. Any help appreciated <!ELEMENT X (A?, B*)> Bryan Bryan Ax wrote: > I've got the following, but can't seem to figure out a way to also > allow for a text child node. Any help appreciated Declare X as having mixed content. http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-mixed-content Looking at this, I don't see a way to constrain it so that A only can appear once, whereas B can appear multiple times...I think I'm missing something. Upon further reading, there doesn't appear to be a way to do this. Either I go to mixed-content, which is less constraining, or I need to add a child node to hold the text element. http://www.devguy.com/fp/XML/dtd.htm Bryan Ax wrote: > I have an element X that I want to contain 3 types of child elements. > Child Element A should have a 0 or 1 constraint, Child element B should > have a 0-n constraint. I also want X to be able to contain text, All you can do ...

node-node adjacency matrix to a node-arc adjacency matrix
I have been trying to figure out how to create a arc-node adjacency matrix from a node-node adjacency matrix, for example: node-node adj A = [0 1 0 1 1; 0 0 1 1 0; 0 0 0 1 1; 0 0 0 0 1; 0 0 0 0 0]; looking for the following links: 1-2,1-4,1-5,2-3,2-4,3-4,3-5,4-5 arc-node adj B =[ 1 1 1 0 0 0 0 0 -1 0 0 1 1 0 0 0 0 0 0 -1 0 1 1 0 0 -1 0 0 -1 -1 0 1 0 0 -1 0 0 0 -1 -1]; Any help will be greatly appreciated: I have tried to develop a for loop using "A" and assigning -1 to the tail end of the link but with no succes...

inserting and deleting valid xml nodes
Hello, I program an xml editor with xerces for the university of Braunschweig, the user dont see any xml tags, it is represented in a JTree. Now the user shall be able to insert nodes, which conforms to the schema file (the user need not know what that is, its transparent to him). I found two approaches for doing that: 1. When xerces validates the source or the DOM tree (this is a new xerces feature and is faster since the tree structure is already there, by normalizeDocument()), it builds up for each node a vector holding all possible allowed schema types, and then just looks if that node's type is in that vector. I could store that vector for my own purposes and let the user choose, what node he wants to insert, according to the vector. There are some difficulties in that: First, its hard to get that vector, there are not-public methods building it up and using it, its very hard. Second, DOMNormalizer only accepts the document root as input, and not a child node, but I dont want to run the DOMNormalizer after each little modification on the whole file, this would take to much time at a large file and a quick user. Surely with some "hacking" (that means, with modification of xerces source files) I could do it on child nodes somehow, but this is even more complicated. Moreover, if I insert a node, I would have to check if the following sibling nodes are allowed at there new by-one-shifted positions. This is needed especially at the deletion of a node in backwar...

editor for editing xml text nodes
We have xml documents which contain text imbedded as text content in some xml structures. These documents need to be translated by human translators from English into, for example, Chinese. We would like the translator to use an editor which shows him only the text content of the xml document, or gives him only editing access to the text content. The translator should be unable to touch or modify the xml tags, so that it is guaranteed that the xml-tags are unchanged when the translator returns the translated document. The translator simply replaces all English text accessible to him into Chinese text. Does anyone know an xml editing tool which has this feature, of allowing only modification to the text node content? Alois Zreindl wrote: > We have xml documents which contain text imbedded as text content in > some xml structures. > > These documents need to be translated by human translators from English > into, for example, Chinese. > > We would like the translator to use an editor which shows him only the > text content of the xml document, or gives him only editing access to > the text content. I am working on exactly this right now. It leaves the elements in element content inviolable, but allows element markup in mixed content (the only thing a translator should be touching). Please contact me by email to discuss this further. > The translator should be unable to touch or modify the xml tags, so that > it is guara...

"node.InsertAfter" method only inserts node on final call
hiya, I succesfully return a "nodeList" thru the "xmlDoc.SelectNodes" method. This nodeList is taken from a repetitive, uniform xml doc. I can successfully append a child node at the correct position using the following code: <code> <!--Node inserted into corrrect position in nodeList(0)--> nodeList(0).InsertAfter(additionalNode, nodeList(0).ChildNodes(5)) </code> however, as soon as I try to do the same with nodeList(1), then apparently the SAME code that previously inserted the node into nodeList(0) doesn't do its job. <code> <!--Node NOT inserted into nodeList(0)--> nodeList(0).InsertAfter(additionalNode, nodeList(0).ChildNodes(5)) <!--Node inserted into corrrect position in nodeList(1)--> nodeList(1).InsertAfter(additionalNode, nodeList(1).ChildNodes(5)) </code> Surely, If i am using the "InsertAfter" method, then the node should have been inserted BOTH times? As a test, I swapped my code round, and I can confirm that the node is ONLY inserted on the 2nd call. <code> <!--Node NOT inserted into nodeList(1)--> nodeList(1).InsertAfter(additionalNode, nodeList(1).ChildNodes(5)) <!--Node inserted into corrrect position in nodeList(0)--> nodeList(0).InsertAfter(additionalNode, nodeList(0).ChildNodes(5)) </code> Can someone comment?I have been spent a bit of time on this, and am no further forward. Even if i could get hold of some sample code in vb / c# that did ...

converting a document node and children into xml text
is there a way in javascript to convert a DOM node (and it's children) into an XML text. i'd like to save the text file somewhere and then later parse it to re-create the tree. thx. jman, google grouper, wrote: > is there a way in javascript to convert a DOM node (and it's children) > into an XML text. Yes. Traverse the DOM node subtree and output XML accordingly. > i'd like to save the text file somewhere and then later parse it > to re-create the tree. Why? jman wrote: > is there a way in javascript to convert a DOM node (and it's children) > ...

Firefox inserts text nodes in TR elements?
Why does Firefox insert #text nodes as children of TR elements? As a work-around for older Safari versions not properly supporting a table row's cells collection, I used the row's childNodes collection as it was pretty much exactly the same thing. However, in Firefox 1.0.7 text nodes are inserted between the TDs. I'm certain that this didn't use to happen with older versions. The HTML specification states that the only element that can be the child of a TR is a TD, so why does Firefox put text nodes in there? If this how the DOM is supposed to be built, can someone g...

Help needed with XML Node insert API
Hi All I have to add elements to an existing XML Document which conforms to a DTD. Is there an some API which throws an exception when I append a node to this document if it is not a valid location or element based on the DTD. My DTD is very specific on sequence of elements. Since I have to insert many elements it is not an option for me to insert all elements and at the end run validate on the document. Thanks kumar Kumar wrote: > I have to add elements to an existing XML Document which conforms to a > DTD. > > Is there an some API which throws an exception when I append...

ORA-31167: XML nodes over 64K in size cannot be inserted
Hi I have a table with a XmlType-column with CLOB storage. I can insert and read xml-data containing base64 encoded JPEGs with OCILob functions. The image data contains > 64K. The problem: a query like 'select extract(xmldata, '/img/@name') ...' executed in sqlplus or SqlDeveloper gives the error ORA-31167: XML nodes over 64K in size cannot be inserted Cause: An attempt was made to insert an XML Text Node with a size greater than 64K. This is not supported. Action: Create text nodes under 64K. But the data is already in the db. I only want to read some piece ( ~20 b...

Adding and updating new tDOM XML text nodes
Hi guys, Some code: package require tdom # Read in data in the xml variable. set dom [dom parse -keepEmpties \ "<BASE>\n<al>\n<Cats>9 lives</Cats>\n<Canaries/>\n</al>\n</BASE>"] set doc [$dom documentElement] # Add a missing node. set node [$doc selectNodes /BASE/al] $node appendXML "<Dogs></Dogs>" # Update an existing node. set node [$doc selectNodes /BASE/al/Cats/text()] $node nodeValue "Great swingers" # Output doc to show Dogs got added and Cats changed. puts [$doc asXML] # Try to update the node with some data. set node [$doc selectNodes /BASE/al/Dogs/text()] $node nodeValue "Go Woof" Output: <BASE> <al> <Cats>Great swingers</Cats> <Canaries/> <Dogs/> </al> </BASE> invalid command name "" while executing "$node nodeValue "Go Woof"" (file "t" line 15) Platform: ActiveTCL 8.4.13.0.261555. Strangeness: I can add the new node to the XML (and it's even reformatted) for it to be called in when doing the $doc asXML, but, I can't update a newly added node. Anyone have any suggestions? In article <slrneh8g2p.irn.flavp+hfrarg@sparrow.autons.net.au>, Synic <flavp+hfrarg@nhgbaf.arg.nh> wrote: >Some code: > > package require tdom > # Read in data in the xml variable....

Looking A Nodes From Within Nodes
I've written a template that does some work on a subtree, but I want to replace the subtree that I originally worked on. How would I do this? Confused, Okay, here's an example: <node> <node> <node> </node> <node> </node> </node> <node> ** <node> </node> <node> </node> </node> ** </node> This is a binary tree full of "node" tags. Let's let I was working on the subtree starting at the node tag I've indicated by the **s. Let's say I've done my work on the subtree and I want to replace the subtree in this master tree with the one I've just changed. I also want to change the top level node tag (for example, updating the attribute tag). I can't do something like <xsl:element> <xsl:attribute counter="/node/@counter+1"/> <xsl:copy-of select="/node/*[position()=1]"/> <xsl:copy-of select="$outputofsubtreework"/> </xsl:element> Because, while it will work in this case, I don't know in advance how many levels the tree will have. Can anyone help me out here? :) Johnny *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Ack! Sorry, I phrased the problem incorrectly. When I said "top level node tag", I meant to indicate the parent of the root of the subtree. So, in t...

Web resources about - Inserting Nodes between Nodes - comp.text.xml

Inserting Kate
jurvetson posted a photo: the speaking GPS avatar that we came to love.. more prep photos below... You can hear her voice in the video compilation ...

Inserting the Galaxy Note 5’s S Pen backwards can permanently damage the device
One of the features Samsung highlighted when it unveiled the Galaxy Note 5 was the device's new S Pen slot design. The Note 5 features a spring-loaded ...

How the Shift from Swiping to Inserting Cards Will Accelerate Mobile Payments
... this shift is to protect consumers and merchants from fraud. What the industry refers to as "dipping" and consumers and cashiers call "inserting" ...


Inserting Slavery Into The Climate Debate
Chris Hayes compares the fight against fossil fuels to the abolitionist movement. He states plainly that “there is absolutely no conceivable ...

Samsung smart TVs inserting ads into third-party apps
... playback have pissed off a number of consumers. People with smart TVs from Samsung have been complaining that the electronics maker is inserting ...

Samsung: Inserting the S Pen backwards will not break new Galaxy Note 5 units
... according to the company. "Samsung can confirm that the Note 5 internal S Pen mechanism has been changed to avoid the issue caused by inserting ...

Gawker tells Steven Crowder to "stop whining, take your licks, and accept that getting hit in the face ...
"... in the middle of an argument between billionaire-funded know-nothing ideologues and people whose livelihoods and stability are being threatened ...

Gmail's New Interface for Inserting Photos
Gmail has a new interface for adding images to a message. When you click the "insert images" icon, Gmail now shows all the photos highlighted ...

Now Samsung SmartTVs are interrupting users' videos by inserting random ads
... room. Now Samsung is dealing with a new headache: Gigaom reports that Samsung SmartTVs are interrupting users' own video content by inserting ...

Resources last updated: 3/13/2016 9:46:12 PM