AdmitParser — Specialized parser for ADMIT XML files.

This module defines the AdmitParser class.

class admit.xmlio.AdmitParser.AdmitParser(basedir='', xmlFile='admit.xml')[source]

Specialized XML parser for admit and bdp parsing.

Parameters:

basedir : str

The base directory being used to read in the ADMIT files.

xmlFile : str

The file to parse. Deafult: “admit.xml”.

Attributes

xmlFile (str) The file to parse.
basedir (str) The base directory being used to read in the ADMIT files.
dtd (DtdReader) Instance of the DtdReader to use.
AT (List) List for keeping track of the AT’s found.
curAT (AT) Instance of the current AT being reconstructed.
type (str) Type of the curAT.
name (str) Name of the current node being parsed.
ndarr (List) List of elements that are numpy arrays.
sets (List) List of elements that are sets.
userData (Dict) Dictionary for the user data.
summaryData (Dict) Dictionary for the summaryData.
summaryEntry (SummaryEntry) Current instance of the SummaryEntry being reconstructed.
flowmanager (FlowManager) Local copy of the FlowManager for reconstruction.
projmanager (Dict) Project ID to base directory map.
Util (various classes) The current utility class being reconstructed.
MultiImage (MultiImage class instance) The current MultiImage being reconstructed.
inflow (Boolean) Whether the parser is currently reconstructing the flow manager.
inAdmit (Boolean) Whether the parser is currently reconstructing the ADMIT base class.
inUtil (Boolean) Whether the parser is currently reconstructing a utility class.
inMulti (Boolean) Whether the parser is currently reconstructung a MultiImage.
inKeys (Boolean) Whether the parser is currently reconstructing the keys of an AT.
inSummary (Boolean) Whether the parser is currently reconstructing the summary data.
inSummaryEntry (Boolean) Whether the parser is currently reconstructing a SummaryEntry.
utilType (str) The type of the current utility class being reconstructed.
utilName (str) The name of the current utility class being reconstructed.
multiName (str) The name of the MultiImage currently being reconstructed.
summaryName (str) The name of the summary being reconstructed.
summaryEntryName (str) The name of the SummaryEntry being reconstructed.
admit (ADMIT) The base class being reconstructed.
metadataName (str) The name of the current metadata node.
inBDP (Boolean) Whether the parser is currently reconstructing a BDP.
inAT (Boolean) Whether the parser is currently reconstructing an AT.
tempdata (str) String for holding large data that need to be reconstructed.

Methods

characters(ch) Method called whenever characters are detected in an xml node This method does some dtd validation.
close() Method to close out the reader, called only by the sax parser
endDocument() Receive notification of the end of a document.
endElement(name) Method called whenever the end of an xml element is reached.
endElementNS(name, qname) Signals the end of an element in namespace mode.
endPrefixMapping(prefix) End the scope of a prefix-URI mapping.
getAT() Return the list of reconstructed AT’s
getBDP() Return the current BDP
getData(item) Method used to convert string to designated type.
getattr(target, name) Method to get the value of a specific data member from the given class
getflowmanager() Returns the FlowManager instance
ignorableWhitespace(whitespace) Receive notification of ignorable whitespace in element content.
processingInstruction(target, data) Receive notification of a processing instruction.
setDocumentLocator(locator) Called by the parser to give the application a locator for locating the origin of document events.
setadmit(admit) Set the base class to the given class
setattr(target, name, value) Method to set attributes in a class
skippedEntity(name) Receive notification of a skipped entity.
startDocument() Receive notification of the beginning of a document.
startElement(name, attrib) Method called whenever a new element is found.
startElementNS(name, qname, attrs) Signals the start of an element in namespace mode.
startPrefixMapping(prefix, uri) Begin the scope of a prefix-URI Namespace mapping.
characters(ch)[source]

Method called whenever characters are detected in an xml node This method does some dtd validation. This method is only called by the SAX parser iteself.

Parameters:ch : unicode characters
Returns:None
close()[source]

Method to close out the reader, called only by the sax parser

Parameters:None
Returns:None
endElement(name)[source]

Method called whenever the end of an xml element is reached. This method is only called by the SAX parser iteself.

Parameters:

name : str

The name of the node that just ended

Returns:

None

getAT()[source]

Return the list of reconstructed AT’s

Parameters:None
Returns:List of AT’s
getBDP()[source]

Return the current BDP

Parameters:None
Returns:The current BDP
getData(item)[source]

Method used to convert string to designated type.

Parameters:

input: str

The string to convert

Returns:

Various types, based on the expected type of the xml node

getattr(target, name)[source]

Method to get the value of a specific data member from the given class

Parameters:

target : object

The class from which the data value will be obtained

name : str

The name of the data member whose value will be obtained

Returns:

Various, the value of the requested data member, None if it does not exist

getflowmanager()[source]

Returns the FlowManager instance

Parameters:None
Returns:The current FlowManager instance
setadmit(admit)[source]

Set the base class to the given class

Parameters:

admit : ADMIT

The class to set the base to

Returns:

None

setattr(target, name, value)[source]

Method to set attributes in a class

Parameters:

target : object

The class to which the paremeters is being set

name : str

The name of the attribute to set

value : various

The value to set the attribute to

startElement(name, attrib)[source]

Method called whenever a new element is found. Dtd validation is done for each node and attribute. This method is only called by the SAX parser iteself.

Parameters:

name : str

The name of the current node

attrib : Dict

Dictionary of any attributes and their values that was found by the parser

Returns:

None