org.springframework.roo.support.util
Class XmlRoundTripUtils

java.lang.Object
  extended by org.springframework.roo.support.util.XmlRoundTripUtils

public abstract class XmlRoundTripUtils
extends Object

Utilities related to Dround tripping XML documents

Since:
1.1
Author:
Stefan Schmidt

Constructor Summary
XmlRoundTripUtils()
           
 
Method Summary
static String calculateUniqueKeyFor(Element element)
          Create a base 64 encoded SHA1 hash key for a given XML element.
static boolean compareDocuments(Document original, Document proposed)
          This method will compare the original document with the proposed document and return an adjusted document if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRoundTripUtils

public XmlRoundTripUtils()
Method Detail

calculateUniqueKeyFor

public static String calculateUniqueKeyFor(Element element)
Create a base 64 encoded SHA1 hash key for a given XML element. The key is based on the element name, the attribute names and their values. Child elements are ignored. Attributes named 'z' are not concluded since they contain the hash key itself.

Parameters:
element - The element to create the base 64 encoded hash key for
Returns:
the unique key

compareDocuments

public static boolean compareDocuments(Document original,
                                       Document proposed)
This method will compare the original document with the proposed document and return an adjusted document if necessary. Adjustments are only made if new elements or attributes are proposed. Changes to the order of attributes or elements in the original document will not result in an adjustment.

Parameters:
original - document as read from the file system
proposed - document as determined by the JspViewManager
Returns:
the new document if changes are necessary, null if no changes are necessary


Copyright © 2009-2010 VMware, Inc. All Rights Reserved.