Re: XML Parsing Issue with FireFox

2009-10-16 Thread Brian Blain

try

Document xmlDocument = XMLParser.parse(result);
XMLParser.removeWhitespace(xmlDocument);

It was a while ago that I ran across this but I remember having a
problem with the parser getting whitespaces as empty Node objects.

The document itself is also from the Node interface so to get your
first Node you need to try something like:

if(xmlDocument != null) {
  NodeList documentNodes = xmlDocument.getChildNodes();  // the
declaration is also a Node

  for(int i = 0; i  documentNodes.getLength(); i++) {
Node currentNode = documentNodes.item(i);

if(currentNode != null  currentNode.getNodeName
().equalsIgnoreCase(TestCase)) {
  return currentNode;
}
  }
}



Good Luck!


On Oct 15, 7:39 am, Parmeet Kohli parmeet.ko...@gmail.com wrote:
 Hi,

     Has anyone faced an issue with parsing XML in FF ??
     I hope i can explain the problem  accurately.
     My XML starts with

 ?xml version=1.0 encoding=ISO-8859-1?
    TestCase
         URLhttp://192.168.0.153:8080/axis2/services/Calculator?wsdl/
 URL
         TestStep ...

 Now in IE as well as the hosted mode,

     Document document = XMLParser.parse(xmlContent);
     Node encodingElem = document.getFirstChild();
     PopUp.showPopUp(ENCODING:,  encodingElem.getNodeValue()); //
 helper function .. just shows a pop up

 the above code shows a pop with string ?xml version=1.0
 encoding=ISO-8859-1?
 but in FF it prints null !!

 I'm doing a whole lot of parsing after this which works perfect in IE
 and hosted mode but FF just doesn't go any further !!

 Is this a GWT bug ?

 PS: document.toString() prints the entire XML perfectly even in FF.

 Appreciate any help

 Thank you,
 Parmeet
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: XML Parsing Issue with FireFox

2009-10-15 Thread Thomas Broyer



On 15 oct, 13:39, Parmeet Kohli parmeet.ko...@gmail.com wrote:
 Hi,

     Has anyone faced an issue with parsing XML in FF ??
     I hope i can explain the problem  accurately.
     My XML starts with

 ?xml version=1.0 encoding=ISO-8859-1?
    TestCase
         URLhttp://192.168.0.153:8080/axis2/services/Calculator?wsdl/
 URL
         TestStep ...

 Now in IE as well as the hosted mode,

     Document document = XMLParser.parse(xmlContent);
     Node encodingElem = document.getFirstChild();
     PopUp.showPopUp(ENCODING:,  encodingElem.getNodeValue()); //
 helper function .. just shows a pop up

 the above code shows a pop with string ?xml version=1.0
 encoding=ISO-8859-1?
 but in FF it prints null !!

 I'm doing a whole lot of parsing after this which works perfect in IE
 and hosted mode but FF just doesn't go any further !!

 Is this a GWT bug ?

No, I'd rather say an IE bug, as the XML declaration shouldn't ever
appear as a node in the DOM.

...and a bug in your code, as you shouldn't have an XML declaration
when passing a String to the parser (as I already said here a few days
ago, there's no need to declare an encoding in this case, as a String
is made of characters, not bytes).

 PS: document.toString() prints the entire XML perfectly even in FF.

How about using document.getDocumentElement() as the starting point
for your parsing?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---