Doesn't node.nodeValue solves your problem?

Fábio Miranda Costa
Solucione Sistemas
Engenheiro de interfaces
Twitter: fabiomiranda
http://solucione.info


On 20/07/2010, at 19:54, brook <[email protected]> wrote:

so i did a bunch (and a bunch) of experimenting but to no avail.
any ideas?

i had thought an easy solution would be just convert the node to a
string (here i want <node>value</node> to go to the string node_str
=  "<node>value</node>"   then just do something like

value_str = node_str.substring(node_str.indexOf(">"),
node_str.indexOf("<",node_str.indexOf(">"))

problem was i couldn´t figure out how to get node_str.   all my
attempts gave something like  "[object Element]".
is it possible to convert html or xml to a html-string, or xml-string
respectively.

i finally started started looking at the source code for slick,
thinking  maybe it could be done there, but i was a little bit lost.
could this sort of getNodeValue functionality be added directly to
slick?

thanks.b





On Jul 20, 5:02 pm, Fábio M. Costa <[email protected]> wrote:
Looks like XMLNodes on Firefox are instances of Element but not on webkit
(which is the correct behavior).
You should not use Mootools methods with XMLNodes, they're intended to be
used on HTMLNodes.
You can easily used the .nodeValue property instead of .get('text').
Try it out and tell us what happens.

--
Fábio Miranda Costa
Solucione Sistemas
Engenheiro de interfaces
Twitter: fabiomirandahttp://solucione.info

On Tue, Jul 20, 2010 at 3:58 PM, brook <[email protected]> wrote:
Hi guys.  I am trying to parse an XML file with SLICK.

What is the proper way to get node values?

So for a dumb xml file that looked like:

<xmlfile>
   <child>
        <value>1</value>
        <value1>a</value1>
    </child>
    ...
</xmlfile>

i tried

Slick.search(xml,"child > value").each(function(node){
       console.log(node,node.get("text"))
})

this gave me the correct node (<value>1</value>) but node.get ("text")
worked in firefox but not safari or chorme.

here is an example. note that node.get("text") only works in firefox.

http://stickandlogdesigns.com/mootools/testing/tester2.html#iamahash

Reply via email to