xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Peter Stibrany <pstibrany AT gmail.com>
- To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] Streaming Serializer
- Date: Wed, 14 Apr 2010 14:07:10 +0200
On 14. 4. 2010 8:45, Asgeir Frimannsson wrote:
On Wed, Apr 14, 2010 at 3:44 PM, Peter Stibrany<pstibrany AT gmail.com> wrote:
I had bigger problems with NodeFactory which has onlyYou get this with NodeFactory.makeAttribute(...).
startMakingElement(String name, String namespace) -- at this point,
attributes are not yet known, and finishMakingElement(Element element)
-- at this point, entire element content is built. My code needed to
react to attributes in root element, but at no point do you get element
with attributes only, without building entire element content.
You get only one attribute name/value, and no element information. My code simply needed to do something based on attributes in root element, before reading rest of the document. I'm not saying it's not possible to implement it, but it is not as straightforward as it could be.
My implementation look like this: I remember root element created in makeRootElement. I also have a flag called "rootAttributesReported". In startMakingElement and in finishMakingElement methods, if rootElement is set and rootAttributesReported is false, I pass root element to the code which checks its attributes. At this point, root element has attributes set. I hook into finishMakingElement method because my root element may be empty sometimes, thus startMakingElement would never be called ... it is called for elements inside root elements.
As I'm saying, it is possible to implement. I'm not even sure if method like "checkElementWithAttributes" would make sense in NodeFactory. But it sure would help me.
-Peter
-
[XOM-interest] Streaming Serializer,
Bruno Oliveira, 04/12/2010
- Re: [XOM-interest] Streaming Serializer, Kevin S. Clarke, 04/12/2010
-
Re: [XOM-interest] Streaming Serializer,
Elliotte Rusty Harold, 04/13/2010
-
Re: [XOM-interest] Streaming Serializer,
Ian Phillips, 04/13/2010
-
Re: [XOM-interest] Streaming Serializer,
Peter Stibrany, 04/14/2010
-
Re: [XOM-interest] Streaming Serializer,
Asgeir Frimannsson, 04/14/2010
- Re: [XOM-interest] Streaming Serializer, Peter Stibrany, 04/14/2010
-
Re: [XOM-interest] Streaming Serializer,
Asgeir Frimannsson, 04/14/2010
-
Re: [XOM-interest] Streaming Serializer,
Peter Stibrany, 04/14/2010
-
Re: [XOM-interest] Streaming Serializer,
Ian Phillips, 04/13/2010
Archive powered by MHonArc 2.6.24.