Re: How to parse this plz tell me!!!



On Apr 29, 10:37 pm, anil_ec1 <401a...@xxxxxxxxx> wrote:
On Apr 30, 11:16 am, Aric Bills <aric.bi...@xxxxxxxxx> wrote:

What have you tried?

I tried with the option
"set node [$doc selectNodes {//name}]
set command [$node asText]"

Thanks for clarifying. (It's always a good idea to tell us what has
worked for you and what has not.)

But here the XML has more than one "name".So its not giving any value.
But I need a generic one like each time whenever I need a text in the
XML I don't want to write again this. So please tell me, is there any
procedure for this?

the [foreach] command iterates over a list:

foreach node [$doc selectNodes {//name}] {
# do something here...
}

You might use [lappend] to make a list of all the values of the string
in question.

There may be a way to do this job with XSLT instead of [foreach], but
I'm not familiar with XSLT so I couldn't help you there.

and one more "dom parse $cmdXML doc" will parse the cmdXML to plain
text or any list?

It will parse it into a DOM tree, which is a complex data structure
that is neither a list nor plain text.

and is there any process to make it as a list?

[$doc documentElement] asList

http://wiki.tcl.tk/8984 has some information about the format of the
resulting list.
.



Relevant Pages

  • Re: How to parse this plz tell me!!!
    ... set command " ... Thanks for clarifying. ... the [foreach] command iterates over a list: ... I'm not familiar with XSLT so I couldn't help you there. ...
    (comp.lang.tcl)
  • Re: How to parse this plz tell me!!!
    ... set command " ... Thanks for clarifying. ... the [foreach] command iterates over a list: ... I'm not familiar with XSLT so I couldn't help you there. ...
    (comp.lang.tcl)