edu.stanford.nlp.ie.machinereading.common
Class DomReader

java.lang.Object
  extended by edu.stanford.nlp.ie.machinereading.common.DomReader
Direct Known Subclasses:
AceDomReader, AceSentenceSegmenter

public class DomReader
extends java.lang.Object

Generic DOM reader for an XML file


Constructor Summary
DomReader()
           
 
Method Summary
static java.lang.String getAttributeValue(org.w3c.dom.Node node, java.lang.String attributeName)
          Fetches the value of a given attribute
protected static org.w3c.dom.Node getChildByAttribute(org.w3c.dom.Node node, java.lang.String attributeName, java.lang.String attributeValue)
          Searches for children that have the given attribute
protected static org.w3c.dom.Node getChildByName(org.w3c.dom.Node node, java.lang.String name)
          Searches (recursively) for the first child that has the given name
protected static org.w3c.dom.Node getChildByNameAndAttribute(org.w3c.dom.Node node, java.lang.String name, java.lang.String attributeName, java.lang.String attributeValue)
          Searches for children that have the given name and attribute
protected static java.util.List<org.w3c.dom.Node> getChildrenByName(org.w3c.dom.Node node, java.lang.String name)
          Searches for all immediate children with the given name
static org.w3c.dom.Document readDocument(java.io.File f)
          Constructs one Document from an XML file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomReader

public DomReader()
Method Detail

getChildByName

protected static org.w3c.dom.Node getChildByName(org.w3c.dom.Node node,
                                                 java.lang.String name)
Searches (recursively) for the first child that has the given name


getChildrenByName

protected static java.util.List<org.w3c.dom.Node> getChildrenByName(org.w3c.dom.Node node,
                                                                    java.lang.String name)
Searches for all immediate children with the given name


getChildByAttribute

protected static org.w3c.dom.Node getChildByAttribute(org.w3c.dom.Node node,
                                                      java.lang.String attributeName,
                                                      java.lang.String attributeValue)
Searches for children that have the given attribute


getChildByNameAndAttribute

protected static org.w3c.dom.Node getChildByNameAndAttribute(org.w3c.dom.Node node,
                                                             java.lang.String name,
                                                             java.lang.String attributeName,
                                                             java.lang.String attributeValue)
Searches for children that have the given name and attribute


getAttributeValue

public static java.lang.String getAttributeValue(org.w3c.dom.Node node,
                                                 java.lang.String attributeName)
Fetches the value of a given attribute


readDocument

public static org.w3c.dom.Document readDocument(java.io.File f)
                                         throws java.io.IOException,
                                                org.xml.sax.SAXException,
                                                javax.xml.parsers.ParserConfigurationException
Constructs one Document from an XML file

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


Stanford NLP Group