net.groboclown.xml.resource.v1
Class DefaultXMLResource

java.lang.Object
  |
  +--net.groboclown.xml.resource.v1.DefaultXMLResource
All Implemented Interfaces:
IXMLResource

public class DefaultXMLResource
extends Object
implements IXMLResource

Simple class for implementing the IXMLResource. This class traps all tags and their attributes, and all children. These can be retrieved via queries to the public data.

Version:
Alpha 0.9.0
Author:
Matt Albrecht

Field Summary
 Attributes attributes
           
 IXMLResource[] children
           
 String[] knownData
           
 String localName
           
 IXMLResource parent
           
 String rawName
           
 String uri
           
 
Constructor Summary
DefaultXMLResource()
          Default constructor - required by IXMLResource contract.
 
Method Summary
 void initializeAttributesFromXML(String uri, String localName, String rawName, Attributes attributes, IXMLResource parent)
          Called when the instance is being initialized with XML attribute data.
 void initializeChildrenFromXML(IXMLResource[] children)
          Called when the instance is being initialized with its XML children.
 void initializeDataFromXML(char[] ch, int start, int length)
          Called when the instance is being initialized with XML character data.
 String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

localName

public String localName

rawName

public String rawName

uri

public String uri

attributes

public Attributes attributes

knownData

public String[] knownData

parent

public IXMLResource parent

children

public IXMLResource[] children
Constructor Detail

DefaultXMLResource

public DefaultXMLResource()
Default constructor - required by IXMLResource contract.
Method Detail

initializeAttributesFromXML

public void initializeAttributesFromXML(String uri,
                                        String localName,
                                        String rawName,
                                        Attributes attributes,
                                        IXMLResource parent)
                                 throws SAXException
Description copied from interface: IXMLResource
Called when the instance is being initialized with XML attribute data. At this point, the XML children nodes have not been initialized.
Specified by:
initializeAttributesFromXML in interface IXMLResource
Following copied from interface: net.groboclown.xml.resource.v1.IXMLResource
Parameters:
uri - the URI of the element tag's namespace.
localName - name of the XML element tag without the namespace.
rawName - full name of the XML element, with namespace.
attributes - list of all attributes and their values and types.
parent - the parent node who contains this node. Useful if the children need to register themselves with the parent. Can be null if this node has no parent.
Throws:
SAXException - thrown on any kind of error.

initializeDataFromXML

public void initializeDataFromXML(char[] ch,
                                  int start,
                                  int length)
                           throws SAXException
Description copied from interface: IXMLResource
Called when the instance is being initialized with XML character data. At this point, the XML children nodes have not been initialized.
Specified by:
initializeDataFromXML in interface IXMLResource
Following copied from interface: net.groboclown.xml.resource.v1.IXMLResource
Parameters:
ch - a part of the XML data. It should never be used outside the boundaries of the other parameters.
start - the start of the character data ch where this data is found.
length - the length of the character data in ch where this data is found.
Throws:
SAXException - thrown on any kind of error.

initializeChildrenFromXML

public void initializeChildrenFromXML(IXMLResource[] children)
                               throws SAXException
Description copied from interface: IXMLResource
Called when the instance is being initialized with its XML children. This is the last method invoked on the instance during XML initialization by the XML resource loader, but parent nodes may invoke methods on it itself.
Specified by:
initializeChildrenFromXML in interface IXMLResource
Following copied from interface: net.groboclown.xml.resource.v1.IXMLResource
Parameters:
children - the IXMLResource instances loaded from the XML file, who were contained within this instance's XML start and end tags.
Throws:
SAXException - thrown on any kind of error.

toString

public String toString()
Overrides:
toString in class Object


Written under the LGPL