xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Ikeda" <anthony.ik...@proxima-tech.com.au>
Subject Replacing nodes on a DTD XML file
Date Mon, 14 May 2001 22:57:19 GMT
I have not found anything that really helps answer this question in the
mailing list archives:

* I have an XML based config file with a DTD.
* I parse the document into my app, select a node out as an element, update
the element and want it to replace the old node.
* If I use removeChild() followed by appendChild(), it justs adds the node
at the end of the document and the parser seems to see this as valid but
according to the DTD it's not valid.
* I understand according to spec, "it is not allowed to alter neither the
document element nor the document type in any way" but this doesn't make it
very dynamic. Or do I make a whole new DocumentImpl to replace the old?

here is my code:
 public static void saveTheQuestion(Object obj){
    //load the config into a DocumentOmpl object
    org.w3c.dom.Document doc = parseDoc("config.xml");

    org.w3c.dom.Element questions = (Element)

    org.w3c.dom.Element questionElement = doc.createElement("Question");
//create a new element to add to config

 //modify Element...

    //add new element to original questions element

    //try and put the new set of questions onto the main config doc

      //Save the new config to disk.
    } catch(IOException ioe){

How can I correct this?

Anthony Ikeda
Web Application Developer,
Proxima Technology Pty. Ltd.

North Sydney
New South Wales,
Australia 2060
Office: (612) 9458 1718
Mobile: 041 624 5143

In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message