   Java loading XML from a String instead of a file?
  Is it possible to load some xml from a string rather than from a file?eg "<test>aaab</test>"Heres what I've got so far:DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();DocumentBuilder db = dbf.newDocumentBuilder();Document d = db.parse("");thx   
  There is a thing called StringBufferInputStream that has worked for me, but it's deprected, so one should probaly not use it. I'm only using it in test code at the moment. There is probably a better way to do this...so I'll keep my eye on this thread.class XMLStringFactory{   private static final String XML_STRING = "<test>abc</test>   private static InputStream createXMLInputStream()   {  return new StringBufferInputStream(XML_STRING);   }};Quote:Original post by johnnyBravoIs it possible to load some xml from a string rather than from a file?eg "<test>aaab</test>"Heres what I've got so far:*** Source Snippet Removed ***thxThat doesn't quite work,the only parse method  that takes a string expects an URI, not xml data.What you really want to do is to use an InputSource object....String xmlData = "<somexml>stuff</somexml>";StringReader sr = new StringReader(xmlData);InputSource is = new InputSource(sr);Document d = db.parse(is);;  ah thx alot.   