Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Re: [xml-dev] Underwhelmed (WAS: [xml-dev] XOM micro tutorial)

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: xom-interest AT lists.ibiblio.org (Xom Interest)
  • Subject: [XOM-interest] Re: [xml-dev] Underwhelmed (WAS: [xml-dev] XOM micro tutorial)
  • Date: Wed, 25 Sep 2002 12:40:23 -0400

At 12:15 PM -0400 9/25/02, John Cowan wrote:


Hmm, you know now that you mention it, this isn't so trivial. The one
element you can't detach is the root element because that would make
its document malformed. If this is a common use-case, I'll need to
figure out how to support that.

I finally see how to do this:

Document main = new Builder().build("main.xml");
Document aux = new Builder().build("aux.xml");
Element holder = main.getChild(1).getChild(3).getChild(5); //
whatever
Element auxroot = aux.getRootElement();
aux.setRootElement(new Element("bogus"));
holder.appendChild(auxroot);


Yes, that should work. The main question is how to make the API pretty, even if that's what we're doing behind the scenes.
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+




Archive powered by MHonArc 2.6.24.

Top of Page