You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Robbie Baldock <ro...@realise.com> on 2000/09/04 13:37:13 UTC

How to build a Document with a DTD

Given a DTD, is there any way to create a new blank Document object with all
the nodes/elements in the DTD already present but set to ""?

I've seen something like this on the Sun site:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument(); 
Element element = (Element)document.createElement("root_element"); 
document.appendChild(element);

But that just creates a totally blank Document in which you have to create
nodes manually.


Robbie