net.sf.maventaglib.util
Class XmlHelper

java.lang.Object
  extended by net.sf.maventaglib.util.XmlHelper

public class XmlHelper
extends java.lang.Object

Version:
$Revision: 206 $ ($Author: fgiust $)
Author:
fgiust

Constructor Summary
XmlHelper()
           
 
Method Summary
protected static void applyXslt(java.io.File inputFile, java.lang.String stylesheet, java.io.File outputFile)
          Transform a file using the given xsl stylesheet.
protected static void applyXslt(javax.xml.transform.Source src, java.lang.String stylesheet, java.io.File outputFile)
          Apply an xsl stylesheet to a java.xml.tranform.Source.
static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
          Returns a DocumentBuilder instance.
protected static org.xml.sax.XMLReader getReader()
          Returns a XMLReader instance.
static java.lang.String getTextContent(org.w3c.dom.Node baseNode)
          Get Node text content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlHelper

public XmlHelper()
Method Detail

getDocumentBuilder

public static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
                                                            throws org.apache.maven.plugin.MojoExecutionException
Returns a DocumentBuilder instance.

Returns:
DocumentBuilder instance
Throws:
javax.xml.parsers.FactoryConfigurationError - if the parser is not configured
javax.xml.parsers.ParserConfigurationException - if the parser is not configured
org.apache.maven.plugin.MojoExecutionException

getReader

protected static org.xml.sax.XMLReader getReader()
                                          throws org.apache.maven.plugin.MojoExecutionException
Returns a XMLReader instance.

Returns:
XMLReader instance
Throws:
org.xml.sax.SAXException - for errors on building the sax parser
javax.xml.parsers.ParserConfigurationException - if a SAX parser is not configured
org.apache.maven.plugin.MojoExecutionException

applyXslt

protected static void applyXslt(javax.xml.transform.Source src,
                                java.lang.String stylesheet,
                                java.io.File outputFile)
                         throws org.apache.maven.plugin.MojoExecutionException,
                                javax.xml.transform.TransformerException
Apply an xsl stylesheet to a java.xml.tranform.Source.

Parameters:
src - Source
stylesheet - xslt used for transformation
outputFile - output file
Throws:
javax.xml.transform.TransformerException
java.lang.Exception - xml parsing/transforming exceptions
org.apache.maven.plugin.MojoExecutionException

applyXslt

protected static void applyXslt(java.io.File inputFile,
                                java.lang.String stylesheet,
                                java.io.File outputFile)
                         throws org.apache.maven.plugin.MojoExecutionException
Transform a file using the given xsl stylesheet.

Parameters:
inputFile - input file
stylesheet - xslt used for transformation
outputFile - output file
Throws:
java.lang.Exception - xml parsing/transforming exceptions
org.apache.maven.plugin.MojoExecutionException

getTextContent

public static java.lang.String getTextContent(org.w3c.dom.Node baseNode)
                                       throws org.w3c.dom.DOMException
Get Node text content.

Parameters:
baseNode - The node.
Returns:
The text content of the node.
Throws:
org.w3c.dom.DOMException - Any DOM exceptions.


Copyright © 2004-2011 Fabrizio Giustina. All Rights Reserved.