uk.org.iscream.cms.util
Class XMLStringParser

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byuk.org.iscream.cms.util.XMLStringParser
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class XMLStringParser
extends DefaultHandler

XMLStringParser - Used to assist in creating XMLPacket objects.

Version:
$Id: XMLStringParser.java,v 1.17 2003/02/05 14:27:59 tdb Exp $
Author:
$Author: tdb $

Field Summary
private  String _name
          This is the friendly identifier of the component this class is running in.
private  XMLPacket _packet
          A reference to the XMLPacket we are making
private  LinkedList _tagList
          A LinkedList of tags
 String REVISION
          The current CVS revision of this class
 
Constructor Summary
XMLStringParser()
          No-args constructor.
XMLStringParser(XMLPacket packet)
          Constructor for accepting a reference to an XMLPacket
 
Method Summary
 void characters(char[] buf, int offset, int len)
          Any text falling within a pair of terminal tags must be added to the XMLPacket.
 void endElement(String uri, String name, String qName)
          When an XML element is finished with, we must remove the tag name from the tagList and decrement the indent level.
private  String getPath()
          Return the heirarchical string to be used as a key value in the XMLPacket.
 XMLPacket getXMLPacket()
          Accessor to the XMLPacket.
 void startElement(String uri, String name, String qName, Attributes atts)
          Add each tag's attribute to the XMLPacket.
 String toString()
          Overrides the Object.toString() method to provide clean logging (every class should have this).
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public final String REVISION
The current CVS revision of this class

See Also:
Constant Field Values

_tagList

private LinkedList _tagList
A LinkedList of tags


_packet

private XMLPacket _packet
A reference to the XMLPacket we are making


_name

private String _name
This is the friendly identifier of the component this class is running in. eg, a Filter may be called "filter1", If this class does not have an owning component, a name from the configuration can be placed here. This name could also be changed to null for utility classes.

Constructor Detail

XMLStringParser

public XMLStringParser()
No-args constructor. Generally not used.


XMLStringParser

public XMLStringParser(XMLPacket packet)
Constructor for accepting a reference to an XMLPacket

Method Detail

startElement

public void startElement(String uri,
                         String name,
                         String qName,
                         Attributes atts)
Add each tag's attribute to the XMLPacket. Note that all attributes within an opening tag are stored as "someroot.sometag.attributes.attribute_name" E.g. If is the root node, then: is stored as: "packet.attributes.machine_name" within the XMLPacket.


endElement

public void endElement(String uri,
                       String name,
                       String qName)
When an XML element is finished with, we must remove the tag name from the tagList and decrement the indent level.


characters

public void characters(char[] buf,
                       int offset,
                       int len)
                throws SAXException
Any text falling within a pair of terminal tags must be added to the XMLPacket. Trim leading and trailing spaces and do not bother to add if there is no data specified within the tags.

Throws:
SAXException

toString

public String toString()
Overrides the Object.toString() method to provide clean logging (every class should have this). This uses the uk.org.iscream.cms.server.util.NameFormat class to format the toString()

Returns:
the name of this class and its CVS revision

getPath

private String getPath()
Return the heirarchical string to be used as a key value in the XMLPacket.


getXMLPacket

public XMLPacket getXMLPacket()
Accessor to the XMLPacket.



Copyright © 2000-2003 i-scream. All Rights Reserved.