Re: DocumentBuilder from byte/packet

2005-05-13 Thread Frank
No I think that will work just fine.
Thank you.
Frank
Mike Haller wrote:
Any drawbacks on using input streams?
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  {
 String xml = "";
 StringReader reader = new StringReader(xml);
 InputSource source = new InputSource(reader);
 Document doc = db.parse(source);
 System.out.println(doc.getChildNodes().item(0));
  }
  {
 byte[] xml = "".getBytes();
 InputStream inputstream = new ByteArrayInputStream(xml);
 Document doc = db.parse(inputstream);
 System.out.println(doc.getChildNodes().item(0));
  }
Frank schrieb:
Was tring to figure out the best way to take an XML document that I 
have read in from a datagram socket stored in a DatagramPacket(can 
convert to byte or String etc) to be able to parse it using 
DocumentBuilder using a DOM parse. All the methods seem to work off 
of a file or a steam.  any thoughts?

Thanks,
Frank






Re: DocumentBuilder from byte/packet

2005-05-13 Thread Mike Haller
Any drawbacks on using input streams?
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  {
 String xml = "";
 StringReader reader = new StringReader(xml);
 InputSource source = new InputSource(reader);
 Document doc = db.parse(source);
 System.out.println(doc.getChildNodes().item(0));
  }
  {
 byte[] xml = "".getBytes();
 InputStream inputstream = new ByteArrayInputStream(xml);
 Document doc = db.parse(inputstream);
 System.out.println(doc.getChildNodes().item(0));
  }
Frank schrieb:
Was tring to figure out the best way to take an XML document that I have 
read in from a datagram socket stored in a DatagramPacket(can convert to 
byte or String etc) to be able to parse it using DocumentBuilder using a 
DOM parse. All the methods seem to work off of a file or a steam.  any 
thoughts?

Thanks,
Frank




DocumentBuilder from byte/packet

2005-05-12 Thread Frank
Was tring to figure out the best way to take an XML document that I have 
read in from a datagram socket stored in a DatagramPacket(can convert to 
byte or String etc) to be able to parse it using DocumentBuilder using a 
DOM parse. All the methods seem to work off of a file or a steam.  any 
thoughts?

Thanks,
Frank