ozone core API

org.ozoneDB.core.xml
Class XML2ObjectContentHandler

java.lang.Object
  extended byorg.ozoneDB.core.xml.XML2ObjectContentHandler
All Implemented Interfaces:
Consts, org.xml.sax.ContentHandler
Direct Known Subclasses:
HashtableContentHandler

public class XML2ObjectContentHandler
extends java.lang.Object
implements org.xml.sax.ContentHandler, Consts

This class handles the XML and transform it into an Object.

Version:
$Revision: 1.4 $
Author:
SMB

Field Summary
protected  XML2ObjectContentHandler CH
          CH (ContentHandler) is for handling a special part of the XML in a special ContentHandler.
static boolean debug
           
protected  XML2ObjectDelegate delegate
           
protected  org.xml.sax.Locator locator
           
protected static java.util.Hashtable objCache
          Cache for the ref-elements.
protected  java.util.Stack stack
          All objs, members, values etc are saved in this stack.
 
Fields inherited from interface org.ozoneDB.core.xml.Consts
ATTR_ID, ATTR_NAME, ATTR_PROXY_TYPE, ATTR_REF, ATTR_TYPE, ATTR_XLINK_HREF_LOCAL, ATTR_XLINK_HREF_RAW, ATTR_XLINK_NAMESPACE, ATTR_XLINK_TYPE_LOCAL, ATTR_XLINK_TYPE_RAW, ATTR_XLINK_TYPE_VALUE, REMOTE_ID, TAG_MEMBER, TAG_OBJ, TAG_SUPERCLASS, TAG_VALUE, TAG_VALUEARRAY, TAG_VALUEOBJ
 
Constructor Summary
XML2ObjectContentHandler()
           
XML2ObjectContentHandler(XML2ObjectDelegate delegate)
           
 
Method Summary
protected  java.lang.Object castValue(java.lang.String type, java.lang.String valueString)
          The method castValues casts the valueString into the real type.
 void characters(char[] ch, int start, int end)
          The method characters handles the text-elements.
 void endDocument()
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName)
          The method endElement handles all endElements.
 void endPrefixMapping(java.lang.String prefix)
           
protected  void handleMemberEndElement()
          The method handleMemberEndElement gets the finished MemberElement and the value from the stack and put it in the object.
protected  void handleMemberStartElement(org.xml.sax.Attributes atts)
          The method handleMemberStartElement creates a MemberElement and put it the stack.
protected  void handleObjEndElement()
          The method handleObjEndElement gets the finished Object from the stack.
protected  void handleObjStartElement(org.xml.sax.Attributes atts)
          The method handleObjStartElement creates a new object and put it in the stack.
protected  void handleOzoneProxyMember(org.xml.sax.Attributes atts)
          This methode handles an OzoneProxy member.
protected  void handleSuperclassEndElement()
          The method handleSuperclassEndElement pop the superclass in the stack.
protected  void handleSuperclassStartElement(org.xml.sax.Attributes atts)
          The method handleSuperclassStartElement creates a SuperclassElement and put into the stack.
protected  void handleValueArrayEndElement()
          The method handleValueArrayEndElement joins the values to an array.
protected  void handleValueArrayStartElement(org.xml.sax.Attributes atts)
          The method handleValueArrayStartElement creates a ValueArrayElement and put it in the stack.
protected  void handleValueEndElement()
          The method handleValueEndElement gets the ValueElement from the stack.
protected  void handleValueObjEndElement()
           
protected  void handleValueObjStartElement(org.xml.sax.Attributes atts)
          The method handleValueObjStartElement creates a ValueObjElement and put it in the stack.
 void handleValues(char[] ch, int start, int end)
          The method handleValues gets the ValueElement from the stack.
protected  void handleValueStartElement(org.xml.sax.Attributes atts)
          The method handleValueStartElement creates a ValueElement and put it the stack.
 void ignorableWhitespace(char[] ch, int start, int end)
           
protected  void memberEndElement()
          The method memberEndElement refers to handleMemberEndElement.
