Esempio n. 1
0
def set_text(node: Element, text):
    dom = node.ownerDocument

    for child in node.childNodes:
        if child.nodeType == Node.TEXT_NODE:
            node.removeChild(child)

    text_node = dom.createTextNode(text)
    text_node.nodeValue = text
    node.appendChild(text_node)
 def _remove_guide_from_cap(cap: Element, glyph_part_ignore_regex) -> None:
     badKids: [Element] = list(
         filter(
             lambda k: k.attributes and 'id' in k.attributes and match(
                 glyph_part_ignore_regex, k.attributes['id'].value),
             cap.childNodes))
     goodKids: [Element] = list_diff(list(cap.childNodes), badKids)
     for badKid in badKids:
         cap.removeChild(badKid)
     for goodKid in goodKids:
         _remove_guide_from_cap(goodKid, glyph_part_ignore_regex)