org.sbml.jsbml.xml.parsers
public abstract class AbstractReaderWriter extends java.lang.Object implements ReadingParser, WritingParser
| Modifier and Type | Field and Description |
|---|---|
private org.apache.log4j.Logger |
logger
A
Logger for this class. |
| Constructor and Description |
|---|
AbstractReaderWriter() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
createListOfChild(ListOf<?> listOf,
java.lang.String elementName) |
java.util.List<java.lang.Object> |
getListOfSBMLElementsToWrite(java.lang.Object sbase)
Returns the list of children of the
objectToWrite. |
abstract java.lang.String |
getNamespaceURI()
Return the namespace URI of the namespace parsed by this class.
|
abstract java.lang.String |
getShortLabel()
Returns the shortLabel of the namespace parsed by this class.
|
void |
processAttribute(java.lang.String elementName,
java.lang.String attributeName,
java.lang.String value,
java.lang.String uri,
java.lang.String prefix,
boolean isLastAttribute,
java.lang.Object contextObject)
Process the XML attribute and modify 'contextObject' in consequence.
|
void |
processCharactersOf(java.lang.String elementName,
java.lang.String characters,
java.lang.Object contextObject)
Process the text of a XML element and modify 'contextObject' in
consequence.
|
void |
processEndDocument(SBMLDocument sbmlDocument)
Process the end of the document.
|
boolean |
processEndElement(java.lang.String elementName,
java.lang.String prefix,
boolean isNested,
java.lang.Object contextObject)
Process the end of the element 'elementName'.
|
void |
processNamespace(java.lang.String elementName,
java.lang.String URI,
java.lang.String prefix,
java.lang.String localName,
boolean hasAttributes,
boolean isLastNamespace,
java.lang.Object contextObject)
Process the namespace and modify the contextObject in consequence.
|
abstract java.lang.Object |
processStartElement(java.lang.String elementName,
java.lang.String uri,
java.lang.String prefix,
boolean hasAttributes,
boolean hasNamespaces,
java.lang.Object contextObject)
Process the XML element and modify 'contextObject' in consequence.
|
static void |
processUnknownAttribute(java.lang.String attributeName,
java.lang.String value,
java.lang.String prefix,
java.lang.Object contextObject) |
void |
writeAttributes(SBMLObjectForXML xmlObject,
java.lang.Object sbmlElementToWrite)
Adds the XML attributes of the
sbmlElementToWrite to the attributes
HashMap of the xmlObject. |
void |
writeCharacters(SBMLObjectForXML xmlObject,
java.lang.Object sbmlElementToWrite)
Sets the characters of xmlObject depending on the sbml element to write.
|
void |
writeElement(SBMLObjectForXML xmlObject,
java.lang.Object sbmlElementToWrite)
Sets the name of xmlObject (if it is not set) to the element name of
sbmlElementToWrite.
|
void |
writeNamespaces(SBMLObjectForXML xmlObject,
java.lang.Object sbmlElementToWrite)
Sets the namespace of xmlObject (if it is not set) to the namespace of
sbmlElementToWrite.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetNamespacesgetNamespacespublic void processAttribute(java.lang.String elementName,
java.lang.String attributeName,
java.lang.String value,
java.lang.String uri,
java.lang.String prefix,
boolean isLastAttribute,
java.lang.Object contextObject)
ReadingParserFor example, if the contextObject is an instance of Reaction and the
attributeName is 'fast', this method will set the 'fast' variable of the
'contextObject' to 'value'. Then it will return the modified
Reaction instance.
processAttribute in interface ReadingParserelementName - the localName of the XML element.attributeName - the attribute localName of the XML element.value - the value of the XML attribute.prefix - the attribute prefixisLastAttribute - boolean value to know if this attribute is the last attribute of the
XML element.contextObject - the object to set or modify depending on the identity of the current
attribute. This object
represents the context of the XML attribute in the SBMLDocument.public void processCharactersOf(java.lang.String elementName,
java.lang.String characters,
java.lang.Object contextObject)
ReadingParserFor example, if the contextObject is an instance of
Creator and the elementName is 'Family',
this method will set the familyName of the 'contextObject' to the text
value. Then it will return the changed Creator
instance.
processCharactersOf in interface ReadingParserelementName - the localName of the XML element.characters - the text of this XML element.contextObject - the object to set or modify depending on the identity of the current
element. This object
represents the context of the XML element in the SBMLDocument.public void processEndDocument(SBMLDocument sbmlDocument)
ReadingParserprocessEndDocument in interface ReadingParsersbmlDocument - the final initialized SBMLDocument instance.public boolean processEndElement(java.lang.String elementName,
java.lang.String prefix,
boolean isNested,
java.lang.Object contextObject)
ReadingParserprocessEndElement in interface ReadingParserelementName - the localName of the XML element.prefix - the prefix of the XML element.isNested - boolean value to know if the XML element is a nested element.contextObject - the object to set or modify depending on the identity of the current
element. This object
represents the context of the XML element in the SBMLDocument.true to remove the contextObject from the stack, if
false is returned the contextObject will stay on top
of the stackpublic void processNamespace(java.lang.String elementName,
java.lang.String URI,
java.lang.String prefix,
java.lang.String localName,
boolean hasAttributes,
boolean isLastNamespace,
java.lang.Object contextObject)
ReadingParserFor example, if the contextObject is an instance of SBMLDocument, the namespaces will be stored in the SBMLNamespaces HashMap of this SBMLDocument.
processNamespace in interface ReadingParserelementName - the localName of the XML element.URI - the URI of the namespaceprefix - the prefix of the namespace.localName - the localName of the namespace.hasAttributes - boolean value to know if there are attributes after the namespace
declarations.isLastNamespace - boolean value to know if this namespace is the last namespace of
this element.contextObject - the object to set or modify depending on the identity of the current
element. This object
represents the context of the XML element in the SBMLDocument.public abstract java.lang.Object processStartElement(java.lang.String elementName,
java.lang.String uri,
java.lang.String prefix,
boolean hasAttributes,
boolean hasNamespaces,
java.lang.Object contextObject)
ReadingParserFor example, if the contextObject is an instance of Event and the
elementName is 'trigger', this method will create a new Trigger instance
and will set the trigger instance of the 'contextObject' to the new
Trigger. Then the method will return the new Trigger instance which is the
new environment.
processStartElement in interface ReadingParserelementName - the localName of the XML element to processprefix - the prefix of the XML element to processhasAttributes - boolean value to know if this XML element has attributes.hasNamespaces - boolean value to know if this XML element contains namespace
declarations.contextObject - the object to set or modify depending on the identity of the current
XML element. This object
represents the context of the XML element in the SBMLDocument.public java.util.List<java.lang.Object> getListOfSBMLElementsToWrite(java.lang.Object sbase)
WritingParserobjectToWrite.getListOfSBMLElementsToWrite in interface WritingParsersbase - the SBase component to write.SBase' contains. Represents
the list of subNodes of this SBase component.public static void processUnknownAttribute(java.lang.String attributeName,
java.lang.String value,
java.lang.String prefix,
java.lang.Object contextObject)
attributeName - value - prefix - contextObject - public void writeAttributes(SBMLObjectForXML xmlObject, java.lang.Object sbmlElementToWrite)
WritingParsersbmlElementToWrite to the attributes
HashMap of the xmlObject.writeAttributes in interface WritingParserxmlObject - contains the XML information about sbmlElement.sbmlElementToWrite - the SBase component to writepublic void writeCharacters(SBMLObjectForXML xmlObject, java.lang.Object sbmlElementToWrite)
WritingParserwriteCharacters in interface WritingParserxmlObject - contains the XML information about sbmlElement.sbmlElementToWrite - the SBase component to writepublic void writeElement(SBMLObjectForXML xmlObject, java.lang.Object sbmlElementToWrite)
WritingParserwriteElement in interface WritingParserxmlObject - contains the XML information about sbmlElement.sbmlElementToWrite - the SBase component to writepublic void writeNamespaces(SBMLObjectForXML xmlObject, java.lang.Object sbmlElementToWrite)
WritingParserwriteNamespaces in interface WritingParserxmlObject - contains the XML information about sbmlElement.sbmlElementToWrite - the SBase component to writeprotected java.lang.Object createListOfChild(ListOf<?> listOf, java.lang.String elementName)
listOf - elementName - public abstract java.lang.String getShortLabel()
public abstract java.lang.String getNamespaceURI()