xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
[XOM-interest] Using attributes from element before parsing content (via NodeFactory)
- From: "Peter Stibrany" <pstibrany AT gmail.com>
- To: xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: [XOM-interest] Using attributes from element before parsing content (via NodeFactory)
- Date: Sat, 17 Jan 2009 16:50:34 +0100
Hello,
I am using node factory to get information from XML Document while it
is still being parsed. I need to process attributes from element
before entire element content is read. E.g. if I have
<root>
<element attr1='value' attr2='value'>
... some really big content here ...
</element>
</root>
I want to process 'element' as soon as start tag was fully read (incl.
attributes), but before any content of 'element' is read.
What I currently do is that I set flag 'processAttributes' in
startMakingElement for 'element' (and store element too), and I check
this flag in subsequent calls to startMakingElement and
finishMakingElement (just in case my 'element' had no content). This
works because I know that my 'element' has only other elements as
children nodes. If I didn't know this, I would need to also do same
check in makeText, makeComment and other methods.
Is there better way than this?
Thank you,
-Peter Stibrany
- [XOM-interest] Using attributes from element before parsing content (via NodeFactory), Peter Stibrany, 01/17/2009
Archive powered by MHonArc 2.6.24.