protected  void memberStartElement(org.xml.sax.Attributes atts)
          The method memberStartElement refers to handleMemberStartElement.
protected  void objEndElement()
          The method objEndElement refers to handleObjEndElement.
protected  void objStartElement(org.xml.sax.Attributes atts)
          The method objStartElement refers to handleObjStartElement.
 void processingInstruction(java.lang.String target, java.lang.String data)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
          The method setDocumentLocator sets the locator.
protected  void showStack(java.util.Stack s)
           
 void skippedEntity(java.lang.String name)
           
 void startDocument()
          Start Document parsing.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes atts)
          The method startElement handels all startElements.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
protected  void superclassEndElement()
          The method superclassEndElement refers to handleSuperclassEndElement.
protected  void superclassStartElement(org.xml.sax.Attributes atts)
          The method superclassStartElement refers to handleSuperclassStartElement.
protected  void valueArrayEndElement()
          The method valueArrayEndElement refers to handleValueArrayEndElement.
protected  void valueArrayStartElement(org.xml.sax.Attributes atts)
          The method valueArrayStartElement refers to handleValueArrayStartElement.
protected  void valueEndElement()
          The method valueEndElement refers to handleValueEndElement.
protected  void valueObjEndElement()
          The method valueObjEndElement refers to handleValueObjEndElement.
protected  void valueObjStartElement(org.xml.sax.Attributes atts)
          The method valueObjStartElement refers to handleValueObjStartElement.
protected  void values(char[] ch, int start, int end)
          The method values refers to handleValues.
protected  void valueStartElement(org.xml.sax.Attributes atts)
          The method valueStartElement refers to handleValueStartElement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static final boolean debug
See Also:
Constant Field Values

locator

protected org.xml.sax.Locator locator

objCache

protected static java.util.Hashtable objCache
Cache for the ref-elements.


stack

protected java.util.Stack stack
All objs, members, values etc are saved in this stack.


CH

protected XML2ObjectContentHandler CH
CH (ContentHandler) is for handling a special part of the XML in a special ContentHandler. (e.g. HashtableContentHandler)


delegate

protected XML2ObjectDelegate delegate
Constructor Detail

XML2ObjectContentHandler

public XML2ObjectContentHandler()

XML2ObjectContentHandler

public XML2ObjectContentHandler(XML2ObjectDelegate delegate)
Method Detail

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
The method setDocumentLocator sets the locator.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Parameters:
locator -

startDocument

public void startDocument()
Start Document parsing.

Specified by:
startDocument in interface org.xml.sax.ContentHandler

endDocument

public void endDocument()
Specified by:
endDocument in interface org.xml.sax.ContentHandler

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String rawName,
                         org.xml.sax.Attributes atts)
The method startElement handels all startElements. It refers to the methods, which process the individual startElement in detail.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI -
localName -
rawName - (the tagname)
atts - (the attributes of the tag)

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String rawName)
The method endElement handles all endElements. It refers to the methods, which process the individual endElement in detail.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI -
localName -
rawName - (the tagname)

characters

public void characters(char[] ch,
                       int start,
                       int end)
The method characters handles the text-elements.

Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
ch - (char-array)
start - (start of the array)
end - (end of the array)

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int end)
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

objStartElement

protected void objStartElement(org.xml.sax.Attributes atts)
The method objStartElement refers to handleObjStartElement.

Parameters:
atts - (the attributes)

memberStartElement

protected void memberStartElement(org.xml.sax.Attributes atts)
The method memberStartElement refers to handleMemberStartElement.

Parameters:
atts - (the attributes)

valueStartElement

protected void valueStartElement(org.xml.sax.Attributes atts)
The method valueStartElement refers to handleValueStartElement.

Parameters:
atts - (the attributes)

valueObjStartElement

protected void valueObjStartElement(org.xml.sax.Attributes atts)
The method valueObjStartElement refers to handleValueObjStartElement.

Parameters:
atts - (the attributes)

valueArrayStartElement

