org.biomoby.client.taverna.plugin
Class XMLUtilities

java.lang.Object
  extended by org.biomoby.client.taverna.plugin.XMLUtilities

public class XMLUtilities
extends java.lang.Object

Author:
Eddie Kawas

Field Summary
static org.jdom.Namespace MOBY_NS
           
static java.lang.String newline
           
 
Constructor Summary
XMLUtilities()
           
 
Method Summary
static org.jdom.Element createCollectionFromListOfSimples(java.lang.String collectionName, java.util.List<org.jdom.Element> simples2makeCollection)
           
static org.jdom.Document createDomDocument()
           
static org.jdom.Element createMobyDataElementWrapper(org.jdom.Element element)
           
static org.jdom.Element createMobyDataElementWrapper(org.jdom.Element element, java.lang.String queryID, org.jdom.Element serviceNotes)
           
static java.lang.String createMobyDataElementWrapper(java.lang.String xml)
           
static java.lang.String createMobyDataElementWrapper(java.lang.String xml, java.lang.String queryID)
           
static java.lang.String createMobyDataElementWrapper(java.lang.String xml, java.lang.String queryID, org.jdom.Element serviceNotes)
           
static org.jdom.Element createMobyDataWrapper(java.lang.String queryID, org.jdom.Element serviceNotes)
           
static org.jdom.Element createMultipleInvokations(org.jdom.Element[] elements)
           
static java.lang.String createMultipleInvokations(java.lang.String[] xmls)
           
static org.jdom.Element createServiceInput(org.jdom.Element[] elements, java.lang.String queryID)
           
static java.lang.String createServiceInput(java.lang.String[] elements, java.lang.String queryID)
           
static org.jdom.Element extractMobyData(org.jdom.Element element)
           
static org.jdom.Element[] getAllSimplesByArticleName(java.lang.String name, org.jdom.Element element)
           
static java.lang.String[] getAllSimplesByArticleName(java.lang.String name, java.lang.String xml)
           
static org.jdom.Element getCollection(java.lang.String name, org.jdom.Element element)
           
static java.lang.String getCollection(java.lang.String name, java.lang.String xml)
           
static org.jdom.Element getDirectChildByArticleName(org.jdom.Element element, java.lang.String articleName)
           
static java.lang.String getDirectChildByArticleName(java.lang.String xml, java.lang.String articleName)
           
static org.jdom.Document getDOMDocument(java.lang.String document)
           
static org.jdom.Element[] getListOfCollections(org.jdom.Element element)
           
static java.lang.String[] getListOfCollections(java.lang.String message)
           
static org.jdom.Element[] getListOfSimples(org.jdom.Element element)
           
static java.lang.String[] getListOfSimples(java.lang.String message)
           
static java.lang.String getQueryID(org.jdom.Element xml)
           
static java.lang.String getQueryID(java.lang.String xml)
           
static org.jdom.Element getServiceNotes(org.jdom.Element element)
           
static java.lang.String getServiceNotes(java.lang.String xml)
           
static org.jdom.Element getServiceNotesAsElement(java.lang.String xml)
           
static org.jdom.Element getSimple(java.lang.String name, org.jdom.Element element)
          This method assumes a single invocation was passed to it
static java.lang.String getSimple(java.lang.String name, java.lang.String xml)
          This method assumes a single invocation was passed to it
static org.jdom.Element[] getSimplesFromCollection(org.jdom.Element element)
           
static java.lang.String[] getSimplesFromCollection(java.lang.String xml)
           
static org.jdom.Element[] getSimplesFromCollection(java.lang.String name, org.jdom.Element element)
           
static java.lang.String[] getSimplesFromCollection(java.lang.String name, java.lang.String xml)
           
static org.jdom.Element[] getSingleInvokationsFromMultipleInvokations(org.jdom.Element element)
           
static java.lang.String[] getSingleInvokationsFromMultipleInvokations(java.lang.String xml)
           
