Gwt XMLParser Failed to parse error not well formed
I am using GWT and开发者_JAVA技巧 want to parse an xml file, but I get this 'Failed to parse error: not well formed'.
I am following the exact steps from: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsXML.html
I am using the same xml email message and has been saved to a local directory (c:/email_message.xml), so its well formed, and the message its giving me is incorrect.
Here is what I got so far:
try
{
String xmlString = "c://email_message.xml";
Document xmlDoc = XMLParser.parse(xmlString);
}
catch (DOMException e)
{
Window.alert(e.getCause());
}
Thanks in advance. Help.
XMLParser.parse
expects the xml as a string, not the file path to the xml. Load the file into a string and then pass that into parse
and you should be good to go.
精彩评论