|
|
@ -35,10 +35,17 @@ function makeDomNode(xmlElement, parentElement) { |
|
|
|
} |
|
|
|
|
|
|
|
function makeChildren(xmlElement, element) { |
|
|
|
var children = element.tag == 'TextBlock' ? [blockPositionElem()] : []; |
|
|
|
xmlElement.querySelectorAll(element.childTag).forEach(function(child) { |
|
|
|
children.push(makeDomNode(child, element)); |
|
|
|
}); |
|
|
|
var children = []; |
|
|
|
if(Element.schema.PrintSpace.childTags.indexOf(element.tag) >= 0) { |
|
|
|
children.push(blockPositionElem()); |
|
|
|
} |
|
|
|
if(Array.isArray(element.childTags)) { |
|
|
|
xmlElement.querySelectorAll(element.childTags.join(', ')).forEach( |
|
|
|
function(child) { |
|
|
|
children.push(makeDomNode(child, element)); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
return children; |
|
|
|
} |
|
|
|
|
|
|
@ -73,15 +80,15 @@ function editElement(xmlElement) { |
|
|
|
if(element.tag == 'String') { |
|
|
|
return !isScoria(element.get('ID')); |
|
|
|
} else { |
|
|
|
editChildren(xmlElement, element.childTag); |
|
|
|
editChildren(xmlElement, element.childTags); |
|
|
|
return xmlElement.children.length > 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function editChildren(xmlElement, childTag) { |
|
|
|
function editChildren(xmlElement, childTags) { |
|
|
|
for(var i = 0; i < xmlElement.children.length; i++) { |
|
|
|
var child = xmlElement.children[i]; |
|
|
|
if(child.tagName == childTag && !editElement(child)) { |
|
|
|
if(childTags.indexOf(child.tagName) >= 0 && !editElement(child)) { |
|
|
|
xmlElement.removeChild(child); |
|
|
|
} |
|
|
|
} |
|
|
|