Hi all,

My company currently has a live application running under Maverick. I need to add new functionality using a library that only works with jdom release v1.0. Maverick current uses an earlier version of jdom (beta 7?). With jdom v1.0, there have been API changes, which breaks Maverick. Thus, I'm stuck in 'jar hell'.

I've had a look at changing Maverick to use jdom 1.0, but as I've never used jdom myself, I am unsure what the changes should be and their implications. I've identified the three place in the Maverick code that need altered. #1 should be fine but I need help on #2 and #3. See below for what I've done so far, with some in-line comments. I gleaned most information from changes.txt in the jdom 1.0 distribution.

I would be very gratefully for some help with this.

Thanks
David Cuthill


#1 org.infohazard.maverick.util.XML.java ---------------------------------------- public class XML { ...

static
{
  // OLD CODE - This method now removed from v1.0 and replaced with
  // a Format.TextMode inner class
  //outputter.setTextNormalize(true);   

  // NEW CODE
  outputter.getFormat().setTextMode(Format.TextMode.NORMALIZE);
}


#2 org.infohazard.maverick.util.XML.java ---------------------------------------- public static Map getParams(Element node) { ...

if (value == null)
{
  /* OLD CODE: Checks for presence of children if no value present
   * getChildren() now removed from v1.0
  if (paramNode.hasChildren())
    value = paramNode.getChildren();
  else
    value = paramNode.getTextTrim();
  */

  /* NEW CODE: Since this method expects what the name/value pair
   * param nodes should look like (from this methods javadoc), is there
   * actually any need to check for child elements?
   */
  value = paramNode.getTextTrim();
}


#3 org.infohazard.maverick.Dispatcher.java ------------------------------------------ protected void reloadConfig() throws ConfigException { ...

public void go(MaverickContext mctx) throws IOException, ServletException
{
  // OLD CODE: Sets values for indent, newlines & encoding
  // v1.0 jdom added a Format class to control XMLOutputter behavior.
  // XMLOutputter outputter = new XMLOutputter("  ",  true, "UTF-8");

  // NEW CODE: Uses new jdom Format class
  // I can't see how to explicitly set newlines=true in Format.
  // Would Format.getRawFormat() or Format.getPrettyFormat()
  //  provide the expected output?
  XMLOutputter outputter = new XMLOutputter(
    Format.getCompactFormat().setIndent("  ").setEncoding("UTF-8"));



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
[INVALID FOOTER]

Reply via email to