static org.jdom.Element getWrappedCollection(java.lang.String name, org.jdom.Element element)
           
static java.lang.String getWrappedCollection(java.lang.String name, java.lang.String xml)
           
static org.jdom.Element getWrappedSimple(java.lang.String name, org.jdom.Element element)
           
static java.lang.String getWrappedSimple(java.lang.String name, java.lang.String xml)
           
static org.jdom.Element[] getWrappedSimplesFromCollection(java.lang.String name, org.jdom.Element element)
           
static java.lang.String[] getWrappedSimplesFromCollection(java.lang.String name, java.lang.String xml)
           
static boolean isCollection(org.jdom.Element element)
           
static boolean isCollection(java.lang.String xml)
           
static boolean isEmpty(org.jdom.Element xml)
           
static boolean isEmpty(java.lang.String xml)
           
static boolean isMultipleInvocationMessage(org.jdom.Element message)
           
static boolean isMultipleInvocationMessage(java.lang.String message)
           
static boolean isThereData(org.jdom.Element xml)
           
static boolean isThereData(java.lang.String xml)
           
static boolean isWrapped(org.jdom.Element element)
           
static boolean isWrapped(java.lang.String xml)
           
static void main(java.lang.String[] args)
           
static java.util.List mergeCollections(java.util.List theList, java.lang.String name)
           
static org.jdom.Element renameCollection(java.lang.String newName, org.jdom.Element element)
           
static java.lang.String renameCollection(java.lang.String newName, java.lang.String xml)
           
static org.jdom.Element renameSimple(java.lang.String newName, java.lang.String type, org.jdom.Element element)
           
static java.lang.String renameSimple(java.lang.String newName, java.lang.String type, java.lang.String xml)
           
static org.jdom.Element setQueryID(org.jdom.Element xml, java.lang.String id)
           
static java.lang.String setQueryID(java.lang.String xml, java.lang.String id)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newline

public static final java.lang.String newline

MOBY_NS

public static final org.jdom.Namespace MOBY_NS
Constructor Detail

XMLUtilities

public XMLUtilities()
Method Detail

isMultipleInvocationMessage

public static boolean isMultipleInvocationMessage(java.lang.String message)
                                           throws org.biomoby.shared.MobyException
Parameters:
message - the structurally valid BioMoby message as a String
Returns:
true if the message contains multiple invocations, false otherwise.
Throws:
org.biomoby.shared.MobyException - if the message is null

isMultipleInvocationMessage

public static boolean isMultipleInvocationMessage(org.jdom.Element message)
                                           throws org.biomoby.shared.MobyException
Parameters:
message - the structurally valid BioMoby message as an Element
Returns:
true if the message contains multiple invocations, false otherwise.
Throws:
org.biomoby.shared.MobyException - if the message is null

getListOfSimples

public static org.jdom.Element[] getListOfSimples(org.jdom.Element element)
                                           throws org.biomoby.shared.MobyException
Parameters:
element - the element to extract the list of simples from. This method assumes that you are passing in a single invokation and that you wish to extract the Simples not contained in any collections. This method also maintains any past queryIDs.
Returns:
an array of elements that are fully 'wrapped' simples.
Throws:
org.biomoby.shared.MobyException - if the Element isnt structurally valid in terms of Moby message structure

getListOfSimples

public static java.lang.String[] getListOfSimples(java.lang.String message)
                                           throws org.biomoby.shared.MobyException
Parameters:
message - the String of xml to extract the list of simples from. This method assumes that you are passing in a single invokation and that you wish to extract the Simples not contained in any collections. This method also maintains any past queryIDs.
Returns:
an array of Strings that represent fully 'wrapped' simples.
Throws:
org.biomoby.shared.MobyException - if the String doesnt contain a structurally valid Moby message structure or if an unexpected error occurs

getListOfCollections

