- From: Mark Torr <Mark.Torr@eur.sas.com>
- Date: Wed, 31 May 2000 10:05:35 +0200
- To: "'Heather Lindsay'" <heather.lindsay@Trifolium.com>, "'www-dom@w3.org'" <www-dom@w3.org>
It is possible... here is an example. Note I have not yet worked out how to get the finalised document to serialise itself! import javax.xml.parsers.*; import org.w3c.dom.*; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance (); DocumentBuilder db = dbf.newDocumentBuilder (); Document doc = db.newDocument (); Element root = doc.createElement ("mytest"); doc.appendChild (root); root.appendChild (doc.createElement ("header")); root.appendChild (doc.createTextNode ("\n some data is text\n ")); root.appendChild (doc.createElement ("footer")); } catch (Exception e) {} -----Original Message----- From: Heather Lindsay [mailto:heather.lindsay@Trifolium.com] Sent: Tuesday, May 30, 2000 20:47 To: 'www-dom@w3.org' Subject: creating XML document from scratch hi, I want to create a DOM document without originally having an XML document. So, instead of parsing an XML document and getting the DOM document, I want to just create an empty DOM document and then fill in whatever elements, etc. that I need. After extensive searching through Java docs (Xerces implementation), it seems that creating a document from scratch is not possible using the DOM. Is this true or am I misunderstanding the documentation? I'm sorry if this question has already been answered in FAQ or the archives but I could not find anything in either source and I just joined this list. Any help or clarification would be greatly appreciated. Thanks a million in advance, Heather
Received on Wednesday, 31 May 2000 04:05:44 UTC