com.metamatrix.common.xml.xmi
Class XMIContentHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.metamatrix.common.xml.xmi.XMIContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XMIContentHandler
extends org.xml.sax.helpers.DefaultHandler


Nested Class Summary
protected  class XMIContentHandler.BodyHandler
          Inner class to handle the XMI Body
 
Field Summary
protected  XMIContentHandler.BodyHandler bodyHandler
           
static java.lang.String HREF
           
static java.lang.String NAME
           
static java.lang.String XMI_CONTENT
           
static java.lang.String XMI_CONTENT_HANDLER
           
static java.lang.String XMI_ID
           
static java.lang.String XMI_ID_REF
           
static java.lang.String XMI_LABEL
           
static java.lang.String XMI_UUID
           
 
Constructor Summary
XMIContentHandler(XMIReaderAdapter adapter)
          Constructor: initializes two inner classes
 
Method Summary
 void characters(char[] characters, int start, int length)
          Called by the SAXParser when it encounters character data while processing an element.
 void endDocument()
          Called by the SAXParser when it reaches the end of the Document
 void endElement(java.lang.String uri, java.lang.String name, java.lang.String qName)
          Called by the SAXParser when it reaches an end Element tag
 void ignorableWhitespace(char[] characters, int start, int length)
           Capture ignorable whitespace as text.
static void read(java.io.InputStream stream, MessageList messages, XMIReaderAdapter adapter, boolean closeStream)
          Utility method to use SAX and this ContentHandler to read in XMI from the specified stream.
 void setXMIHeader(XMIHeader header)
          Method to set the XMIHeader attribute.
 void startDocument()
          Called by the SAXParser when it starts processing the Document
 void startElement(java.lang.String uri, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes atts)
          Called by the SAXParser when it reaches an start Element tag
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMI_CONTENT_HANDLER

public static final java.lang.String XMI_CONTENT_HANDLER
See Also:
Constant Field Values

XMI_UUID

public static final java.lang.String XMI_UUID
See Also:
Constant Field Values

XMI_ID

public static final java.lang.String XMI_ID
See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

HREF

public static final java.lang.String HREF
See Also:
Constant Field Values

XMI_LABEL

public static final java.lang.String XMI_LABEL
See Also:
Constant Field Values

XMI_ID_REF

public static final java.lang.String XMI_ID_REF
See Also:
Constant Field Values

XMI_CONTENT

public static final java.lang.String XMI_CONTENT
See Also:
Constant Field Values

bodyHandler

protected XMIContentHandler.BodyHandler bodyHandler
Constructor Detail

XMIContentHandler

public XMIContentHandler(XMIReaderAdapter adapter)
Constructor: initializes two inner classes

Method Detail

setXMIHeader

public void setXMIHeader(XMIHeader header)
Method to set the XMIHeader attribute. This method will create an EntityInfo object for the model. Called when the HeaderContentHandler finishes processing the XMIHeader.

Parameters:
XMIHeader - header, the XMIHeader

characters

public void characters(char[] characters,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Called by the SAXParser when it encounters character data while processing an element.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

ignorableWhitespace

public void ignorableWhitespace(char[] characters,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException

Capture ignorable whitespace as text. If setIgnoringElementContentWhitespace(true) has been called then this method does nothing.

Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Overrides:
ignorableWhitespace in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - [] - char array of ignorable whitespace
start - int - starting position within array
length - int - length of whitespace after start
Throws:
org.xml.sax.SAXException - when things go wrong

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Called by the SAXParser when it starts processing the Document

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Called by the SAXParser when it reaches the end of the Document

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String name,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Called by the SAXParser when it reaches an end Element tag

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
String - uri of the element
String - name of the element
String - qName of the element
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String name,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Called by the SAXParser when it reaches an start Element tag

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
String - uri of the element
String - name of the element
String - qName of the element
Attributes - atts of the elements
Throws:
org.xml.sax.SAXException

read

public static void read(java.io.InputStream stream,
                        MessageList messages,
                        XMIReaderAdapter adapter,
                        boolean closeStream)
                 throws org.xml.sax.SAXException,
                        java.io.IOException
Utility method to use SAX and this ContentHandler to read in XMI from the specified stream.

Throws:
org.xml.sax.SAXException
java.io.IOException


Copyright © 2009. All Rights Reserved.