public static java.lang.String[] getListOfCollections(java.lang.String message)
                                               throws org.biomoby.shared.MobyException
Parameters:
message - the String to extract the list of collections from and assumes that you are passing in a single invocation message.
Returns:
an array of Strings representing all of the fully 'wrapped' collections in the message.
Throws:
org.biomoby.shared.MobyException - if the the element contains an invalid BioMOBY message

getListOfCollections

public static org.jdom.Element[] getListOfCollections(org.jdom.Element element)
                                               throws org.biomoby.shared.MobyException
Parameters:
element - the element to extract the list of collections from and assumes that you are passing in a single invocation message.
Returns:
an array of Elements representing all of the fully 'wrapped' collections in the message
Throws:
org.biomoby.shared.MobyException - if the element contains an invalid BioMOBY message

getSimple

public static java.lang.String getSimple(java.lang.String name,
                                         java.lang.String xml)
                                  throws org.biomoby.shared.MobyException
This method assumes a single invocation was passed to it

Parameters:
name - the article name of the simple that you are looking for
xml - the xml that you want to query
Returns:
a String object that represent the simple found.
Throws:
org.biomoby.shared.MobyException - if no simple was found given the article name and/or data type or if the xml was not valid moby xml or if an unexpected error occurs.

getSimple

public static org.jdom.Element getSimple(java.lang.String name,
                                         org.jdom.Element element)
                                  throws org.biomoby.shared.MobyException
This method assumes a single invocation was passed to it

Parameters:
name - the article name of the simple that you are looking for
element - the Element that you want to query
Returns:
an Element that represents the simple found.
Throws:
org.biomoby.shared.MobyException - if no simple was found given the article name and/or data type or if the xml was not valid moby xml or if an unexpected error occurs.

getQueryID

public static java.lang.String getQueryID(java.lang.String xml)
                                   throws org.biomoby.shared.MobyException
Parameters:
xml - a string of xml containing a single invocation message to extract the queryID from
Returns:
the queryID contained in the xml or a generated one if one doesnt exist
Throws:
org.biomoby.shared.MobyException - if the String of xml is invalid or if the message is a multiple invocation message

getQueryID

public static java.lang.String getQueryID(org.jdom.Element xml)
                                   throws org.biomoby.shared.MobyException
Parameters:
xml - a single invocation message to extract the queryID from
Returns:
the queryID contained in the xml or a generated one if one doesnt exist
Throws:
if - the message is a multiple invocation message
org.biomoby.shared.MobyException

setQueryID

public static java.lang.String setQueryID(java.lang.String xml,
                                          java.lang.String id)
                                   throws org.biomoby.shared.MobyException
Parameters:
xml - a string of xml containing a single invocation message to extract the queryID from
Returns:
the element passed in to the method with the queryID set if the message was valid.
Throws:
org.biomoby.shared.MobyException - if the String of xml is syntatically invalid or if the message is a multiple invocation message

setQueryID

public static org.jdom.Element setQueryID(org.jdom.Element xml,
                                          java.lang.String id)
                                   throws org.biomoby.shared.MobyException
Parameters:
xml - a single invocation message to extract the queryID from
Returns:
the element passed in to the method with the queryID set if the message was valid.
Throws:
org.biomoby.shared.MobyException - if the message is a multiple invocation message

getWrappedSimple

public static java.lang.String getWrappedSimple(java.lang.String name,
                                                java.lang.String xml)
                                         throws org.biomoby.shared.MobyException
Parameters:
name - the articlename of the simple that you wish to extract
xml - the xml message
Returns:
the wrapped simple if it exists
Throws:
org.biomoby.shared.MobyException - if the message is a multiple invocation message or if the xml is syntatically invalid.

getWrappedSimple

public static org.jdom.Element getWrappedSimple(java.lang.String name,
                                                org.jdom.Element element)
                                         throws org.biomoby.shared.MobyException
