org.xmlcml.cml
Class CMLDOMSAXBuilderImpl
java.lang.Object
|
+--org.xml.sax.HandlerBase
|
+--uk.co.demon.ursus.dom.SAXAdapter
|
+--uk.co.demon.ursus.dom.SAXDOMBuilder
|
+--org.xmlcml.cml.CMLDOMSAXBuilderImpl
- Direct Known Subclasses:
- DefaultCMLDOMSAXBuilder
- public class CMLDOMSAXBuilderImpl
- extends SAXDOMBuilder
- implements CMLDOMSAXBuilder
Builds a CMLDOM from SAX events
| Fields inherited from class uk.co.demon.ursus.dom.SAXAdapter |
AELFRED,
defaultParserClassName,
defaultParserType,
DXP,
LARK,
MSXML,
nParserTypes,
parser,
parserTypeStrings,
reader,
urlString,
XERCESNV,
XERCESSAX,
XML4J,
XP |
|
Method Summary |
void |
characters(char[] ch,
int start,
int length)
Receive notification of character data inside an element. |
void |
endDocument()
end of document. |
void |
endElement(java.lang.String name)
end of Element. |
CMLDocument |
getCMLDocument()
|
static void |
main(java.lang.String[] args)
Main entry point for an application. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Receive notification of a processing instruction. |
protected void |
runExecute()
finds and runs any elements |
void |
startDocument()
Receive notification of the beginning of the document. |
void |
startElement(java.lang.String name,
org.xml.sax.AttributeList attributes)
Receive notification of the start of an element. |
void |
test(CMLBase cmlBase)
called from embedded commands in CML file |
| Methods inherited from class uk.co.demon.ursus.dom.SAXAdapter |
addAttributes,
attributeString,
elementCounter,
error,
fatalError,
getErrorMessage,
ignorableWhitespace,
notationDecl,
parse,
parse,
parse,
resolveEntity,
setDocumentLocator,
setParser,
setParser,
unparsedEntityDecl,
warning |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
cmlDocument
protected CMLDocument cmlDocument
CMLDOMSAXBuilderImpl
public CMLDOMSAXBuilderImpl()
- default parser used
CMLDOMSAXBuilderImpl
public CMLDOMSAXBuilderImpl(java.lang.String parserClassName)
throws java.lang.Exception
- specific parser name used
CMLDOMSAXBuilderImpl
public CMLDOMSAXBuilderImpl(org.xml.sax.Parser parser)
throws java.lang.Exception
- specific parser used
startDocument
public void startDocument()
throws org.xml.sax.SAXException
- Description copied from class: SAXAdapter
- Receive notification of the beginning of the document.
By default, do nothing. Application writers may override this
method in a subclass to take specific actions at the beginning
of a document (such as allocating the root node of a tree or
creating an output file).
- Overrides:
- startDocument in class SAXDOMBuilder
- Throws:
- org.xml.sax.SAXException - IO problems or parsing errors
endDocument
public void endDocument()
throws org.xml.sax.SAXException
- end of document. Default actions are:
- processDescendants() for complete document. Although most elements
are processed at creation (and processFlag then = false), some (e.g. Bonds from BondArray) may
need to be reprocessed. Only elements with processFlag=true are processed
- runExecute()
- Overrides:
- endDocument in class SAXDOMBuilder
- Throws:
- org.xml.sax.SAXException - IO problems or parsing errors
runExecute
protected void runExecute()
throws java.lang.Exception
- finds and runs any elements
startElement
public void startElement(java.lang.String name,
org.xml.sax.AttributeList attributes)
throws org.xml.sax.SAXException
- Description copied from class: SAXAdapter
- Receive notification of the start of an element.
By default, do nothing. Application writers may override this
method in a subclass to take specific actions at the start of
each element (such as allocating a new tree node or writing
output to a file).
- Overrides:
- startElement in class SAXDOMBuilder
- Parameters:
name - The element type name.attributes - The specified or defaulted attributes.- Throws:
- org.xml.sax.SAXException - IO problems or parsing errors
- See Also:
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)
endElement
public void endElement(java.lang.String name)
throws org.xml.sax.SAXException
- end of Element. Special actions (in order):
- processDOM()
- appends element to parent using newElement.appendTo(parent).
This allows for element-specific additons (or non-additions)
- Overrides:
- endElement in class SAXDOMBuilder
- Parameters:
name - The element type name.- Throws:
- org.xml.sax.SAXException - IO problems or parsing errors
characters
public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
- Description copied from class: SAXAdapter
- Receive notification of character data inside an element.
By default, do nothing. Application writers may override this
method to take specific actions for each chunk of character data
(such as adding the data to a node or buffer, or printing it to
a file).
- Overrides:
- characters in class SAXDOMBuilder
- 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 - IO problems or parsing errors
- See Also:
DocumentHandler.characters(char[], int, int)
processingInstruction
public void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
- Description copied from class: SAXAdapter
- Receive notification of a processing instruction.
By default, do nothing. Application writers may override this
method in a subclass to take specific actions for each
processing instruction, such as setting status variables or
invoking other methods.
- Overrides:
- processingInstruction in class SAXDOMBuilder
- Parameters:
target - The processing instruction target.data - The processing instruction data, or null if
none is supplied.- Throws:
- org.xml.sax.SAXException - IO problems or parsing errors
- See Also:
DocumentHandler.processingInstruction(java.lang.String, java.lang.String)
getCMLDocument
public CMLDocument getCMLDocument()
- Specified by:
- getCMLDocument in interface CMLDOMSAXBuilder
test
public void test(CMLBase cmlBase)
- called from embedded commands in CML file
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Main entry point for an application.
- Throws:
- java.lang.Exception - almost anything in the galaxy could go wrong