Skip to content

Commit 72c2938

Browse files
committed
no message
1 parent 26fb82d commit 72c2938

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"yargs": "^17.7.2"
8585
},
8686
"dependencies": {
87-
"@svta/common-media-library": "^0.7.4",
87+
"@svta/common-media-library": "^0.9.0",
8888
"bcp-47-match": "^2.0.3",
8989
"bcp-47-normalize": "^2.3.0",
9090
"codem-isoboxer": "0.3.10",

src/dash/parser/DashParser.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import NumericMatcher from './matchers/NumericMatcher.js';
3737
import LangMatcher from './matchers/LangMatcher.js';
3838
import RepresentationBaseValuesMap from './maps/RepresentationBaseValuesMap.js';
3939
import SegmentValuesMap from './maps/SegmentValuesMap.js';
40-
import { parseXml as cmlParseXml } from '@svta/common-media-library/utils/parseXml.js';
40+
import { parseXml as cmlParseXml } from '@svta/common-media-library/xml/parseXml.js';
4141

4242
// List of node that shall be represented as arrays
4343
const arrayNodes = [
@@ -136,29 +136,29 @@ function DashParser(config) {
136136
}
137137

138138
function processXml(data) {
139-
const root = cmlParseXml(data).children.find(child => child.tagName === 'MPD');
139+
const root = cmlParseXml(data).children.find(child => child.nodeName === 'MPD');
140140

141141
function processNode(node) {
142142
// Convert tag name
143-
let p = node.tagName.indexOf(':');
143+
let p = node.nodeName.indexOf(':');
144144
if (p !== -1) {
145-
node.__prefix = node.tagName.substr(0, p);
146-
node.tagName = node.tagName.substr(p + 1);
145+
node.__prefix = node.nodeName.substr(0, p);
146+
node.nodeName = node.nodeName.substr(p + 1);
147147
}
148148

149-
const { children, attributes, tagName } = node;
149+
const { children, attributes, nodeName } = node;
150150

151151
// Convert attributes
152152
for (let k in attributes) {
153153
let value = attributes[k];
154154

155-
if (tagName === 'S') {
155+
if (nodeName === 'S') {
156156
value = parseInt(value);
157157
}
158158
else {
159159
for (let i = 0, len = matchers.length; i < len; i++) {
160160
const matcher = matchers[i];
161-
if (matcher.test(tagName, k, value)) {
161+
if (matcher.test(nodeName, k, value)) {
162162
value = matcher.converter(value);
163163
break;
164164
}
@@ -174,25 +174,25 @@ function DashParser(config) {
174174
for (let i = 0; i < len; i++) {
175175
const child = children[i];
176176

177-
if (typeof child === 'string') {
178-
node.__text = child;
177+
if (child.nodeName === '#text') {
178+
node.__text = child.nodeValue;
179179
continue;
180180
}
181181

182182
processNode(child);
183183

184-
const { tagName } = child;
184+
const { nodeName } = child;
185185

186-
if (Array.isArray(node[tagName])) {
187-
node[tagName].push(child);
186+
if (Array.isArray(node[nodeName])) {
187+
node[nodeName].push(child);
188188
}
189-
else if (arrayNodes.indexOf(tagName) !== -1) {
190-
if (!node[tagName]) {
191-
node[tagName] = [];
189+
else if (arrayNodes.indexOf(nodeName) !== -1) {
190+
if (!node[nodeName]) {
191+
node[nodeName] = [];
192192
}
193-
node[tagName].push(child);
193+
node[nodeName].push(child);
194194
} else {
195-
node[tagName] = child;
195+
node[nodeName] = child;
196196
}
197197
}
198198

@@ -210,7 +210,7 @@ function DashParser(config) {
210210

211211
let ret = {};
212212
// If root element is xml node, then get first child node as root
213-
if (root.tagName.toLowerCase().indexOf('xml') !== -1) {
213+
if (root.nodeName.toLowerCase().indexOf('xml') !== -1) {
214214
for (let key in root) {
215215
if (Array.isArray(root[key])) {
216216
ret[key] = root[key][0];
@@ -221,8 +221,8 @@ function DashParser(config) {
221221
}
222222
}
223223
} else {
224-
ret[root.tagName] = root;
225-
delete root.tagName;
224+
ret[root.nodeName] = root;
225+
delete root.nodeName;
226226
}
227227
return ret;
228228
} catch (e) {

0 commit comments

Comments
 (0)