public class XMLProfileParser extends Object
FullTextIndexType| Constructor and Description |
|---|
XMLProfileParser()
Creates a parser instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
countDescendants(String elementName)
Counts the number of descendant elements with a specified element name
|
static String |
escapeForXML(String text)
Inserts Entity References in the place of certain illegal characters in
order to make an xml file valid
|
String |
getFieldByValue(String elementName)
Gets the #text element of the specified element in the current field.
|
String |
getFieldText(String fieldname)
Retreives the #text element of the first instance of
fieldname. |
String[] |
getFieldTextArray(String fieldname)
Retreives the #text elements of all instances of
fieldname. |
String[][] |
getSubFields()
Gets the (element name, #text value) pairs for all child nodes in the
current field.
|
boolean |
goChildElement(String elementName)
Sets the current node to the first child (of the current node) element
with a specified element name
|
boolean |
goParentElement(String elementName)
Sets the current node to the first ascendant (of the current node)
element with a specified element name
|
boolean |
goSiblingElement(String elementName)
Sets the current node to the first sibling (of the current node) element
with a specified element name
|
boolean |
hasDescendant(String elementName)
Determines whether the current node has one or more descendant elements
with a specified element name
|
boolean |
hasSibling(String elementName)
Determines whether the current node has one or more sibling elements with
a specified element name
|
void |
readDoc(String filename,
String schemaLocation)
Sets the current document to the parsed file.
|
void |
readInputStream(InputStream is,
String schemaLocation)
Sets the current document to the parsed InputStream.
|
void |
readString(String XMLString,
String schemaLocation)
Sets the current document to the parsed XML string.
|
boolean |
setNextField()
Sets current node to next node.
|
int |
setRootNode(String fieldname)
Sets the Field Node to the first child of the first instance of the field
matching the argument.
|
public void readString(String XMLString, String schemaLocation) throws Exception
XMLString - - the XML document.schemaLocation - - The loactaion of the schema.IndexException - - in case if failureExceptionpublic void readDoc(String filename, String schemaLocation) throws Exception
filename - - the name of the file to parse.schemaLocation - - the location of the schemaException - - in case of failure.public void readInputStream(InputStream is, String schemaLocation) throws Exception
is - - the input stream to parse.schemaLocation - - the location of the schema.Exception - - in case of failure.public String getFieldText(String fieldname) throws Exception
fieldname.fieldname - name of the element to retreiveException - - in case of failure.FullTextIndexTypepublic String[] getFieldTextArray(String fieldname) throws Exception
fieldname.fieldname - name of the element to retreiveException - - in case of failure.FullTextIndexTypepublic int setRootNode(String fieldname) throws Exception
setNextField()
and getFieldByValue(String
elementName) will give 2nd
layerd text.Exception - - in case of failure.public int countDescendants(String elementName)
elementName - String - the name of the elements to countint - the number of descendants with the specified
elementNamepublic boolean setNextField()
throws Exception
Exception - - in case of failure.setRootNode(String fieldname)public boolean goChildElement(String elementName)
elementName - String - the name of the element to go toboolean - true if the action was successfulpublic boolean goSiblingElement(String elementName)
elementName - String - the name of the element to go toboolean - true if the action was successfulpublic boolean goParentElement(String elementName)
elementName - String - the name of the element to go toboolean - true if the action was successfulpublic boolean hasDescendant(String elementName)
elementName - String - the element name to search forboolean - true if one or more descendants were
foundpublic boolean hasSibling(String elementName)
elementName - String - the element name to search forboolean - true if one or more siblings were foundpublic String getFieldByValue(String elementName) throws Exception
elementName - element identifierException - - in case of failure.setRootNode(String fieldname),
setNextField()public String[][] getSubFields() throws Exception
Exception - - in case of failure.setNextField(),
setRootNode(String fieldname)public static String escapeForXML(String text)
text - String - the xml file insert Entity References
intoString - a version of the xml file with Entity
References in the place of certain illegal charactersCopyright © 2014. All Rights Reserved.