Class XmlUtil


  • public final class XmlUtil
    extends Object

    Copyright: Copyright (c) 2005

    Organization: Sakai Project

    Version:
    $Id$
    Author:
    palcasi mods:, Rachel Gollub rgollub@stanford.edu, Ed Smiley esmiley@stanford.edu
    • Constructor Detail

      • XmlUtil

        public XmlUtil()
    • Method Detail

      • createDocument

        public static Document createDocument()
        Create document object
        Returns:
        Document
      • createDocument

        public static Document createDocument​(String xmlString)
        Create document object from XML string
        Returns:
        Document
      • readDocument

        public static Document readDocument​(javax.servlet.ServletContext context,
                                            String path)
        Read document from ServletContext/context path
        Parameters:
        context - ServletContext
        path - path
        Returns:
        Document
      • readDocument

        public static Document readDocument​(String path)
        Read document from within spring context path
        Parameters:
        path - path
        Returns:
        Document
      • getDocumentSource

        public static DOMSource getDocumentSource​(javax.servlet.ServletContext context,
                                                  String path)
      • createTransformer

        public static Transformer createTransformer​(Document stylesheet)
        Create a transformer from a stylesheet
        Parameters:
        stylesheet - Document
        Returns:
        the Transformer
      • createTransformer

        public static Transformer createTransformer​(DOMSource source)
        Create a transformer from a stylesheet
        Parameters:
        source - DOMSource
        Returns:
        the Transformer
      • transformDocument

        public static Document transformDocument​(Document document,
                                                 Document stylesheet)
        Transform one document into another
        Parameters:
        document - source Document
        stylesheet - XSLT Document
        Returns:
        transformed Document
      • transformNode

        public static void transformNode​(Node source,
                                         Node result,
                                         Transformer transformer)
      • getDOMString

        public static String getDOMString​(Node node)
        Get a textual representation of a Node.
        Parameters:
        node - The Node
        Returns:
        the document in a text string
      • processFormattedText

        public static String processFormattedText​(String value)
      • convertoLTGT

        public static String convertoLTGT​(String value)
      • convertStrforCDATA

        @Deprecated
        public static String convertStrforCDATA​(String myString)
        Deprecated.
        use convertToSingleCDATA
        Parameters:
        myString -
        Returns:
      • convertToSingleCDATA

        public static String convertToSingleCDATA​(String text)