org.jcae.mesh.xmldata
Class XMLHelper

java.lang.Object
  extended by org.jcae.mesh.xmldata.XMLHelper

public class XMLHelper
extends java.lang.Object

Some methods to help using DOM


Constructor Summary
XMLHelper()
           
 
Method Summary
static java.lang.String canonicalize(java.lang.String path)
          Removes useless path components.
static java.lang.String canonicalize(java.lang.String dir, java.lang.String file)
          Removes useless path components.
static org.w3c.dom.Document parseXML(java.io.File file)
          Read an XML file with DTD validation.
static org.w3c.dom.Element parseXMLString(org.w3c.dom.Document document, java.lang.String string)
          Parse a valid xml string and return the Element representing this string.
static void writeXML(org.w3c.dom.Document document, java.io.File file)
          Write a DOM to a file.
 
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

parseXML

public static org.w3c.dom.Document parseXML(java.io.File file)
                                     throws javax.xml.parsers.ParserConfigurationException,
                                            org.xml.sax.SAXException,
                                            java.io.IOException
Read an XML file with DTD validation. Use ClassPathEntityResolver to solve URI. Return a normalized Document

Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

parseXMLString

public static org.w3c.dom.Element parseXMLString(org.w3c.dom.Document document,
                                                 java.lang.String string)
                                          throws javax.xml.parsers.ParserConfigurationException,
                                                 org.xml.sax.SAXException,
                                                 java.io.IOException
Parse a valid xml string and return the Element representing this string.

Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

writeXML

public static void writeXML(org.w3c.dom.Document document,
                            java.io.File file)
                     throws java.io.IOException,
                            java.io.FileNotFoundException
Write a DOM to a file.

Throws:
java.io.IOException
java.io.FileNotFoundException

canonicalize

public static java.lang.String canonicalize(java.lang.String path)
Removes useless path components.


canonicalize

public static java.lang.String canonicalize(java.lang.String dir,
                                            java.lang.String file)
Removes useless path components.