gov.nih.nci.mageom.util
Class XMLUtility

java.lang.Object
  extended by gov.nih.nci.mageom.util.XMLUtility

public class XMLUtility
extends java.lang.Object

XMLUtility Utilities for working with XMLInterface objects. Can produce String representations of XML based on element hierarchies.

Version:
1.00
Author:
Ajay Gupta, J. Lee Dixon (Celebration, FL), Paul DeJong (Celebration, FL), MMHCC Team

Constructor Summary
XMLUtility()
           
 
Method Summary
 org.w3c.dom.Element buildXMLMethods(org.w3c.dom.Element element, java.util.Hashtable associationMethods, java.util.ArrayList fillOutValues, java.lang.Object theObject, org.w3c.dom.Document doc)
          buildXMLMethods()
 org.w3c.dom.Element createAssociationElement(gov.nih.nci.common.util.XMLMethodDescriptor xmlMethDesc, java.lang.Object id, org.w3c.dom.Document doc)
           
static org.w3c.dom.Element CreateURL(java.lang.String objectName, java.util.Hashtable criteria, org.w3c.dom.Document doc)
           
static org.w3c.dom.Element CreateURL(java.lang.String objectName, java.lang.String tagName, java.util.Hashtable criteria, org.w3c.dom.Document doc)
           
static java.lang.String elem2String(org.w3c.dom.Node elem)
          elem2String()
static void main(java.lang.String[] args)
           
static java.lang.String makeHeavyXMLStringDoc(gov.nih.nci.common.util.XMLInterface[] objects)
          makeHeavyXMLStringDoc()
static java.lang.String makeXMLStringDoc(gov.nih.nci.common.search.SearchResult searchResult, java.util.ArrayList fillInObjects, boolean heavy)
          makeXMLStringDoc()
static java.lang.String makeXMLStringDoc(gov.nih.nci.common.search.SearchResult searchResult, boolean heavy)
          makeXMLStringDoc()
static java.lang.String makeXMLStringDoc(gov.nih.nci.common.util.XMLInterface[] objects)
          makeXMLStringDoc()
static java.lang.String makeXMLStringDoc(gov.nih.nci.common.util.XMLInterface[] objects, java.util.ArrayList fillInObjects)
          makeSelectedXMLStringDoc()
static java.lang.String makeXMLStringTreeDoc(gov.nih.nci.common.util.XMLInterface[] objects, gov.nih.nci.common.util.XMLInterface[] children)
          makeXMLStringTreeDoc()
static java.lang.String makeXMLStringTreeDoc(gov.nih.nci.common.util.XMLInterface[] objects, gov.nih.nci.common.util.XMLInterface[][] children)
          makeXMLStringTreeDoc()
static void setXlinkNameSpace(org.w3c.dom.Element element)
           
static void toHeavyXML(gov.nih.nci.common.util.XMLInterface[] myObject, org.w3c.dom.Node parent, org.w3c.dom.Document doc)
           
static void toSelectedXML(gov.nih.nci.common.util.XMLInterface[] myObject, java.util.ArrayList fillInNodes, org.w3c.dom.Node parent, org.w3c.dom.Document doc)
           
static void toXML(gov.nih.nci.common.util.XMLInterface[] myObject, org.w3c.dom.Node parent, org.w3c.dom.Document doc)
           
