An object base-class for creating and editing specialized XML structures as object representations. Used by the musicxml converter, obviously, but also by environment.py.
>>> a = Node()
>>> a.set('charData', 'test')
Node attributes
Attributes without Documentation: charData
Node properties
- tag¶
- No documentation.
Node methods
- get(name)¶
- No documentation.
- getNewDoc()¶
- No documentation.
- loadAttrs(attrs)¶
- Given a SAX attrs object, load all atributes that are named within this object’s _attr dictionary.
- merge(other, favorSelf=True)¶
Given another similar or commonly used Node object, combine all attributes and return a new object.
>>> a = Node() >>> a.set('charData', 'green') >>> b = Node() >>> c = b.merge(a) >>> c.get('charData') 'green'
- set(name, value)¶
- No documentation.
- setDefaults()¶
- provide defaults for all necessary attributes at this level
- toxml(doc=None, parent=None, stringOut=0)¶
- Provides XML output as either a text string or as DOM node. This method can be called recursively to build up nodes on a DOM tree. This method will assume that if an self.charData attribute has been defined this is a text element for this node. Attributes, sub entities, and sub nodes are obtained via subclassed method calls.
- xmlStr()¶
- Shortcut method to provide quick xml out.
Inherits from: Node
To understand what a NodeList is, we need to first see that Nodes are simply xml-like containers. Though many xml-like containers store just character data, like:: <fifths>0</fifths> Other xml-like containers are really more like lists, not storing character data but other xml-like containers in order, like:: <attributes> <divisions>1</divisions> <key> <fifths>0</fifths> <mode>major</mode> </key> <time symbol=”common”> <beats>4</beats> <beat-type>4</beat-type> </time> <clef> <sign>G</sign> <line>2</line> </clef> </attributes> In these cases, its much easier to have an xml-like container that is list like. That way they can be iterated over or appended to. Thus, NodeLists, which are nodes that give us list-like functionality for the cases where we need them.
NodeList attributes
Attributes without Documentation: componentList
Attributes inherited from Node: charData
NodeList properties
Properties inherited from Node: tag
NodeList methods
- append(item)¶
- No documentation.
Methods inherited from Node: get(), getNewDoc(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()