Parameters:
name - the articlename of the simple that you wish to extract
xml - the xml message
Returns:
the wrapped simple if it exists
Throws:
org.biomoby.shared.MobyException - if the message is a multiple invocation message.

getCollection

public static org.jdom.Element getCollection(java.lang.String name,
                                             org.jdom.Element element)
                                      throws org.biomoby.shared.MobyException
Parameters:
name - the name of the collection to extract
element - the element to extract the collection from
Returns:
the collection if found
Throws:
org.biomoby.shared.MobyException - if the message is invalid

getCollection

public static java.lang.String getCollection(java.lang.String name,
                                             java.lang.String xml)
                                      throws org.biomoby.shared.MobyException
Parameters:
name -
xml -
Returns:
Throws:
org.biomoby.shared.MobyException

getWrappedCollection

public static org.jdom.Element getWrappedCollection(java.lang.String name,
                                                    org.jdom.Element element)
                                             throws org.biomoby.shared.MobyException
Parameters:
name -
element -
Returns:
Throws:
org.biomoby.shared.MobyException

getWrappedCollection

public static java.lang.String getWrappedCollection(java.lang.String name,
                                                    java.lang.String xml)
                                             throws org.biomoby.shared.MobyException
Parameters:
name -
xml -
Returns:
Throws:
org.biomoby.shared.MobyException

getSimplesFromCollection

public static java.lang.String[] getSimplesFromCollection(java.lang.String name,
                                                          java.lang.String xml)
                                                   throws org.biomoby.shared.MobyException
Parameters:
name - the name of the collection to extract the simples from.
xml - the XML to extract from
Returns:
an array of String objects that represent the simples
Throws:
org.biomoby.shared.MobyException

getSimplesFromCollection

public static org.jdom.Element[] getSimplesFromCollection(java.lang.String name,
                                                          org.jdom.Element element)
                                                   throws org.biomoby.shared.MobyException
Parameters:
name - the name of the collection to extract the simples from.
element - the Element to extract from
Returns:
an array of Elements objects that represent the simples
Throws:
org.biomoby.shared.MobyException

getAllSimplesByArticleName

public static java.lang.String[] getAllSimplesByArticleName(java.lang.String name,
                                                            java.lang.String xml)
                                                     throws org.biomoby.shared.MobyException
Parameters:
name - the name of the simples that you would like to extract. The name can be collection name as well. This method extracts simples from all invocation messages.
xml - the xml to extract the simples from
Returns:
a String[] of Simples that you are looking for, taken from collections with your search name as well as simple elements with the search name
Throws:
org.biomoby.shared.MobyException - if there is a problem with the BioMOBY message

getAllSimplesByArticleName

public static org.jdom.Element[] getAllSimplesByArticleName(java.lang.String name,
                                                            org.jdom.Element element)
                                                     throws org.biomoby.shared.MobyException
Parameters:
name - the name of the simples that you would like to extract. The name can be collection name as well. This method extracts simples from all invocation messages.
element - the xml to extract the simples from
Returns:
a String[] of Simples that you are looking for, taken from collections with your search name as well as simple elements with the search name
Throws:
org.biomoby.shared.MobyException - if there is a problem with the BioMOBY message

getSimplesFromCollection

public static java.lang.String[] getSimplesFromCollection(java.lang.String xml)
                                                   throws org.biomoby.shared.MobyException
Parameters:
xml - the XML to extract from
Returns:
an array of String objects that represent the simples
Throws:
org.biomoby.shared.MobyException

getSimplesFromCollection

public static org.jdom.Element[] getSimplesFromCollection(org.jdom.Element element)
                                                   throws org.biomoby.shared.MobyException
Parameters:
name - the name of the collection to extract the simples from.
element - the Element to extract from
Returns:
an array of Elements objects that represent the 'unwrapped' simples
Throws:
org.biomoby.shared.MobyException

getWrappedSimplesFromCollection

public static java.lang.String[] getWrappedSimplesFromCollection(java.lang.String name,
                                                                 java.lang.String xml)
                                                          throws org.biomoby.shared.MobyException
Parameters:
name - the name of the collection to extract the simples from.
xml - the XML to extract from
Returns:
an array of String objects that represent the simples, with the name of the collection
Throws:
org.biomoby.shared.MobyException - if the collection doesnt exist or the xml is invalid

getWrappedSimplesFromCollection

public static org.jdom.Element[] getWrappedSimplesFromCollection(java.lang.String name,
                                                                 org.jdom.Element element)
                                                          throws org.biomoby.shared.MobyException
Parameters:
name - the name of the collection to extract the simples from.
element - the Element to extract from
Returns:
an array of Elements objects that represent the simples, with the name of the collection
Throws:
org.biomoby.shared.MobyException - MobyException if the collection doesnt exist or the xml is invalid

getSingleInvokationsFromMultipleInvokations

public static java.lang.String[] getSingleInvokationsFromMultipleInvokations(java.lang.String xml)
                                                                      throws org.biomoby.shared.MobyException
Parameters:
xml - the message to extract the invocation messages from
Returns:
an array of String objects each representing a distinct BioMOBY invocation message.
Throws:
org.biomoby.shared.MobyException - if the moby message is invalid or if the xml is syntatically invalid.

getSingleInvokationsFromMultipleInvokations

public static org.jdom.Element[] getSingleInvokationsFromMultipleInvokations(org.jdom.Element element)
                                                                      throws org.biomoby.shared.MobyException
Parameters:
element - the message to extract the invocation messages from
Returns:
an array of Element objects each representing a distinct invocation message.
Throws:
org.biomoby.shared.MobyException - if the moby message is invalid.

getDOMDocument

public static org.jdom.Document getDOMDocument(java.lang.String document)
                                        throws org.biomoby.shared.MobyException
Parameters:
document - the string to create a DOM document from
Returns:
a Document object that represents the string of XML.
Throws:
org.biomoby.shared.MobyException - if the xml is invalid syntatically.

createServiceInput

public static java.lang.String createServiceInput(java.lang.String[] elements,
                                                  java.lang.String queryID)
                                           throws org.biomoby.shared.MobyException
Parameters:
elements - the fully wrapped moby simples and/or collections to wrap an input message around
queryID - the queryID for this input
Returns:
a fully wrapped message with an appropriate queryID and elements added to it
Throws:
org.biomoby.shared.MobyException - if an element is invalid or if the XML is syntatically invalid.

createServiceInput

public static org.jdom.Element createServiceInput(org.jdom.Element[] elements,
                                                  java.lang.String queryID)
                                           throws org.biomoby.shared.MobyException
Parameters:
elements - the fully wrapped moby simples and/or collections to wrap an input message around
queryID - the queryID for this input
Returns:
a fully wrapped message with an appropriate queryID and elements added to it
Throws:
org.biomoby.shared.MobyException - if an element is invalid.

extractMobyData

public static org.jdom.Element extractMobyData(org.jdom.Element element)
                                        throws org.biomoby.shared.MobyException
Parameters:
element - the element that contains the moby message that you would like to extract the mobyData block from (assumes single invocation, but returns the first mobyData block in a multiple invocation message).
Returns:
the mobyData element block.
Throws:
org.biomoby.shared.MobyException - if the moby message is invalid

renameCollection

public static org.jdom.Element renameCollection(java.lang.String newName,
                                                org.jdom.Element element)
                                         throws org.biomoby.shared.MobyException
Parameters:
newName - the new name for this fully wrapped BioMOBY collection
element - the fully wrapped BioMOBY collection
Returns:
@return an element 'Collection' representing the renamed collection
Throws:
org.biomoby.shared.MobyException - if the message is invalid

renameCollection

public static java.lang.String renameCollection(java.lang.String newName,
                                                java.lang.String xml)
                                         throws org.biomoby.shared.MobyException
Parameters:
newName - the new name for this fully wrapped BioMOBY collection
xml - the fully wrapped BioMOBY collection
Returns:
an element 'Collection' representing the renamed collection
Throws:
org.biomoby.shared.MobyException - if the BioMOBY message is invalid or the xml is syntatically invalid.

renameSimple

public static java.lang.String renameSimple(java.lang.String newName,
                                            java.lang.String type,
                                            java.lang.String xml)
                                     throws org.biomoby.shared.MobyException
Parameters:
oldName -
newName -
type -
xml -
Returns:
Throws:
org.biomoby.shared.MobyException

renameSimple

public static org.jdom.Element renameSimple(java.lang.String newName,
                                            java.lang.String type,
                                            org.jdom.Element element)
                                     throws org.biomoby.shared.MobyException
Parameters:
oldName -
newName -
type -
element -
Returns:
Throws:
org.biomoby.shared.MobyException

createDomDocument

public static org.jdom.Document createDomDocument()
                                           throws org.biomoby.shared.MobyException
Returns:
Throws:
org.biomoby.shared.MobyException

createMobyDataElementWrapper

public static org.jdom.Element createMobyDataElementWrapper(org.jdom.Element element,
                                                            java.lang.String queryID,
                                                            org.jdom.Element serviceNotes)
                                                     throws org.biomoby.shared.MobyException
Parameters:
element -
queryID -
serviceNotes -
Returns:
Throws:
org.biomoby.shared.MobyException

createMobyDataWrapper

public static org.jdom.Element createMobyDataWrapper(java.lang.String queryID,
                                                     org.jdom.Element serviceNotes)
                                              throws org.biomoby.shared.MobyException
Throws:
org.biomoby.shared.MobyException

createMobyDataElementWrapper

public static java.lang.String createMobyDataElementWrapper(java.lang.String xml)
                                                     throws org.biomoby.shared.MobyException
Parameters:
xml -
Returns:
Throws:
org.biomoby.shared.MobyException

createMobyDataElementWrapper

public static org.jdom.Element createMobyDataElementWrapper(org.jdom.Element element)
                                                     throws org.biomoby.shared.MobyException
Parameters:
element -
Returns:
Throws:
org.biomoby.shared.MobyException

createMobyDataElementWrapper

public static java.lang.String createMobyDataElementWrapper(java.lang.String xml,
                                                            java.lang.String queryID)
                                                     throws org.biomoby.shared.MobyException
Parameters:
xml -
queryID -
Returns:
Throws:
org.biomoby.shared.MobyException

createMobyDataElementWrapper

public static java.lang.String createMobyDataElementWrapper(java.lang.String xml,
                                                            java.lang.String queryID,
                                                            org.jdom.Element serviceNotes)
                                                     throws org.biomoby.shared.MobyException
Throws:
org.biomoby.shared.MobyException

createMultipleInvokations

public static org.jdom.Element createMultipleInvokations(org.jdom.Element[] elements)
                                                  throws org.biomoby.shared.MobyException
Parameters:
elements -
Returns:
Throws:
org.biomoby.shared.MobyException

createMultipleInvokations

public static java.lang.String createMultipleInvokations(java.lang.String[] xmls)
                                                  throws org.biomoby.shared.MobyException
Parameters:
xmls -
Returns:
Throws:
org.biomoby.shared.MobyException

isWrapped

public static boolean isWrapped(org.jdom.Element element)
Parameters:
xml - a string of xml
Returns:
true if the xml contains a full moby message (assumes single invocation, but will return the first mobyData block from a multiple invocation message).

isWrapped

public static boolean isWrapped(java.lang.String xml)
                         throws org.biomoby.shared.MobyException
