Hello
I need a quick help for a tricky problem that is literally driving me crazy.
String example = "<digitalObject>" +
"<title>title</title>" +
"<creator>Name</creator>" +
"<location>link</location>"+
"<relatedAsset>related realife object</relatedAsset>" +
"<note><src lang =\"en\">value</src></note>" +
"<archivalDate>date</archivalDate>"+
"<mimeFormat>mime type</mimeFormat>"+
"<digitalObjectOwner>owner</digitalObjectOwner>"+
"</digitalObject>";
String example4="<digitalObject>" +
"<title>title</title>"+
"<creator>name</creator>"+
"<location>link</location>"+
"<relatedAsset>related realife object</relatedAsset>" +
"<note><src lang=\"en\">value</src></note>" +
"<archivialDate>date</archivialDate>"+
"<mimeFormat>mime type</mimeFormat>" +
"<digitalObjectOwner>owner</digitalObjectOwner>" +
"</digitalObject>";
The following code to get a w3c.dom.Document object
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
Document doc=null;
try {
builder = factory.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(example4));
doc = builder.parse(is);
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
return doc;
}
The first string (example) is parsed correctly, the second one (example2) returns null.
Any idea why? I can't really see any difference between the 2!!
Thanks in advance I'm sure it's something so dumb I will feel ashamed...
EDIT: actually with the same content in the string, still 2 different outcome... I'll try to diff them...