[jdom-interest] help? inserting content into xml file

Robert Koberg rob at koberg.com
Sat Apr 28 15:32:22 PDT 2001


But how do I get  parent node that I can add a child to?

I have tried:

         Element root = doc.getRootElement();

         Element parentNode = xpath.applyTo(root);

         parentNode.addChild(new Element("page").addContent("test
test..."));

         XMLOutputter fmt = new XMLOutputter();
         fmt.output(doc, out);

Or what is the standard way it is done without XPath?
Should I not use JDOM for this task?



----- Original Message -----
From: <philip.nelson at omniresources.com>
To: <jdom-interest at jdom.org>
Sent: Saturday, April 28, 2001 3:00 PM
Subject: RE: [jdom-interest] help? inserting content into xml file


> > It seems like it is the wrong time to be asking questions
> > around here. Is
> > there a better list to ask questions about jdom?
>
> =8-)
>
> This is the place.  Gives us something to do that doesn't have the word
> detach in it.
>
> >
> > If this is that list then:
> > how do I get a reference to a parent node located anywhere in
> > the doc so I
> > can add a child to it? The only info I have about the parent
> > node is it's
> > unique id attribute value.
>
> There have been a number of ideas floating around.  The work in progress
> xpath support is at code.werken.com.
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
>




More information about the jdom-interest mailing list