hibergui.generator.tool.xml
Class XMLReader

java.lang.Object
  extended by hibergui.generator.tool.xml.XMLReader
Direct Known Subclasses:
ConfigReader, MappingReader

 class XMLReader
extends java.lang.Object

Reads and validates given XML source stream.

Author:
Csaba Gyenge

Field Summary
private  javax.xml.transform.dom.DOMSource source
           
 
Constructor Summary
protected XMLReader(java.io.InputStream inputStream, java.io.InputStream DTD)
          Process given stream which contains XML structure.
 
Method Summary
protected  javax.xml.transform.dom.DOMSource getDOM()
           
protected  org.w3c.dom.Node getNode(short nodeType, org.w3c.dom.Node node, java.lang.String nodePath, java.lang.String attribute)
          This is a general method to get given node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

private javax.xml.transform.dom.DOMSource source
Constructor Detail

XMLReader

protected XMLReader(java.io.InputStream inputStream,
                    java.io.InputStream DTD)
             throws javax.xml.parsers.ParserConfigurationException,
                    org.xml.sax.SAXException,
                    java.io.IOException
Process given stream which contains XML structure. Validate it by DTD which is defined in DOCTYPE or if it doesn't exist validate it by given DTD. Finally put the result into the source variable

Parameters:
inputStream - Stream which is contains an XML structure.
DTD - Stream which is contains DTD. Specify null if you don't want to provide a secondary DTD document.
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
Method Detail

getDOM

protected javax.xml.transform.dom.DOMSource getDOM()

getNode

protected org.w3c.dom.Node getNode(short nodeType,
                                   org.w3c.dom.Node node,
                                   java.lang.String nodePath,
                                   java.lang.String attribute)
This is a general method to get given node.

Parameters:
nodeType - Type of the target node.
node - Root of searching.
nodePath - Path to the target node from the root node. For example if you want to get the node called targetnode and the node called child is child of the node which is specified in second parameter then value of this parameter will be child.grandchild.targetnode
attribute - If you want to get the attribute of target node, then set the name of attribute here, otherwise set it to null.