Constructor
new Part(node)
Create a part from an XML node
Parameters:
| Name | Type | Description |
|---|---|---|
node |
NodeObject | the XML Node representing the part |
- Source:
Extends
Methods
accept(visitor)
Methods to hook in converters that can use this XML type for formatting
Parameters:
| Name | Type | Description |
|---|---|---|
visitor |
Visitor | that converts XML to other formats |
- Inherited From:
- Source:
childExists(name) → {bool}
childExists - Check if a child exists
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Inherited From:
- Source:
Returns:
true if child exists, false otherwise
- Type
- bool
getAllClefs() → {Array}
Get all clefs in all measure
- Source:
Returns:
Array of clefs in all measures
- Type
- Array
getAllMeasuresWithKeys() → {Key}
Gets all measures that have keys. This can be used for checking if we still
have the same keys as in the measure before
- Deprecated:
- This function will always return all measures because all measures have attributes (with keys)
- Source:
Returns:
A Key class object
- Type
- Key
getAllStaves() → {Array}
Get the number of all staves in all measures
- Source:
Returns:
Array of staves in measure
- Type
- Array
getAttribute(name) → {string}
getAttribute - Gets a string representation of an attribute
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Attribute name |
- Inherited From:
- Source:
Returns:
Attribute value
- Type
- string
getChild(name) → {DOMNode}
getChild - Gets a (usally the first) child by its tag name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Inherited From:
- Source:
Returns:
DOM node representation of the child
- Type
- DOMNode
getChildren(name) → {DOMNodeList}
getChildren - Gets all children by its tag name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child. If empty all children will be given |
- Inherited From:
- Source:
Returns:
DOM node list representation of the children
- Type
- DOMNodeList
getNotesByStaff(Number) → {Note}
Get all the notes belonging to the given staff. The staff number
can be retrieved from getStaves
Parameters:
| Name | Type | Description |
|---|---|---|
Number |
Number | of the staff. |
- Source:
- See:
-
- getStaves
Returns:
A Note class object
- Type
- Note
getNum(name) → {float}
getNum - Get the numeric representation of the node. Will return NaN if failed
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Inherited From:
- Source:
Returns:
Value of the node
- Type
- float
getSiblings(name) → {DOMNodeList}
getSiblings - Gets all siblings by its tag name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the sibling. |
- Inherited From:
- Source:
Returns:
DOM node list representation of the children
- Type
- DOMNodeList
getText(name) → {string}
getText - Get the string representation of a node's text content
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Inherited From:
- Source:
Returns:
string of the text content
- Type
- string
getTextArray(name) → {Arrray}
getTextArray - Get the strings of the given child tags as array instead of string
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The tag name of the child |
- Inherited From:
- Source:
Returns:
string array of the text content
- Type
- Arrray
isFirst()
Check if this element is the first in the tag
- Inherited From:
- Source: