vexflow-musicxml
Version:
MusicXml Parser for vexflow
1,693 lines (433 loc) • 17.8 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: XmlObject</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: XmlObject</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>XmlObject<span class="signature">(node)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="XmlObject"><span class="type-signature"></span>new XmlObject<span class="signature">(node)</span><span class="type-signature"></span></h4>
<div class="description">
Basic XML object that handles data connection to the DON node tree
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>node</code></td>
<td class="type">
</td>
<td class="description last">DOM tree node</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line1">line 1</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="accept"><span class="type-signature"></span>accept<span class="signature">(visitor)</span><span class="type-signature"></span></h4>
<div class="description">
Methods to hook in converters that can use this XML type for formatting
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>visitor</code></td>
<td class="type">
<span class="param-type">Visitor</span>
</td>
<td class="description last">that converts XML to other formats</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line23">line 23</a>
</li></ul></dd>
</dl>
<h4 class="name" id="childExists"><span class="type-signature"></span>childExists<span class="signature">(name)</span><span class="type-signature"> → {bool}</span></h4>
<div class="description">
childExists - Check if a child exists
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line85">line 85</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
true if child exists, false otherwise
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">bool</span>
</dd>
</dl>
<h4 class="name" id="getAttribute"><span class="type-signature"></span>getAttribute<span class="signature">(name)</span><span class="type-signature"> → {string}</span></h4>
<div class="description">
getAttribute - Gets a string representation of an attribute
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Attribute name</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line144">line 144</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Attribute value
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getChild"><span class="type-signature"></span>getChild<span class="signature">(name)</span><span class="type-signature"> → {DOMNode}</span></h4>
<div class="description">
getChild - Gets a (usally the first) child by its tag name
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
DOM node representation of the child
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">DOMNode</span>
</dd>
</dl>
<h4 class="name" id="getChildren"><span class="type-signature"></span>getChildren<span class="signature">(name)</span><span class="type-signature"> → {DOMNodeList}</span></h4>
<div class="description">
getChildren - Gets all children by its tag name
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child. If empty all children will be given</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line43">line 43</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
DOM node list representation of the children
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">DOMNodeList</span>
</dd>
</dl>
<h4 class="name" id="getNum"><span class="type-signature"></span>getNum<span class="signature">(name)</span><span class="type-signature"> → {float}</span></h4>
<div class="description">
getNum - Get the numeric representation of the node. Will return NaN if failed
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line129">line 129</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Value of the node
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">float</span>
</dd>
</dl>
<h4 class="name" id="getSiblings"><span class="type-signature"></span>getSiblings<span class="signature">(name)</span><span class="type-signature"> → {DOMNodeList}</span></h4>
<div class="description">
getSiblings - Gets all siblings by its tag name
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the sibling.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line53">line 53</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
DOM node list representation of the children
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">DOMNodeList</span>
</dd>
</dl>
<h4 class="name" id="getText"><span class="type-signature"></span>getText<span class="signature">(name)</span><span class="type-signature"> → {string}</span></h4>
<div class="description">
getText - Get the string representation of a node's text content
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line95">line 95</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
string of the text content
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getTextArray"><span class="type-signature"></span>getTextArray<span class="signature">(name)</span><span class="type-signature"> → {Arrray}</span></h4>
<div class="description">
getTextArray - Get the strings of the given child tags as array instead of string
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The tag name of the child</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line112">line 112</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
string array of the text content
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Arrray</span>
</dd>
</dl>
<h4 class="name" id="isFirst"><span class="type-signature"></span>isFirst<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Check if this element is the first in the tag
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line151">line 151</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Test.html">Test</a></li></ul><h3>Classes</h3><ul><li><a href="ClefVisitor.html">ClefVisitor</a></li><li><a href="Key_Key.html">Key</a></li><li><a href="KeyVisitor.html">KeyVisitor</a></li><li><a href="Measure.html">Measure</a></li><li><a href="MeasureVisitor.html">MeasureVisitor</a></li><li><a href="MusicXmlRenderer.html">MusicXmlRenderer</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteVisitor.html">NoteVisitor</a></li><li><a href="Part.html">Part</a></li><li><a href="TimeSignatureVisitor.html">TimeSignatureVisitor</a></li><li><a href="TimeVisitor.html">TimeVisitor</a></li><li><a href="XmlObject.html">XmlObject</a></li><li><a href="XmlSerializer_XmlSerializer.html">XmlSerializer</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Nov 20 2017 21:30:34 GMT+0100 (CET)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>