removing the first line from your xml and then using

alert(qx.xml.Element.getSingleNodeText( doc,
"/MainMenu/MenuItem/MenuName" ))

works for me.

I ran this in the playground:


var result="";//<?xml version=\"1.0\" encoding=\"UTF-8\">\n";
result += "<MainMenu>\n";
result += " <MenuItem>\n";
result += " <MenuName>Status</MenuName>\n";
result += "  <MenuId>1</MenuId>\n";
result += "  <MenuTab>\n";
result += "    <MenuTabName>Nötzwörkstatus</MenuTabName>\n";
result += "  </MenuTab>\n";
result += "  <MenuTab>\n";
result += "    <MenuTabName>Hardware Status</MenuTabName>\n";
result += "  </MenuTab>\n";
result += " </MenuItem>\n";
result += "</MainMenu>\n";

var doc = qx.xml.Document.fromString( result );
alert( qx.xml.Document.isXmlDocument( doc ) ); // true


alert(qx.xml.Element.getSingleNodeText( doc, 
"/MainMenu/MenuItem/MenuName" ))


Looks like a bug to me?

HTH, Matt





sNIk wrote:
> sure ...
> 
> <?xml version="1.0" encoding="UTF-8">
> <MainMenu>
>       <MenuItem>
>               <MenuName>Status</MenuName>
>               <MenuId>1</MenuId>
>               <MenuTab>
>                       <MenuTabName>Nötzwörkstatus</MenuTabName>
>               </MenuTab>
>               <MenuTab>
>                       <MenuTabName>Hardware Status</MenuTabName>
>               </MenuTab>
>       </MenuItem>
> </MainMenu>
> 
> 
> 
> Noggin182 wrote:
>> Hi sNIK,
>> Been a while since I did any XML. Could you post your XML document please?
>>
>> The think that I suspect is the trailing forward slash but I could be
>> wrong.
>>
>> sNIk wrote:
>>> hello again. ;)
>>>
>>> i have the following scenario:
>>>
>>> * load an xml-file as string ( rpc )
>>> * convert string to document
>>> * access elements of that document
>>>
>>> i did this so far:
>>>
>>> var doc = qx.xml.Document.fromString( result );
>>> alert( qx.xml.Document.isXmlDocument( doc ) ); // true
>>>
>>> var xml
>>>
>>> xml = "XML-Test\n----------\n";
>>> xml += "* " + qx.xml.Element.getSingleNodeText( doc,
>>> "/MainMenu/MenuItem/MenuName/" ) + " \n";
>>> xml += "** " + " ... \n";
>>> xml += "** " + " ... \n";
>>>
>>> alert( xml );
>>>
>>> getSingleNodeText gives me a null. is my xpath-syntax wrong? and is "var
>>> doc
>>> = qx.xml.Document.fromString( result );" the right approach at all?
>>> "alert(
>>> result );" shows me the right content of my xml-file loaded from the
>>> server.
>>>
>>
>> ------------------------------------------------------------------------------
>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>> production scanning environment may not be a perfect world - but thanks to
>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
>> i700
>> Series Scanner you'll get full speed at 300 dpi even with all image 
>> processing features enabled. http://p.sf.net/sfu/kodak-com
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
> 


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to