[jdom-interest] Re: Bug patch for DOMBuilder ( JDOM )

Laurent ROMEO romeo at agisphere.com
Tue Mar 13 02:32:16 PST 2001


Brett McLaughlin a écrit :

Hi everybody,


Here is a comment I've made to Brett and Jason.
I think you should be interested by it too.

Best regards,


Laurent.



> For the sake of the other JDOM-ites, would you mind submitting this (email
> unchanged) to the jdom-interest list? That way we can get some community
> feedback immediately? I think you bring up some really good points...
>
> -Brett
>
> > -----Original Message-----
> > From: romeo at denveronline.net [mailto:romeo at denveronline.net]On Behalf Of
> > Laurent ROMEO
> > Sent: Thursday, March 08, 2001 3:25 AM
> > To: brett at newInstance.com; jhunter at servlets.com
> > Subject: Bug patch for DOMBuilder ( JDOM )
> >
> >
> > Hi Brett and Jason,
> >
> >
> > I've worked on JDOM, and I've discovered a bug with DOMBuilder class. I
> > was using it with the DOM obtained from JTidy with  HTML documents.
> >
> > The problem is that the JTidy DOM interface proves to be a level 1 one.
> > Your code need a DOM level 2 one, so the bug.
> >
> > In fact, there is not so much things to change to made it compliant.
> > I've written a patch that is joined with this mail. For building it,
> > I've just downloaded the last source from the JDOM cvs.
> >
> > I've also found a NullPointerException, so I think your code was not so
> > much finished. Anyway, I'll keep working on it.
> >
> >
> > Hope it helps.
> >
> > --
> > Laurent ROMEO
> > romeo at agisphere.com
> > AGISphere
> >
-------------- next part --------------
365a366,369
> 				// LR : For DOM-Level 1 compatibility
> 				if ( localName == null )
> 					localName = node.getNodeName();
> 				// ----------------------------------
411,413c415,426
<                         Namespace attns = Namespace.getNamespace(prefix, uri);
<                         Attribute attribute =
<                             new Attribute(localname, attvalue, attns);
---
> 						
> 						// LR: For DOM-Level 1 compatibility
> 						Attribute attribute;
> 						if ( prefix != null && uri != null )
> 							{
>                         		Namespace attns = Namespace.getNamespace(prefix, uri);
>                         		attribute = new Attribute(localname, attvalue, attns);
> 							}
> 						else
> 								attribute = new Attribute( attname, attvalue );
> 								
> 						// -----------------------------------------
428,430c441,447
<                 for (int i=0, size=children.getLength(); i<size; i++) {
<                     buildTree(children.item(i), doc, element, false);
<                 }
---
> 
> 				// LR : Bug ! Be careful to the null !!!
> 				if ( children != null )
>                 	for (int i=0, size=children.getLength(); i<size; i++) {
>                     	buildTree(children.item(i), doc, element, false);
>                 	}
> 				// --------------------------------------


More information about the jdom-interest mailing list