Members
Methods
cloneNode(nodenullable) → {shaka.extern.xml.Node}
    Clones node and its children recursively. Skips parent.
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| node | shaka.extern.xml.Node | <nullable> | 
- Source:
Returns:
evalDivision(exprString) → {number}
    Evaluate a division expressed as a string.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| exprString | string | The expression to evaluate, e.g. "200/2". Can also be a single number. | 
- Source:
Returns:
    The evaluated expression as floating point number on
  success; otherwise return null.
- Type
- number
findChild(elemnon-null, name) → {shaka.extern.xml.Node|null}
    Finds a child XML element.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | The parent XML element. | 
| name | string | The child XML element's tag name. | 
- Source:
Returns:
    The child XML element,
  or null if a child XML element
  does not exist with the given tag name OR if there exists more than one
  child XML element with the given tag name.
- Type
- shaka.extern.xml.Node | null
findChildNS(elemnon-null, ns, name) → {shaka.extern.xml.Node|null}
    Finds a namespace-qualified child XML element.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | The parent XML element. | 
| ns | string | The child XML element's namespace URI. | 
| name | string | The child XML element's local name. | 
- Source:
Returns:
    The child XML element, or null
  if a child XML element
  does not exist with the given tag name OR if there exists more than one
  child XML element with the given tag name.
- Type
- shaka.extern.xml.Node | null
findChildren(elemnon-null, name) → {Array<!shaka.extern.xml.Node>}
    Finds child XML elements.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | The parent XML element. | 
| name | string | The child XML element's tag name. | 
- Source:
Returns:
    The child XML elements.
- Type
- Array<!shaka.extern.xml.Node>
findChildrenNS(elemnon-null, ns, name) → {Array<!shaka.extern.xml.Node>}
    Finds namespace-qualified child XML elements.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | The parent XML element. | 
| ns | string | The child XML element's namespace URI. | 
| name | string | The child XML element's local name. | 
- Source:
Returns:
    The child XML elements.
- Type
- Array<!shaka.extern.xml.Node>
getAttributeNS(elemnon-null, ns, name) → {string}
    Gets a namespace-qualified attribute.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | The element to get from. | 
| ns | string | The namespace URI. | 
| name | string | The local name of the attribute. | 
- Source:
Returns:
    The attribute's value, or null if not present.
- Type
- string
getAttributeNSList(elemnon-null, nsListnon-null, name) → {string}
    Gets a namespace-qualified attribute.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | The element to get from. | 
| nsList | Array<string> | The lis of namespace URIs. | 
| name | string | The local name of the attribute. | 
- Source:
Returns:
    The attribute's value, or null if not present.
- Type
- string
getChildNodes(elemnon-null) → {Array<!shaka.extern.xml.Node>}
    gets child XML elements.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | The parent XML element. | 
- Source:
Returns:
    The child XML elements.
- Type
- Array<!shaka.extern.xml.Node>
getContents(nodenon-null) → {string}
    Gets the text contents of a node.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| node | shaka.extern.xml.Node | The XML element. | 
- Source:
Returns:
    The text contents, or null if there are none.
- Type
- string
getElementsByTagName(elemnon-null, name, foundnon-null) → {Array<!shaka.extern.xml.Node>}
    Finds child XML elements recursively.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | The parent XML element. | 
| name | string | The child XML element's tag name. | 
| found | Array<!shaka.extern.xml.Node> | accumulator for found nodes | 
- Source:
Returns:
    The child XML elements.
- Type
- Array<!shaka.extern.xml.Node>
getKnownNameSpace(schema) → {string}
    Get namespace based on schema
    Parameters:
| Name | Type | Description | 
|---|---|---|
| schema | string | 
- Source:
Returns:
- Type
- string
getKnownSchema(NS) → {string}
    Get schema based on namespace
    Parameters:
| Name | Type | Description | 
|---|---|---|
| NS | string | 
- Source:
Returns:
- Type
- string
getTextContents(node) → {string}
    Gets inner text.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| node | shaka.extern.xml.Node | string | The XML element. | 
- Source:
Returns:
    The text contents, or null if there are none.
- Type
- string
isNode(elemnon-null) → {boolean}
    Verifies if the element is a TXml node.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | The XML element. | 
- Source:
Returns:
    Is the element a TXml node
- Type
- boolean
isText(elem) → {boolean}
    Checks if a node is of type text.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| elem | shaka.extern.xml.Node | string | The XML element. | 
- Source:
Returns:
    True if it is a text node.
- Type
- boolean
modifyNodeAttribute(nodenon-null, action, attribute, value)
Parameters:
| Name | Type | Description | 
|---|---|---|
| node | shaka.extern.xml.Node | |
| action | string | |
| attribute | string | |
| value | string | 
- Source:
modifyNodes(nodesnon-null, patchNodenon-null)
    Modifies nodes in specified array by adding or removing nodes
