org.sakaiproject.tool.assessment.qti.util
Class XmlUtil

java.lang.Object
  extended by org.sakaiproject.tool.assessment.qti.util.XmlUtil

public final class XmlUtil
extends Object

Copyright: Copyright (c) 2005

Organization: Sakai Project

Version:
$Id: XmlUtil.java 9274 2006-05-10 22:50:48Z daisyf@stanford.edu $
Author:
palcasi mods:, Rachel Gollub rgollub@stanford.edu, Ed Smiley esmiley@stanford.edu

Constructor Summary
XmlUtil()
           
 
Method Summary
static String convertStrforCDATA(String myString)
           
static Document createDocument()
          Create document object
static Document createDocument(String xmlString)
          Create document object from XML string
static Transformer createTransformer(Document stylesheet)
          Create a transformer from a stylesheet
static Transformer createTransformer(DOMSource source)
          Create a transformer from a stylesheet
static DOMSource getDocumentSource(javax.servlet.ServletContext context, String path)
           
static String getDOMString(Node node)
          Get a textual representation of a Node.
static String processFormattedText(org.apache.commons.logging.Log log, String value)
           
static Document readDocument(javax.servlet.ServletContext context, String path)
          Read document from ServletContext/context path
static Document readDocument(String path)
          Read document from within spring context path
static Document readDocument(String path, boolean trim)
          This more forgiving version skips blank lines if trim = true Otherwise it does a direct parse of the file.
static Document transformDocument(Document document, Document stylesheet)
          Transform one document into another
static Document transformDocument(Document document, Transformer transformer)
           
static void transformNode(Node source, Node result, Transformer transformer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)

readDocument

public static Document readDocument(String path,
                                    boolean trim)
                             throws ParserConfigurationException,
                                    SAXException,
                                    IOException
This more forgiving version skips blank lines if trim = true Otherwise it does a direct parse of the file.

Parameters:
path - file path
trim - trim blank lines true/false
Returns:
Throws:
ParserConfigurationException
SAXException
IOException

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

transformDocument

public static Document transformDocument(Document document,
                                         Transformer transformer)

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(org.apache.commons.logging.Log log,
                                          String value)

convertStrforCDATA

public static String convertStrforCDATA(String myString)


Copyright © 2005-2012 Sakai Project. All Rights Reserved.