|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.ed.inf.utils.webutils.simpledomparser.XmlSearcher
public class XmlSearcher
Executes a search over a SimpleElement (an XML tree)
| Field Summary | |
|---|---|
static boolean |
m_debug
|
| Constructor Summary | |
|---|---|
XmlSearcher()
|
|
| Method Summary | |
|---|---|
static XmlNode |
depthFirstSearch(XmlNode xmlTree,
java.lang.String searchString,
java.lang.String attributeName,
java.io.File log)
Searches this tree in a depth first mode and returns the first node whose tag, text or attribute value matches the given string. |
static XmlNode |
depthFirstSearch(XmlNode xmlTree,
java.lang.String searchString,
java.lang.String attributeName,
java.io.File logFile,
int emergencyBrake,
int maxNumberOfChildren)
Searches this tree in a depth first mode and returns the first node whose tag, text or attribute value matches the given string. |
static XmlNode |
depthFirstSearchOfParent(XmlNode tree,
java.lang.String desiredTag,
java.lang.String attributeName)
|
static XmlNode |
depthFirstSearchOfParent(XmlNode xmlTree,
java.lang.String searchString,
java.lang.String attributeName,
java.io.File logFile,
int emergencyBrake,
int maxNumberOfChildren)
TODO duplicated code! depthFirstSearch ~ depthFirstSearchOfParent Searches this tree in a depth first mode and returns the *parent* of the first node whose tag, text or attribute value matches the given string. |
static boolean |
evaluateCondition(XmlNode element,
java.lang.String wantedString)
Check whether the desired string is either a tag or text for this element. |
static boolean |
evaluateCondition(XmlNode element,
java.lang.String wantedString,
java.lang.String attributeName)
Check whether the desired string is either a tag, text or an attribute *value* for this element. |
static java.util.LinkedList<XmlNode> |
getInternalBlocks(java.lang.String externalBlockTag,
XmlNode xmlTree,
java.io.File log)
Gets the children of a given xml tag |
static java.lang.String |
getTextFromChildElement(XmlNode xmlTree,
java.lang.String searchString,
java.lang.String attributeName,
java.io.File log)
Checks if child exists and returns its text |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static boolean m_debug
| Constructor Detail |
|---|
public XmlSearcher()
| Method Detail |
|---|
public static XmlNode depthFirstSearch(XmlNode xmlTree,
java.lang.String searchString,
java.lang.String attributeName,
java.io.File log)
searchString - the text to be foundattributeName - the attribute name (if available, but it can be null)
public static XmlNode depthFirstSearch(XmlNode xmlTree,
java.lang.String searchString,
java.lang.String attributeName,
java.io.File logFile,
int emergencyBrake,
int maxNumberOfChildren)
xmlTree - the tree to be searchedsearchString - the text to be found in a nodeattributeName - the attribute name (if available, but it can be null)logFile - a log file (if a file output for the log is desired, or null
to obtain a console printout)emergencyBrake - the number of tags to check before abandoning the search and
returning nullmaxNumberOfChildren - if a tag has more than this number of children, the children
will not be considered in the search
public static XmlNode depthFirstSearchOfParent(XmlNode tree,
java.lang.String desiredTag,
java.lang.String attributeName)
public static XmlNode depthFirstSearchOfParent(XmlNode xmlTree,
java.lang.String searchString,
java.lang.String attributeName,
java.io.File logFile,
int emergencyBrake,
int maxNumberOfChildren)
xmlTree - the tree to be searchedsearchString - the text to be found in a nodeattributeName - the attribute name (if available, but it can be null)logFile - a log file (if a file output for the log is desired, or null
to obtain a console printout)emergencyBrake - the number of tags to check before abandoning the search and
returning nullmaxNumberOfChildren - if a tag has more than this number of children, the children
will not be considered in the search
public static boolean evaluateCondition(XmlNode element,
java.lang.String wantedString)
element - wantedString -
public static boolean evaluateCondition(XmlNode element,
java.lang.String wantedString,
java.lang.String attributeName)
element - wantedString - attributeName - if the attribute name is specified, the method checks the
wanted string against the attribute value
public static java.util.LinkedList<XmlNode> getInternalBlocks(java.lang.String externalBlockTag,
XmlNode xmlTree,
java.io.File log)
externalBlockTag - the tag that identifies the block
public static java.lang.String getTextFromChildElement(XmlNode xmlTree,
java.lang.String searchString,
java.lang.String attributeName,
java.io.File log)
searchString - the tag or content string of the desired childattributeName - the attribute name (if available, but it can be null if a
search string is passed)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||