Class XmlUtil


  • public final class XmlUtil
    extends java.lang.Object
    General-purpose methods for manipulating URIs and XML schema types
    Author:
    Mark Woodbridge
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String fixEntityNames​(java.lang.String value)
      Replace greek character entity names with entity names that work in HTML.
      static java.lang.String getFragmentFromURI​(java.lang.String uri)
      Return the fragment portion of a URI string (i.e.
      static java.lang.String indentXmlSimple​(java.lang.String xmlString)
      Apply some indentiation to some XML.
      • Methods inherited from class java.lang.Object

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

      • getFragmentFromURI

        public static java.lang.String getFragmentFromURI​(java.lang.String uri)
        Return the fragment portion of a URI string (i.e. everything after a #).
        Parameters:
        uri - a uri string
        Returns:
        the fragment or original uri if no # present
      • indentXmlSimple

        public static java.lang.String indentXmlSimple​(java.lang.String xmlString)
        Apply some indentiation to some XML. This method is not very sophisticated and will not cope well with anything but the simplest XML (no CDATA etc). The algorithm used does not look at element names and does not actually parse the XML. It also assumes that the forward slash and greater-than at the end of a self-terminating tag and not seperated by any whitespace.
        Parameters:
        xmlString - input XML fragment
        Returns:
        indented XML fragment
      • fixEntityNames

        public static java.lang.String fixEntityNames​(java.lang.String value)
        Replace greek character entity names with entity names that work in HTML.
        Parameters:
        value - input string
        Returns:
        string with replacements