Class XMLHelper

java.lang.Object
org.graffiti.plugin.XMLHelper
All Implemented Interfaces:
HelperClass

public class XMLHelper
extends Object
implements HelperClass
Contains some (static) auxiliary methods for writing XML.
  • Field Details

    • useIndentation

      public static boolean useIndentation
      Indicates whether or not indent XML elements.
  • Constructor Details

    • XMLHelper

      public XMLHelper()
  • Method Details

    • getDelimiter

      public static String getDelimiter()
      Returns a string used to separate XML elements for better readability.
      Returns:
      XML element delimiter string
    • spc

      public static String spc​(int n)
      Returns a String containing n spaces (or the empty String if useIndentation is set to false).
      Parameters:
      n - number of spaces
      Returns:
      DOCUMENT ME!
    • getOuterXml

      public static String getOuterXml​(Node node) throws TransformerException
      Throws:
      TransformerException
    • getOuterXmlPretty

      public static String getOuterXmlPretty​(Node n) throws IOException, TransformerException, org.jdom2.JDOMException
      Throws:
      IOException
      TransformerException
      org.jdom2.JDOMException
    • getJDOMfromDOM

      public static org.jdom2.Document getJDOMfromDOM​(Document doc)
    • getXMLnodeFromString

      public static Node getXMLnodeFromString​(String xmlString)
      Parameters:
      xmlString -
      Returns:
    • getDocumentFromXMLstring

      public static Document getDocumentFromXMLstring​(String res)
      Parameters:
      res -
      Returns:
    • getDocument

      public static Document getDocument​(InputStream inpS)
    • validate

      public static void validate​(Document doc, URL xsdLocation) throws Exception
      Throws:
      Exception
    • writeXMLDataToFile

      public static void writeXMLDataToFile​(Document doc, String path_and_filename)