W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

HRE when adding to Doc created with DTD

From: James <jhughes@kos.net>
Date: Tue, 3 Apr 2001 20:42:11 -0400
To: www-dom@w3.org
Message-ID: <20010403204211.A994@kos.net>

I am writing an application that parses a file into a DOM tree and then 
dynamically modifies the tree, or creates the DOM from scratch if the file 
doesn't exist.

I create my Document object like this:

	ruledoc = new DocumentImpl();
and add children to the root element (ruleset) like this:

rule.getOwnerDocument().getFirstChild().appendChild(rule); // attach rule
							   //to ruleset

My problem is as follows:
If I turn on validation with setFeature and create the Document like this:
	// Set SYSTEM identifier
	ruledoc = new DocumentImpl(new DocumentTypeImpl((DocumentImpl)
			ruledoc,null,null,"file:\\" + dtdfile.toString()))); 
I can create a new document, serialize it to a file, and parse it back out 
again. However, when I attempt to add to ruledoc using the above call to 
appendChild(), I get a Hierarchy Request Error.

Writing out the name of the root element with 
gives the same result in both cases.
I'm using xerces-J 1.3.0.
I would really like to be able to use the validation feature of DOMParser,
so any help in this matter would be greatly appreciated.

James Hughes
Received on Tuesday, 3 April 2001 20:31:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC