Class EDLXmlUtils


  • public final class EDLXmlUtils
    extends java.lang.Object
    Contains a bunch of dom utility methods.
    Author:
    Kuali Rice Team (rice.collab@kuali.org)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DATA_E  
      static java.lang.String DOCID_E  
      static java.lang.String EDL_E  
      static java.lang.String EDLCONTENT_E  
      static java.lang.String TYPE_E  
      static java.lang.String VALIDATION_E  
      static java.lang.String VERSION_E  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addErrorsAndMessagesToDocument​(org.w3c.dom.Document doc, java.util.List errors, java.util.List messages, java.util.Map<java.lang.String,​java.lang.String> fieldErrors)
      Adds the specified errors and messages to the <documentState> element of the given EDL doc
      static void addGlobalErrorMessage​(org.w3c.dom.Document dom, java.lang.String errorMessage)  
      static org.w3c.dom.Element createChildElement​(org.w3c.dom.Element parentElement, java.lang.String elementName)  
      static org.w3c.dom.Element createFieldDataElement​(org.w3c.dom.Element parentVersionElement, MatchingParam matchingParam)  
      static org.w3c.dom.Element createTextElementOnParent​(org.w3c.dom.Element parent, java.lang.String childElementName, java.lang.String text)  
      static org.w3c.dom.Element getChildElement​(org.w3c.dom.Node parent, java.lang.String name)
      Returns a node child with the specified tag name of the specified parent node, or null if no such child node is found.
      static java.lang.String getChildElementTextValue​(org.w3c.dom.Node parent, java.lang.String name)
      Returns the text value of a child element with the given name, of the given parent element, or null if the child does not exist or does not have a child text node
      static org.w3c.dom.Element getDataFromEDLDocument​(org.w3c.dom.Element edlContent, boolean create)  
      static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
      Returns a valid DocumentBuilder
      static org.w3c.dom.Element getDocumentStateElement​(org.w3c.dom.Document dom)  
      static org.w3c.dom.Element getEDLContent​(org.w3c.dom.Document displayDoc, boolean create)  
      static org.w3c.dom.Element getOrCreateChildElement​(org.w3c.dom.Element parent, java.lang.String name, boolean create)
      Returns, and creates if absent, a child element
      static org.w3c.dom.Element getVersionFromData​(org.w3c.dom.Element dataElement, java.lang.Integer versionCount)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getDocumentBuilder

        public static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
        Returns a valid DocumentBuilder
        Returns:
        a valid DocumentBuilder
      • createFieldDataElement

        public static org.w3c.dom.Element createFieldDataElement​(org.w3c.dom.Element parentVersionElement,
                                                                 MatchingParam matchingParam)
      • createChildElement

        public static org.w3c.dom.Element createChildElement​(org.w3c.dom.Element parentElement,
                                                             java.lang.String elementName)
      • getDocumentStateElement

        public static org.w3c.dom.Element getDocumentStateElement​(org.w3c.dom.Document dom)
      • addGlobalErrorMessage

        public static void addGlobalErrorMessage​(org.w3c.dom.Document dom,
                                                 java.lang.String errorMessage)
      • createTextElementOnParent

        public static org.w3c.dom.Element createTextElementOnParent​(org.w3c.dom.Element parent,
                                                                    java.lang.String childElementName,
                                                                    java.lang.String text)
      • getVersionFromData

        public static org.w3c.dom.Element getVersionFromData​(org.w3c.dom.Element dataElement,
                                                             java.lang.Integer versionCount)
      • getDataFromEDLDocument

        public static org.w3c.dom.Element getDataFromEDLDocument​(org.w3c.dom.Element edlContent,
                                                                 boolean create)
      • getEDLContent

        public static org.w3c.dom.Element getEDLContent​(org.w3c.dom.Document displayDoc,
                                                        boolean create)
      • getOrCreateChildElement

        public static org.w3c.dom.Element getOrCreateChildElement​(org.w3c.dom.Element parent,
                                                                  java.lang.String name,
                                                                  boolean create)
        Returns, and creates if absent, a child element
        Parameters:
        parent - the parent element
        name - the name of the child element to create and/or return
        Returns:
        reference to the child element
      • getChildElement

        public static org.w3c.dom.Element getChildElement​(org.w3c.dom.Node parent,
                                                          java.lang.String name)
        Returns a node child with the specified tag name of the specified parent node, or null if no such child node is found.
        Parameters:
        parent - the parent node
        name - the name of the child node
        Returns:
        child node if found, null otherwise
      • getChildElementTextValue

        public static java.lang.String getChildElementTextValue​(org.w3c.dom.Node parent,
                                                                java.lang.String name)
        Returns the text value of a child element with the given name, of the given parent element, or null if the child does not exist or does not have a child text node
        Parameters:
        parent - parent element
        name - name of child element
        Returns:
        the text value of a child element with the given name, of the given parent element, or null if the child does not exist or does not have a child text node
      • addErrorsAndMessagesToDocument

        public static void addErrorsAndMessagesToDocument​(org.w3c.dom.Document doc,
                                                          java.util.List errors,
                                                          java.util.List messages,
                                                          java.util.Map<java.lang.String,​java.lang.String> fieldErrors)
        Adds the specified errors and messages to the <documentState> element of the given EDL doc
        Parameters:
        doc - the EDL doc
        errors - the list of error Strings
        messages - the list of message Strings