and updating attributes.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| nodes | Array<shaka.extern.xml.Node> | |
| patchNode | shaka.extern.xml.Node | 
- Source:
nodePositionByAttribute_(nodesnon-null, attributenon-null, valuenon-null) → {number}
    Search the node index by the t attribute
and return the index. if not found return null
    Parameters:
| Name | Type | Description | 
|---|---|---|
| nodes | Array<shaka.extern.xml.Node> | |
| attribute | string | |
| value | number | 
- Source:
Returns:
- Type
- number
parse(S, includeParent) → {Array<shaka.extern.xml.Node>}
    parseXML / html into a DOM Object,
with no validation and some failure tolerance
    Parameters:
| Name | Type | Description | 
|---|---|---|
| S | string | your XML to parse | 
| includeParent | boolean | 
- Source:
Returns:
- Type
- Array<shaka.extern.xml.Node>
parseAttr(elemnon-null, name, parseFunction, defaultValueopt) → {T|null}
    Parses an attribute by its name.
    Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
| elem | shaka.extern.xml.Node | The XML element. | ||
| name | string | The attribute name. | ||
| parseFunction | function(string): (T|null) | A function that parses the attribute. | ||
| defaultValue | T | null | <optional> | null | The attribute's default value, if not specified, the attribute's default value is null. | 
- Source:
Returns:
    The parsed attribute on success, or the attribute's
  default value if the attribute does not exist or could not be parsed.
- Type
- T | null
parseBoolean(booleanString) → {boolean}
    Parses a boolean.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| booleanString | string | The boolean string. | 
- Source:
Returns:
    The boolean
- Type
- boolean
parseDate(dateString) → {number}
    Parses an XML date string.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| dateString | string | 
- Source:
Returns:
    The parsed date in seconds on success; otherwise, return
  null.
- Type
- number
parseDuration(durationString) → {number}
    Parses an XML duration string.
Negative values are not supported. Years and months are treated as exactly
365 and 30 days respectively.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| durationString | string | The duration string, e.g., "PT1H3M43.2S", which means 1 hour, 3 minutes, and 43.2 seconds. | 
Returns:
    The parsed duration in seconds on success; otherwise,
  return null.
- Type
- number
parseFloat(floatString) → {number}
    Parses a floating point number.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| floatString | string | The floating point number string. | 
- Source:
Returns:
    The parsed floating point number on success; otherwise,
  return null. May return -Infinity or Infinity.
- Type
- number
parseInt(intString) → {number}
    Parses an integer.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| intString | string | The integer string. | 
- Source:
Returns:
    The parsed integer on success; otherwise, return null.
- Type
- number
parseNonNegativeInt(intString) → {number}
    Parses a non-negative integer.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| intString | string | The integer string. | 
- Source:
Returns:
    The parsed non-negative integer on success; otherwise,
  return null.
- Type
- number
parsePositiveInt(intString) → {number}
    Parses a positive integer.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| intString | string | The integer string. | 
- Source:
Returns:
    The parsed positive integer on success; otherwise,
  return null.
- Type
- number
parseRange(rangeString) → {?{start: number, end: number}}
    Parses a range string.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| rangeString | string | The range string, e.g., "101-9213". | 
- Source:
Returns:
    The parsed range on success;
  otherwise, return null.
- Type
- ?{start: number, end: number}
parseXml(data, expectedRootElemNameopt, includeParentopt) → {shaka.extern.xml.Node|null}
    Parse some data
    Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
| data | BufferSource | |||
| expectedRootElemName | string | <optional> | ||
| includeParent | boolean | <optional> | false | 
- Source:
Returns:
- Type
- shaka.extern.xml.Node | null
parseXmlString(xmlString, expectedRootElemNameopt, includeParentopt) → {shaka.extern.xml.Node|null}
    Parse some data
    Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
| xmlString | string | |||
| expectedRootElemName | string | <optional> | ||
| includeParent | boolean | <optional> | false | 
- Source:
Returns:
- Type
- shaka.extern.xml.Node | null
parseXpath(exprString) → {Array<!shaka.util.TXml.PathNode>}
    Parse xPath strings for segments and id targets.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| exprString | string | 
- Source:
Returns:
- Type
- Array<!shaka.util.TXml.PathNode>
setKnownNameSpace(schema, NS)
    Sets NS <-> schema bidirectional mapping
    Parameters:
| Name | Type | Description | 
|---|---|---|
| schema | string | |
| NS | string | 
- Source:
Type Definitions
PathNode
Type:
- {name: string, id: ?string, t: ?number, n: ?number, position: ?number, attribute: ?string}
- Source: