Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Make DOMConverter methods public?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Make DOMConverter methods public?
  • Date: Fri, 18 Jul 2003 13:41:28 -0700

Elliotte Rusty Harold wrote:

> At 5:35 PM -0700 7/17/03, Wolfgang Hoschek wrote:
>
>
>> What's the reason the DOMConverter.convert(xyz) methods are private?
>> It would be handy for my app to be able to convert a DOM element into a XOM element, without going through the trouble of making new documents and passing them to the public methods that work on entire documents.
>
>
>
> You can't create a DOM element without creating DOM document, at least not within DOM. In DOM every element has a document object, and cannot be disassociated from that document.


Fine.

> I suppose it might be possible to change a single DOM element to a single XOM element, but the reverse is not possible, within the limits of DOM. (You could use implementation specific classes, but it's ugly and non-portable, and generally breaks every time the DOM vendor updates their implementation.) How are you getting elements without documents anyway?
>
> That said, if you've got a convincing use case, I could see exposing some of the DOM-->XOM methods directly,


All fine, but I'm only interested in a single DOM element from somewhere within a DOM document, and need to convert it to XOM (not the rest of it).

The use case involves running an XQuery against the new saxon-7.6.5 API. The query returns a list of saxon Items, normally these actually implement dom.Element or dom.Document or dom.Attr (it turns out after a lot of digging around saxon src), then I convert them to XOM elements, attr, etc. and go from there.

I tentatively made convert(Node) and convert(Element) public and added a public convert(Attr) and it works fine for me.


> though XOM-->DOM will have to remain private for these reasons.


Fine.

Cheers and congrats again to the neat XOM design.
Wolfgang.

--
-----------------------------------------------------------------------
Wolfgang Hoschek
Distributed Systems Department
Berkeley Laboratory
-----------------------------------------------------------------------






Archive powered by MHonArc 2.6.24.

Top of Page