ru.sstu.xml
Class DomUtil

java.lang.Object
  extended by ru.sstu.xml.DomUtil

public final class DomUtil
extends Object

DomUtil class helps working with XML Documents.

Since:
XML 1.0
Author:
Denis A. Murashev, Victor Lushchenko, Alexey Maletz, Kirill V. Ovchinnikov

Method Summary
static Document create()
          Creates new XML document.
static Document open(InputStream input)
          Generates DOM from given InputStream.
static Document open(String fileName)
          Generates DOM from given file.
static void save(Node document, OutputStream output)
          Writes document to output stream.
static void save(Node document, String fileName)
          Saves document to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static Document create()
                       throws XmlException
Creates new XML document.

Returns:
created document
Throws:
XmlException - if cannot create document

open

public static Document open(InputStream input)
                     throws XmlException
Generates DOM from given InputStream.

Parameters:
input - InputStream to read from
Returns:
Document generated from file
Throws:
XmlException - if cannot open document

open

public static Document open(String fileName)
                     throws XmlException
Generates DOM from given file.

Parameters:
fileName - name of file to read
Returns:
Document generated from file
Throws:
XmlException - if cannot open document

save

public static void save(Node document,
                        OutputStream output)
                 throws XmlException
Writes document to output stream.

Parameters:
document - document to be saved
output - output stream to save to
Throws:
XmlException - if cannot save document

save

public static void save(Node document,
                        String fileName)
                 throws XmlException
Saves document to a file.

Parameters:
document - document to be saved
fileName - file to save to
Throws:
XmlException - if cannot save document


Copyright © 2011 TFI branch of Engels Instutute of Technology. All Rights Reserved.