no. but maybe i am doing something wrong?
the tester2.html link above now shows where it is failing.
node.nodeValue and node.get("nodeValue") dont work in any browser and
node.get("text") only works in firefox.
heres the javascript:
var req = new Request({
url: "xml/test.xml",
data:"string",
method: 'post',
onSuccess: function(text,xml) {
console.log("---",xml,Slick.search(xml,"child > value"))
Slick.search(xml,"child > value").each(function(node){
console.log(node,node.get("text"),node.nodeValue,node.get("nodeValue"))
})
}.bind(this),
onFailure: function(err) {
this.error = err
}.bind(this)
})
req.send()
i needed something today so i finally just we wrote the xml file as a
html file - replacing nodes with divs... it works fine but feels
sloppy. i´d love to figure this out.
thanks for all your help.
On Jul 20, 11:02 pm, "Fabio M. Costa" <[email protected]> wrote:
> Doesn't node.nodeValue solves your problem?
>
> Fábio Miranda Costa
> Solucione Sistemas
> Engenheiro de interfaces
> Twitter: fabiomirandahttp://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