Parameters:
xml - a string of xml
Returns:
true if the xml contains a full moby message (assumes single invocation, but will return the first mobyData block from a multiple invocation message).
Throws:
org.biomoby.shared.MobyException - if the xml is syntatically invalid

isCollection

public static boolean isCollection(org.jdom.Element element)
                            throws org.biomoby.shared.MobyException
Parameters:
element - an Element containing a single invocation
Returns:
true if the element contains a moby collection, false otherwise.
Throws:
org.biomoby.shared.MobyException - if xml is invalid

isCollection

public static boolean isCollection(java.lang.String xml)
                            throws org.biomoby.shared.MobyException
Parameters:
xml - a string of xml containing a single invocation
Returns:
true if the xml contains a moby collection, false otherwise.
Throws:
org.biomoby.shared.MobyException - if xml is invalid

isEmpty

public static boolean isEmpty(java.lang.String xml)
Parameters:
xml - a string of xml to check for emptiness
Returns:
true if the element is empty, false otherwise.

isEmpty

public static boolean isEmpty(org.jdom.Element xml)
Parameters:
xml - an element to check for emptiness
Returns:
true if the element is empty, false otherwise.

mergeCollections

public static java.util.List mergeCollections(java.util.List theList,
                                              java.lang.String name)
                                       throws org.biomoby.shared.MobyException
Parameters:
theList - a list of Elements that represent collections (wrapped in a MobyData tag
name - the name to set for the collection
Returns:
a list containing a single wrapped collection Element that contains all of the simples in the collections in theList
Throws:
org.biomoby.shared.MobyException

getServiceNotes

public static org.jdom.Element getServiceNotes(org.jdom.Element element)
Parameters:
element - a full moby message (root element called MOBY) and may be prefixed
Returns:
the serviceNotes element if it exists, null otherwise.

getServiceNotes

public static java.lang.String getServiceNotes(java.lang.String xml)
Parameters:
xml - a full moby message (root element called MOBY) and may be prefixed
Returns:
the serviceNotes element as a string if it exists, null otherwise.

getServiceNotesAsElement

public static org.jdom.Element getServiceNotesAsElement(java.lang.String xml)
Parameters:
xml - a full moby message (root element called MOBY) and may be prefixed
Returns:
the serviceNotes element if it exists, null otherwise.

getDirectChildByArticleName

public static org.jdom.Element getDirectChildByArticleName(org.jdom.Element element,
                                                           java.lang.String articleName)
Parameters:
element - the xml element
articleName - the name of the child to extract
Returns:
an element that represents the direct child or null if it wasnt found.

getDirectChildByArticleName

public static java.lang.String getDirectChildByArticleName(java.lang.String xml,
                                                           java.lang.String articleName)
Parameters:
xml - the string of xml
articleName - the name of the child to extract
Returns:
an xml string that represents the direct child or null if it wasnt found.

isThereData

public static boolean isThereData(org.jdom.Element xml)
Parameters:
xml - the xml message to test whether or not there is stuff in the mobyData portion of a message.
Returns:
true if there is data, false otherwise.

isThereData

public static boolean isThereData(java.lang.String xml)
Parameters:
xml - the xml message to test whether or not there is stuff in the mobyData portion of a message.
Returns:
true if there is data, false otherwise.

main

public static void main(java.lang.String[] args)
                 throws org.biomoby.shared.MobyException
Throws:
org.biomoby.shared.MobyException

createCollectionFromListOfSimples

public static org.jdom.Element createCollectionFromListOfSimples(java.lang.String collectionName,
                                                                 java.util.List<org.jdom.Element> simples2makeCollection)
                                                          throws org.biomoby.shared.MobyException
Parameters:
collectionName - the name you would like the collection to be called
simples2makeCollection - the list of Elements to merge into a collection
Returns:
null if a collection wasnt made, otherwise a fully wrapped collection is returned.
Throws:
org.biomoby.shared.MobyException