com.flexiblewebsolutions.xml.util
Class XMLStringParser

java.lang.Object
  extended by com.flexiblewebsolutions.xml.util.XMLStringParser

public class XMLStringParser
extends java.lang.Object

Pulls values from an xml file using a simple XML parser.

Author:
Donavon Buss

Constructor Summary
XMLStringParser()
           
 
Method Summary
static java.lang.String[] getAllNestedTags(java.lang.String pXmlString)
          Retrieves all tags nested within the tol level of the XML string.
static java.lang.String getEntireTag(java.lang.StringBuffer pXML, int pStartIndex, java.lang.String pStartTag)
          Retreive entire xml tag, ignoring embedded ending tags with same name.
static java.lang.String getEntireTag(java.lang.StringBuffer pXML, int pStartIndex, java.lang.String pEndTag, java.lang.String pStartTag)
          Retreive entire xml tag, ignoring embedded ending tags with same name
static java.lang.String[] getMatchingNestedTags(java.lang.String pXmlString, java.lang.String pTag)
          Retrieves the tags nested within the top level of the XML string matching a tag name.
static java.lang.String getValueForTag(java.lang.StringBuffer pString, java.lang.String pTag)
          Return the value for a single tag inside a xml block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLStringParser

public XMLStringParser()
Method Detail

getValueForTag

public static java.lang.String getValueForTag(java.lang.StringBuffer pString,
                                              java.lang.String pTag)
Return the value for a single tag inside a xml block.

Parameters:
pString - - XML string.
pTag - - Name of tag to retrieve value for
Returns:
Value of tag

getEntireTag

public static java.lang.String getEntireTag(java.lang.StringBuffer pXML,
                                            int pStartIndex,
                                            java.lang.String pEndTag,
                                            java.lang.String pStartTag)
Retreive entire xml tag, ignoring embedded ending tags with same name

Parameters:
pXML - XML String
pStartIndex - Location in XML to begin looking for tag.
pEndTag - Ending Tag
pStartTag - Starting XML tag
Returns:
Entire XML tag including start and end tag

getEntireTag

public static java.lang.String getEntireTag(java.lang.StringBuffer pXML,
                                            int pStartIndex,
                                            java.lang.String pStartTag)
Retreive entire xml tag, ignoring embedded ending tags with same name. End tag is determined.

Parameters:
pXML - XML String
pStartIndex - Location in XML to begin looking for tag.
pStartTag - Starting XML tag
Returns:
Entire XML tag including start and end tag

getMatchingNestedTags

public static java.lang.String[] getMatchingNestedTags(java.lang.String pXmlString,
                                                       java.lang.String pTag)
Retrieves the tags nested within the top level of the XML string matching a tag name.

Parameters:
pXmlString - XML string containing values.
pTag - Name of tag to find values for.
Returns:
Array of Tag values.

getAllNestedTags

public static java.lang.String[] getAllNestedTags(java.lang.String pXmlString)
Retrieves all tags nested within the tol level of the XML string.

Parameters:
pXmlString - XML string containing values
Returns:
String array of tag values.


Copyright © -2005 . All Rights Reserved.