static void xmlStart(gov.nih.nci.common.util.XMLInterface myObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLUtility

public XMLUtility()
Method Detail

toXML

public static void toXML(gov.nih.nci.common.util.XMLInterface[] myObject,
                         org.w3c.dom.Node parent,
                         org.w3c.dom.Document doc)

toHeavyXML

public static void toHeavyXML(gov.nih.nci.common.util.XMLInterface[] myObject,
                              org.w3c.dom.Node parent,
                              org.w3c.dom.Document doc)

toSelectedXML

public static void toSelectedXML(gov.nih.nci.common.util.XMLInterface[] myObject,
                                 java.util.ArrayList fillInNodes,
                                 org.w3c.dom.Node parent,
                                 org.w3c.dom.Document doc)

xmlStart

public static void xmlStart(gov.nih.nci.common.util.XMLInterface myObject)
                     throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

CreateURL

public static org.w3c.dom.Element CreateURL(java.lang.String objectName,
                                            java.util.Hashtable criteria,
                                            org.w3c.dom.Document doc)

CreateURL

public static org.w3c.dom.Element CreateURL(java.lang.String objectName,
                                            java.lang.String tagName,
                                            java.util.Hashtable criteria,
                                            org.w3c.dom.Document doc)

setXlinkNameSpace

public static void setXlinkNameSpace(org.w3c.dom.Element element)

makeXMLStringDoc

public static java.lang.String makeXMLStringDoc(gov.nih.nci.common.util.XMLInterface[] objects)
                                         throws org.apache.soap.SOAPException
makeXMLStringDoc()

Creates a string representation of each element in objects array.

Parameters:
objects - the array of elements
Returns:
the String representation of the elements
Throws:
org.apache.soap.SOAPException

makeHeavyXMLStringDoc

public static java.lang.String makeHeavyXMLStringDoc(gov.nih.nci.common.util.XMLInterface[] objects)
                                              throws org.apache.soap.SOAPException
makeHeavyXMLStringDoc()

Creates a string representation of each element in objects array. The individual objects produce the "heavy" version of their XML

Parameters:
objects - the array of elements
Returns:
the String representation of the elements
Throws:
org.apache.soap.SOAPException

makeXMLStringDoc

public static java.lang.String makeXMLStringDoc(gov.nih.nci.common.util.XMLInterface[] objects,
                                                java.util.ArrayList fillInObjects)
                                         throws org.apache.soap.SOAPException
makeSelectedXMLStringDoc()

Creates a string representation of each element in objects array. The individual objects produce the "heavy" version of their XML based upon elements in the fillInObjects arraylist

Parameters:
objects - the array of elements
fillInObjects - objects in the XML to fill in
Returns:
the String representation of the elements
Throws:
org.apache.soap.SOAPException

makeXMLStringDoc

public static java.lang.String makeXMLStringDoc(gov.nih.nci.common.search.SearchResult searchResult,
                                                boolean heavy)
                                         throws org.apache.soap.SOAPException
makeXMLStringDoc()

Creates a string representation of each element in a search result.

Parameters:
search - result
if - heavy xml is requested
Returns:
the String representation of the elements
Throws:
org.apache.soap.SOAPException

makeXMLStringDoc

public static java.lang.String makeXMLStringDoc(gov.nih.nci.common.search.SearchResult searchResult,
                                                java.util.ArrayList fillInObjects,
                                                boolean heavy)
                                         throws org.apache.soap.SOAPException
makeXMLStringDoc()

Creates a string representation of each element in a search result.

Parameters:
search - result
arraylist - of objects to fill in
if - heavy xml is requested
Returns:
the String representation of the elements
Throws:
org.apache.soap.SOAPException

makeXMLStringTreeDoc

public static java.lang.String makeXMLStringTreeDoc(gov.nih.nci.common.util.XMLInterface[] objects,
                                                    gov.nih.nci.common.util.XMLInterface[][] children)
                                             throws org.apache.soap.SOAPException
makeXMLStringTreeDoc()

Creates a string representation of an Element hierarchy in which objects and children have a one-to-one correspondence; for each object element, an array of children elements exist.

Parameters:
objects - the array of parent elements
children - the multidimensional array of children elements (one array of children elements per parent element)
Returns:
the String representation of the element hierarchy
Throws:
org.apache.soap.SOAPException

makeXMLStringTreeDoc

public static java.lang.String makeXMLStringTreeDoc(gov.nih.nci.common.util.XMLInterface[] objects,
                                                    gov.nih.nci.common.util.XMLInterface[] children)
                                             throws org.apache.soap.SOAPException
makeXMLStringTreeDoc()

Creates a string representation of an Element hierarchy in which objects and children have a one-to-one correspondence; for each object element, one child element exists.

Parameters:
objects - the array of parent elements
children - the array of children elements (one child per parent)
Returns:
the String representation of the element hierarchy
Throws:
org.apache.soap.SOAPException

elem2String

public static java.lang.String elem2String(org.w3c.dom.Node elem)
                                    throws org.apache.soap.SOAPException
elem2String()

Converts an XML element to a string representation

Parameters:
elem - the element to translate into a String
Returns:
the String version of the element
Throws:
org.apache.soap.SOAPException

buildXMLMethods

public org.w3c.dom.Element buildXMLMethods(org.w3c.dom.Element element,
                                           java.util.Hashtable associationMethods,
                                           java.util.ArrayList fillOutValues,
                                           java.lang.Object theObject,
                                           org.w3c.dom.Document doc)
buildXMLMethods()

Conveniance for the beans this method will return the XML for the methods associated with the bean

Parameters:
elem - the element to have the XML appended
associatedMethods - a hash table of method descriptors for the bean
fillOutValues - an ArrayList of methods that should have the XML filled in completely
theObject - a reference to the Object so methods may be invoked
doc - a document to work with
Returns:
the element with methods filled in

createAssociationElement

public org.w3c.dom.Element createAssociationElement(gov.nih.nci.common.util.XMLMethodDescriptor xmlMethDesc,
                                                    java.lang.Object id,
                                                    org.w3c.dom.Document doc)

main

public static void main(java.lang.String[] args)