org.ipdr.xml
Class IPDRXMLContentHandler

java.lang.Object
  extended by org.ipdr.xml.IPDRXMLContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler

public class IPDRXMLContentHandler
extends java.lang.Object
implements org.xml.sax.ContentHandler

This class implements the SAX ContentHandler interface and defines callback behavior for the SAX callbacks associated with an XML document's data.


Field Summary
protected  java.util.ArrayList attribute_
          To store the list of Attributes.
protected  int compLevel_
          To store the Composite Element's level.
protected  java.lang.String countAttrib_
          To store the number of IPDR docs
protected  java.lang.String endTimeAttrib_
          To store the End Time in IPDRDoc.End tag in XML document
protected  java.util.ArrayList headerAttribute_
          To store the list of Header Attributes
protected  java.util.ArrayList headerValue_
          To store the list of Header Attribute Values.
protected  java.util.HashMap listCompElements_
          To store the list of Composite XML Elements.
protected  java.util.ArrayList listXMLElements_
          To store the list of XML Elements.
protected  org.xml.sax.Locator locator_
          Locator object containing the location information.
protected  java.util.ArrayList schemaNameSpaces_
          To store the list of Schema NameSpaces
protected  java.util.ArrayList serviceDefURIs_
          To store the list of Service Definition URIs
protected  boolean tagFlag_
          Flag indicating seqNum and IPDRCreationTime fields are coming
protected  java.util.ArrayList type_
          To store the list of Service Types present in XML document
protected  java.util.ArrayList URIStorage_
          To store the NameSpace Information having URI and prefix
protected  XMLElement xmlElement_
          To store the XML Element being processed.
protected  java.lang.String xmlElementValue_
          To store the XML Element value
 
Constructor Summary
IPDRXMLContentHandler()
           
 
Method Summary
 void characters(char[] ch, int start, int end)
          This will report character data (within an element).
 void endDocument()
          This indicates the end of a Document parse - this occurs after all callbacks in all SAX Handlers.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName)
          Indicates the end of an element (</[element name]>) is reached.
 void endPrefixMapping(java.lang.String prefix)
          This indicates the end of a prefix mapping, when the namespace reported in a startPrefixMapping(java.lang.String, java.lang.String)callback is no longer available.
 java.lang.String getCountAttrib()
          Method to get the number of IPDR docs
 java.lang.String getEndTimeAttrib()
          Method to get the End Time in IPDRDoc.End
 java.util.ArrayList getHeaderAttribute()
          Method to get the list of Header Attributes
 java.util.ArrayList getHeaderValues()
          Methog to get the list of Header Attribute Values.
 java.util.ArrayList getListXMLElements()
          Method to get the final list of XML Elements.
 java.util.ArrayList getSchemaNSURIs()
          Method to get the list of Schema NameSpaces
 java.util.ArrayList getSDURIs()
          Method to get the lsit of Service Definition URIs
 java.util.ArrayList getServType()
          Method to get the list of Service Types
 java.util.ArrayList getURIStorage()
          Method to get the stored URIs from header
 void ignorableWhitespace(char[] ch, int start, int end)
          This will report whitespace that can be ignored in the originating document.
 void processingInstruction(java.lang.String target, java.lang.String data)
          This will indicate that a processing instruction (other than the XML declaration) has been encountered.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Provide reference to 'Locator' which provides information about where in a document callbacks occur.
 void skippedEntity(java.lang.String name)
          This will report an entity that is skipped by the parser.
 void startDocument()
          This indicates the start of a Document parse - this precedes all callbacks in all SAX Handlers with the sole exception of setDocumentLocator(org.xml.sax.Locator)>
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes atts)
          This reports the occurrence of an actual element.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          This will indicate the beginning of an XML Namespace prefix mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locator_

protected org.xml.sax.Locator locator_
Locator object containing the location information.


listXMLElements_

protected java.util.ArrayList listXMLElements_
To store the list of XML Elements.


xmlElement_

protected XMLElement xmlElement_
To store the XML Element being processed.


listCompElements_

protected java.util.HashMap listCompElements_
To store the list of Composite XML Elements.


attribute_

protected java.util.ArrayList attribute_
To store the list of Attributes.


URIStorage_

protected java.util.ArrayList URIStorage_
To store the NameSpace Information having URI and prefix


headerAttribute_

protected java.util.ArrayList headerAttribute_
To store the list of Header Attributes


headerValue_

protected java.util.ArrayList headerValue_
To store the list of Header Attribute Values.


serviceDefURIs_

protected java.util.ArrayList serviceDefURIs_
To store the list of Service Definition URIs


schemaNameSpaces_

protected java.util.ArrayList schemaNameSpaces_
To store the list of Schema NameSpaces


type_

protected java.util.ArrayList type_
To store the list of Service Types present in XML document


tagFlag_

protected boolean tagFlag_
Flag indicating seqNum and IPDRCreationTime fields are coming