protected void valueArrayStartElement(org.xml.sax.Attributes atts)
The method valueArrayStartElement refers to handleValueArrayStartElement.

Parameters:
atts - (the attributes)

superclassStartElement

protected void superclassStartElement(org.xml.sax.Attributes atts)
The method superclassStartElement refers to handleSuperclassStartElement.

Parameters:
atts - (the attributes)

values

protected void values(char[] ch,
                      int start,
                      int end)
The method values refers to handleValues.

Parameters:
ch - (char-array)
start - (start of the array)
end - (end of the array)

objEndElement

protected void objEndElement()
The method objEndElement refers to handleObjEndElement.


memberEndElement

protected void memberEndElement()
The method memberEndElement refers to handleMemberEndElement.


valueEndElement

protected void valueEndElement()
The method valueEndElement refers to handleValueEndElement.


valueObjEndElement

protected void valueObjEndElement()
The method valueObjEndElement refers to handleValueObjEndElement.


valueArrayEndElement

protected void valueArrayEndElement()
The method valueArrayEndElement refers to handleValueArrayEndElement.


superclassEndElement

protected void superclassEndElement()
The method superclassEndElement refers to handleSuperclassEndElement.


handleObjStartElement

protected void handleObjStartElement(org.xml.sax.Attributes atts)
The method handleObjStartElement creates a new object and put it in the stack.

Parameters:
atts - (the attributes)

handleObjEndElement

protected void handleObjEndElement()
The method handleObjEndElement gets the finished Object from the stack.


handleOzoneProxyMember

protected void handleOzoneProxyMember(org.xml.sax.Attributes atts)
This methode handles an OzoneProxy member.

Parameters:
atts -

handleMemberStartElement

protected void handleMemberStartElement(org.xml.sax.Attributes atts)
The method handleMemberStartElement creates a MemberElement and put it the stack.

Parameters:
atts - (the attributes)

handleMemberEndElement

protected void handleMemberEndElement()
The method handleMemberEndElement gets the finished MemberElement and the value from the stack and put it in the object.


handleValueStartElement

protected void handleValueStartElement(org.xml.sax.Attributes atts)
The method handleValueStartElement creates a ValueElement and put it the stack.

Parameters:
atts - (the attributes)

handleValues

public void handleValues(char[] ch,
                         int start,
                         int end)
The method handleValues gets the ValueElement from the stack. All values in the ValueElement are saved as String.

Parameters:
ch - (char-array)
start - (start of the array)
end - (end of the array)

handleValueEndElement

protected void handleValueEndElement()
The method handleValueEndElement gets the ValueElement from the stack. It casts the value (as String) in the special type and put the real value in the stack back.


castValue

protected java.lang.Object castValue(java.lang.String type,
                                     java.lang.String valueString)
The method castValues casts the valueString into the real type.

Parameters:
type - (the type)
valueString - (start of the array)

handleValueObjStartElement

protected void handleValueObjStartElement(org.xml.sax.Attributes atts)
The method handleValueObjStartElement creates a ValueObjElement and put it in the stack. If the valueObj is from type java.util.Hashtable: -> new ContentHandler which creates a Hashtable (It is because of can not creating innerClasses!!)

Parameters:
atts - (the attributes)

handleValueObjEndElement

protected void handleValueObjEndElement()

handleValueArrayStartElement

protected void handleValueArrayStartElement(org.xml.sax.Attributes atts)
The method handleValueArrayStartElement creates a ValueArrayElement and put it in the stack.

Parameters:
atts - (the attributes)

handleValueArrayEndElement

protected void handleValueArrayEndElement()
The method handleValueArrayEndElement joins the values to an array.


handleSuperclassStartElement

protected void handleSuperclassStartElement(org.xml.sax.Attributes atts)
The method handleSuperclassStartElement creates a SuperclassElement and put into the stack.

Parameters:
atts - (the attributes)

handleSuperclassEndElement

protected void handleSuperclassEndElement()
The method handleSuperclassEndElement pop the superclass in the stack.


showStack

protected void showStack(java.util.Stack s)

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.