Hi Jim. This section sounds very interesting...
> So, I finished writing my classes by hand. Used dtdparser to grab all the > entities, and spit out class files for them. Are these Castor classes you're generating or dom4j classes? I've often wondered about code generating specific Element implementations for dom4j that are schema aware and so can store their attributes and child elements in a more efficient representation... > Also had it spit out XMLWriter > and XMLREader classes that marshal and unmarshal using dom4j. XML spit out > 118 distinct classes. I'm not sure I understand this bit. Are you going from Castor classes to dom4j here? James ----- Original Message ----- From: "Brain, Jim" <[EMAIL PROTECTED]> To: "'James Strachan'" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, November 19, 2001 7:54 PM Subject: RE: [dom4j-user] SAX vs DOM4J > Here's some more information, for the folks looking into object<->XML. > > I reran my Castor test, and James, you were right. The first invocation > takes 29seconds, but after that 200ms. > > Currently, castor seems to have a problem with: > > <Element1 tc="2"/> > <Element2 tc="1"/> > > If the tc attributed are separates lists of allowable numbers. Castor wants > all of them to be the same, as I see it. > > Tried JAXB, but the JXS mapping file I created chokes the jxc compiler. > > So, I finished writing my classes by hand. Used dtdparser to grab all the > entities, and spit out class files for them. Also had it spit out XMLWriter > and XMLREader classes that marshal and unmarshal using dom4j. XML spit out > 118 distinct classes. > > First unmarshal: 2.5 s for first load, 100-300 ms after. > First marshal: 600ms first time, 20-100 ms after. > > So, dom4j looks pretty good from a performance point of view. > > 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: James Strachan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, November 13, 2001 1:45 AM > To: Brain, Jim > Cc: [EMAIL PROTECTED] > Subject: Re: [dom4j-user] SAX vs DOM4J > > I agree with Dane, its sounding like just using your own custom objects and > SAX might be better. Maybe something like JAXB or Castor might help you do > the binding of XML -> your beans. > > You could consider using Jaxen (http://jaxen.org) and writing your own > custom Navigator to implement XPath on top of your custom beans. > > James > ----- Original Message ----- > From: "Brain, Jim" <[EMAIL PROTECTED]> > To: "'Dane Foster'" <[EMAIL PROTECTED]>; "Brain, Jim" > <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Monday, November 12, 2001 9:01 PM > Subject: RE: [dom4j-user] SAX vs DOM4J > > > > 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 > > > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > _______________________________________________ > 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 > _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user
