[jdom-interest] XMLOutputter error escaping this: element.addContent("");

Brett McLaughlin brett.mclaughlin at lutris.com
Tue Sep 5 07:52:49 PDT 2000


Just went into CVS... check it out and let me know if it works!

-Brett

Beau Bisquette wrote:
> 
> Dear Brett,
> 
> We have been experiencing difficulty outputting XML which has elements with
> empty content- not a new element with no content, but an element with ""
> content.
>         ie: element.addContent("");
> 
> so we propose this fix (or a more elegant rewrite...) starting at line 513
> of XMLOutputter,java
> 
> // Print the tag  with String on same line
> // Example: tag name="value">content/tag>
> // ** blows up if "" has been added as content to any element
> // ** so we must test for funkiness.
> // ** (david at posttool.com, will at posttool.com) String elementText =
> element.getText();
> if ( ( elementText != null ) && !( elementText.equals( "" ) ) ) {
>         out.write(">");
>         out.write(escapeElementEntities(elementText));
>         out.write("/");
>         out.write(element.getQualifiedName());
>         out.write(">");
> } else {
>         out.write(" />");
> }
> // end of test...
> 
> Thanks,
> David & Will
> 
> Beau Bisquette
> TPC Productions
> Oakland, California
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

-- 
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc. 
1200 Pacific Avenue, Suite 300 
Santa Cruz, CA 95060 USA 
http://www.lutris.com
http://www.enhydra.org



More information about the jdom-interest mailing list