Well, here is what my code is doing:

* I have to parse the entire document, so I know lazy parsing won't help.
* I am simply trying to get the document into a set of custom objects I
wrote (<app><book><chapter>... int App().Book().Chapter();)
* I like the Dom4J way at present, but all of my classes have this big chunk
of code in them:

    void parse(Element element) throws OLifEException {
        String name;
        Node node;
        
        for ( int i = 0, size = element.nodeCount(); i < size; i++ ) {
            node = element.node(i);
            if ( node instanceof Element ) {
                name=node.getName();
                System.out.println("-->" + name);
                if(name.equals("HoldingKey")) {
                    //setCreationDate(node.getText().trim());
                } else if(name.equals("AccountDesignation")) {
                    //setCreationTime(node.getText().trim());
                } else if(name.equals("HoldingTypeCode")) {
 
setHoldingTypeCode(OLifE.parseInt(((Element)node).attributeValue("tc").trim(
),"HoldingTypeCode not a number"));
.
.
.
Where the loop is the same, but the names differ.  I was trying to come up
with HashMap type interface, but each element requires something different
be done.  Some require there be 1 element, some are 0+, some are simple
sets, and some are objects that need to be created.

I thought about:

HashMap.add("AccountDesignation",new JimAction("set","AccountDesignation"));
or something to that effect.  Where JimAction is a container that can either
call a setter, call an Add with the element as the 

And then JimAction would be the item that handles the chore, but that seems
like a lot of JimActions for the code, and would tend to slow it down, I
think.

Jim


Jim Brain, [EMAIL PROTECTED]
"Researching tomorrow's decisions today."
(319) 369-2070 (work)
SYSTEMS ARCHITECT, INDIVIDUAL ITS, LIFE INVESTORS INSURANCE COMPANY OF
AMERICA

 -----Original Message-----
From:   Dane Foster [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, November 12, 2001 2:57 PM
To:     Brain, Jim
Cc:     [EMAIL PROTECTED]
Subject:        Re: [dom4j-user] SAX vs DOM4J

That totaly depends on what your code is doing.  Here is my personal rule of
thumb.  If I don't need random access to the XML or if memory use is
prohibitive use SAX, for everything else use dom4j.

Dane Foster
Equity Technology Group, Inc
http://www.equitytg.com.
954.360.9800
----- Original Message -----
From: "Brain, Jim" <[EMAIL PROTECTED]>
To: "DOM4J Mailing List (E-mail)" <[EMAIL PROTECTED]>
Sent: Monday, November 12, 2001 3:32 PM
Subject: [dom4j-user] SAX vs DOM4J


Has anyone done any benchmarking of SAX (Xerces or Aelfred) versus DOM4J?  I
know DOM is slower, but I like the ease of DOM4J.  Is rewriting my code (for
performance) into SAX going to save me all that much?

Jim


Jim Brain, [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
"Researching tomorrow's decisions today."
(319) 369-2070 (work)
Systems Architect, Individual ITS, Life Investors Insurance Company of
America


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to