orange / Orange / orng /

import xml.dom.minidom, re

def _zip_open(zipfile, file, mode='r'):
    if hasattr(zipfile, "open"):
        return, mode)
        from cStringIO import StringIO
        return StringIO(

def create_text_element(tag_name, value):
    result = xml.dom.minidom.Element(tag_name)
    textNode = xml.dom.minidom.Text() = value
    return result

def xml_set(parent, node_name, value):
    child = get_element_nonrecursive(parent, node_name)
    if not child:
        if value:
            parent.appendChild(create_text_element(node_name, value))
        if not value:
            for text in child.childNodes:
            textNode = xml.dom.minidom.Text()
   = value

def xml_text_of(node, parent=None, multiline=False):
    if node.__class__ is str:
        node = get_element_nonrecursive(parent, node)
    t = ""
    if node==None:
        return t
    for n in node.childNodes:
        if n.nodeType == n.COMMENT_NODE:
        if n.nodeType != n.TEXT_NODE:
        t +=
    if multiline:
        t = "\n\n".join( map(lambda x: x.strip(), re.split("\n[ \t]*\n", t.strip())) )
        t = re.sub("\s+", " ", t.strip())
    return t

def get_element_nonrecursive(parent, elementname, create=False):
    for node in [n for n in parent.childNodes if n.nodeType==n.ELEMENT_NODE]:
        if node.tagName == elementname:
            return node
    if create:
        node = xml.dom.minidom.Element(elementname)
        return node
    return None
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.