compLevel_

protected int compLevel_
To store the Composite Element's level.


xmlElementValue_

protected java.lang.String xmlElementValue_
To store the XML Element value


countAttrib_

protected java.lang.String countAttrib_
To store the number of IPDR docs


endTimeAttrib_

protected java.lang.String endTimeAttrib_
To store the End Time in IPDRDoc.End tag in XML document

Constructor Detail

IPDRXMLContentHandler

public IPDRXMLContentHandler()
Method Detail

getListXMLElements

public java.util.ArrayList getListXMLElements()
Method to get the final list of XML Elements.

Returns:
The totalListXMLElements_ value

getURIStorage

public java.util.ArrayList getURIStorage()
Method to get the stored URIs from header

Returns:
the stored URIs

getHeaderAttribute

public java.util.ArrayList getHeaderAttribute()
Method to get the list of Header Attributes

Returns:
List of Header Attributes

getHeaderValues

public java.util.ArrayList getHeaderValues()
Methog to get the list of Header Attribute Values.

Returns:
List of Header Attribute Values

getSDURIs

public java.util.ArrayList getSDURIs()
Method to get the lsit of Service Definition URIs

Returns:
List of Service Definition URIs

getSchemaNSURIs

public java.util.ArrayList getSchemaNSURIs()
Method to get the list of Schema NameSpaces

Returns:
List of Schema NameSpaces

getServType

public java.util.ArrayList getServType()
Method to get the list of Service Types

Returns:
List of Service Types

getCountAttrib

public java.lang.String getCountAttrib()
Method to get the number of IPDR docs

Returns:
the number of IPDR docs

getEndTimeAttrib

public java.lang.String getEndTimeAttrib()
Method to get the End Time in IPDRDoc.End

Returns:
the End Time

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Provide reference to 'Locator' which provides information about where in a document callbacks occur.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Parameters:
locator - Locator object tied to callback process

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
This indicates the start of a Document parse - this precedes all callbacks in all SAX Handlers with the sole exception of setDocumentLocator(org.xml.sax.Locator)>

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException - when an exception occurs during parsing

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
This indicates the end of a Document parse - this occurs after all callbacks in all SAX Handlers.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException - when an exception occurs during parsing

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
This will indicate that a processing instruction (other than the XML declaration) has been encountered.

Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Parameters:
target - String target of PI
data - String containing all data sent to the PI. This typically looks like one or more attribute value pairs.
Throws:
org.xml.sax.SAXException - when an exception occurs during parsing

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
This will indicate the beginning of an XML Namespace prefix mapping. Although this typically occur within the root element of an XML document, it can occur at any point within the document. Note that a prefix mapping on an element triggers this callback before the callback for the actual element itself (startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)) occurs.

Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
prefix - String prefix used for the namespace being reported
uri - String URI for the namespace being reported

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
This indicates the end of a prefix mapping, when the namespace reported in a startPrefixMapping(java.lang.String, java.lang.String)callback is no longer available.

Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
prefix - String of namespace being reported

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String rawName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
This reports the occurrence of an actual element. It will include the element's attributes, with the exception of XML vocabulary specific attributes, such as xmlns:[namespace prefix] and xsi:schemaLocation

Specified by:
startElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - Namespace URI this element is associated with, or an empty string
localName - String XML 1.0 version of element name: [namespace prefix]:[localName]
rawName - String name of element (with no namespace prefix, if one is present)
atts - Attributes list for this element
Throws:
org.xml.sax.SAXException - when an exception occurs during parsing

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String rawName)
                throws org.xml.sax.SAXException
Indicates the end of an element (</[element name]>) is reached. Note that the parser does not distinguish between empty elements and non-empty elements, so this will occur uniformly.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - Namespace URI this element is associated with, or an empty string
localName - String XML 1.0 version of element name: [namespace prefix]:[localName]
rawName - String name of element (with no namespace prefix, if one is present)
Throws:
org.xml.sax.SAXException - when an exception occurs during parsing

characters

public void characters(char[] ch,
                       int start,
                       int end)
                throws org.xml.sax.SAXException
This will report character data (within an element).

Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
ch - Character array with character data
start - Index in array where data starts.
end - Index in array where data ends.
Throws:
org.xml.sax.SAXException - when an exception occurs during parsing

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int end)
                         throws org.xml.sax.SAXException
This will report whitespace that can be ignored in the originating document. This is typically only invoked when validation is ocurring in the parsing process.

Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Parameters:
ch - Character array with character data
start - Index in array where data starts.
end - Index in array where data ends.
Throws:
org.xml.sax.SAXException - when an exception occurs during parsing

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
This will report an entity that is skipped by the parser. This should only occur for non-validating parsers, and then is still implementation-dependent behavior.

Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Parameters:
name - String name of entity being skipped
Throws:
org.xml.sax.SAXException - when an exception occurs during parsing