Class DOMParser

java.lang.Object
org.cdlib.mrt.utility.DOMParser

public class DOMParser extends Object
  • Constructor Details

    • DOMParser

      public DOMParser()
  • Method Details

    • getSimpleElementText

      public static String getSimpleElementText(Node node, LoggerInf logger) throws TException
      Return concatinated string text values for all text nodes that are children of this node Contains logger
      Parameters:
      elem - base element to extract text nodes
      Logger - Logger to receive messages, if any
      Returns:
      string containing concatinated text nodes
      Throws:
      TException
    • doParse

      public static Document doParse(InputStream istream, LoggerInf logger) throws TException
      parse xml contained from input stream InputStream Contains logger param Logger Logger to receive messages, if any
      Returns:
      root element node for DOM
      Throws:
      TException
    • doParse

      public static Document doParse(InputStream istream, LoggerInf logger, boolean validate, boolean nsAware, boolean expandEntities) throws TException
      parse xml contained from input stream InputStream Contains logger
      Parameters:
      istream - input stream to be parsed
      logger - framework log for output
      validate - flag - true=require xml validation, false=don't
      nsAware - flag - true=force name space awareness, false=don't
      Returns:
      root element node for DOM
      Throws:
      TException
    • setup

      public static DocumentBuilder setup(LoggerInf logger, boolean validate, boolean nsAware, boolean expandEntities) throws TException
      get parser Contains logger
      Parameters:
      Logger - Logger to receive messages, if any
      Returns:
      true=setup worked false=exception
      Throws:
      TException
    • getNodeList

      public static NodeList getNodeList(Node node, String expression, LoggerInf logger) throws TException
      Same as above, fewer parameters Logging routine not added since the original code for this method did no have a "throw" in the catch (TransformerException te) which indicates that it may not be worth logging.
      Parameters:
      node - org.w3c.dom.Node to start with within a document (including a SOAP message)
      String - XPath expression to evaluate
      Returns:
      nodeList List of nodes that fit the expression
      Throws:
      TException
    • getFirstNode

      public static Element getFirstNode(Element elem, String name) throws TException
      Stub method: Return first decendant element matching a specific string name (xpath=name[1]
      Parameters:
      elem - starting element to begin decendant node extraction
      name - of child node to be matched
      Returns:
      first element matching name
      Throws:
      TException
    • getFirstNode

      public static Element getFirstNode(Element elem, String name, LoggerInf logger) throws TException
      Return first decendant element matching a specific string name (xpath=name[1] Contains logger
      Parameters:
      elem - starting element to begin decendant node extraction
      name - of child node to be matched
      Logger - Logger to receive messages, if any
      Returns:
      first element matching name
      Throws:
      TException
    • convertNodeToString

      public static String convertNodeToString(Node node) throws TransformerException
      Convert node to string
      Parameters:
      node - Node to be converted
      Returns:
      String
      Throws:
      TransformerException
    • getXalanTransformer

      public static TransformerFactory getXalanTransformer()