You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Diego Castillo <di...@inexbee.com> on 2001/11/06 17:02:55 UTC
Problem parsing XML strings with Xerces-J
Hi all,
I have recently started using Xerces-J for parsing XML strings. It works
fine when I have a file to parse, but I don't know how to parse a String.
Currently I write down my String into a file and feed the parser with that
file. I suppose that it is possible to directly feed the String, but I don't
know how. Can anybody help me?
Thanks in advance,
Diego Castillo
______________________________________________________
void parse(String xml) {
try {
File f = File.createTempFile("", ".xml");
FileOutputStream fout = new FileOutputStream(f);
fout.write(xml.getBytes());
fout.flush();
fout.close();
DOMParser parser = new DOMParser();
parser.reset();
parser.parse(f.getAbsolutePath());
Document doc = parser.getDocument();
} catch (Exception e) { }
}
______________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org