fill item with the given xml node
433113
public function setFromXML(SimpleXMLElement $feed){
        
        $dt = new jDateTime();
        
        foreach ($feed->category as $cat) {
            if($cat['term'] != null)
                $this->categories[] = (string)$cat['term'];
        }
        
        $this->description = (string)$feed->subtitle;
        if($feed->subtitle['type'])
            $this->descriptionType = (string)$feed->subtitle['type'];
        $this->generator = (string)$feed->generator;
        $this->image = (string)$feed->logo; //or maybe $feed->icon
        $this->title = (string)$feed->title;
        $this->copyright = (string)$feed->rights;
        
        if((string)$feed->updated != ''){
            $dt->setFromString((string)$feed->updated, jDateTime::ISO8601_FORMAT);
            $this->updated = $dt->toString(jDateTime::DB_DTFORMAT);
        }
        
       $attrs_links = array('href', 'rel', 'type', 'hreflang', 'title', 'length');
        foreach($feed->link as $l){
                if(($l['rel'] == 'alternate' || $l['rel'] == null)&& $l['href'] != null)
                    $this->webSiteUrl = (string)$l['href'];
                else if($l['rel'] == 'self' && $l['href'] != null)
                    $this->selfLink = (string)$l['href'];
                else{
                    $link = array();
                    foreach($attrs_links as $a){
                        if($l[$a] != null)
                            $link[$a] = (string)$l[$a];
                    }
                    $this->otherLinks[] = $link;
                }
        }
        
        foreach ($feed->author as $author) {
            $this->authors[] = array('name' => (string)$author->name, 'email' =>(string)$author->email, 'uri' => (string)$author->uri) ;
        }

        foreach ($feed->contributor as $contrib) {
            $this->contributors[] = array('name' => (string)$contrib->name, 'email' =>(string)$contrib->email, 'uri' => (string)$contrib->uri) ;
        }

        $this->generatorUrl = (string)$feed->generator['url'];
        $this->generatorVersion = (string)$feed->generator['version'];
        $this->icon = (string)$feed->icon;
        $this->id = (string)$feed->id;
        
    }
715012
function(xml) {
    var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp;
    reg = /(>)(<)(\/*)/g;
    wsexp = /[ ]*(.*)[ ]+\n/g;
    contexp = /(<.+>)(.+\n)/g;
    xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
    pad = 0;
    formatted = '';
    lines = xml.split('\n');
    indent = 0;
    lastType = 'other';
    transitions = {
      'single->single': 0,
      'single->closing': -1,
      'single->opening': 0,
      'single->other': 0,
      'closing->single': 0,
      'closing->closing': -1,
      'closing->opening': 0,
      'closing->other': 0,
      'opening->single': 1,
      'opening->closing': 0,
      'opening->opening': 1,
      'opening->other': 1,
      'other->single': 0,
      'other->closing': -1,
      'other->opening': 0,
      'other->other': 0
    };
    fn = function(ln) {
      var fromTo, j, key, padding, type, types, value;
      types = {
        single: Boolean(ln.match(/<.+\/>/)),
        closing: Boolean(ln.match(/<\/.+>/)),
        opening: Boolean(ln.match(/<[^!?].*>/))
      };
      type = ((function() {
        var results;
        results = [];
        for (key in types) {
          value = types[key];
          if (value) {
            results.push(key);
          }
        }
        return results;
      })())[0];
      type = type === void 0 ? 'other' : type;
      fromTo = lastType + '->' + type;
      lastType = type;
      padding = '';
      indent += transitions[fromTo];
      padding = ((function() {
        var m, ref1, results;
        results = [];
        for (j = m = 0, ref1 = indent; 0 <= ref1 ? m < ref1 : m > ref1; j = 0 <= ref1 ? ++m : --m) {
          results.push('  ');
        }
        return results;
      })()).join('');
      if (fromTo === 'opening->closing') {
        formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
      } else {
        formatted += padding + ln + '\n';
      }
    };
    for (l = 0, len = lines.length; l < len; l++) {
      ln = lines[l];
      fn(ln);
    }
    return formatted;
  }
196396
def parse(node)
      @fill = PresentationFill.new(parent: self).parse(node)
      @line_join = LineJoin.new(parent: self).parse(node)
      node.attributes.each do |key, value|
        case key
        when 'w'
          @width = OoxmlSize.new(value.value.to_f, :emu)
        when 'algn'
          @align = value_to_symbol(value)
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'headEnd'
          @head_end = LineEnd.new(parent: self).parse(node_child)
        when 'tailEnd'
          @tail_end = LineEnd.new(parent: self).parse(node_child)
        when 'ln'
          return TableCellLine.new(parent: self).parse(node_child)
        end
      end
      self
    end
867325
def tree_to_xml(self):
        """"""

        # Need to remove filter or hidden items will not be saved.
        self.filter_remove(remember=True)

        tree = self.treeview
        root = ET.Element('interface')
        items = tree.get_children()
        for item in items:
            node = self.tree_node_to_xml('', item)
            root.append(node)

        # restore filter
        self.filter_restore()

        return ET.ElementTree(root)
933191
def insert_data(self, node, data, start, end):
        """"""
        for item in data:
            self.recursive_insert(node, [item[0], item[1]], item[-1], start, end)
991023
def fill_empty(self, fixed_values, input):
        """"""
        odm_elements = etree.fromstring(input)

        for v in odm_elements.iter(E_ODM.ITEM_DATA.value):
            if v.get(A_ODM.VALUE.value) == "":
                oid = v.get(A_ODM.ITEM_OID.value)

                if fixed_values is not None and oid in fixed_values:
                    d = fixed_values[oid]
                else:
                    d = self.scramble_itemdata(v.get(A_ODM.ITEM_OID.value), v.get(A_ODM.VALUE.value))

                v.set(A_ODM.VALUE.value, d)
            else:
                # Remove ItemData if it already has a value
                v.getparent().remove(v)

        # Remove empty ItemGroupData elements
        for v in odm_elements.iter(E_ODM.ITEM_GROUP_DATA.value):
            if len(v) == 0:
                v.getparent().remove(v)

        # Remove empty FormData elements
        for v in odm_elements.iter(E_ODM.FORM_DATA.value):
            if len(v) == 0:
                v.getparent().remove(v)

        # Remove empty StudyEventData elements
        for v in odm_elements.iter(E_ODM.STUDY_EVENT_DATA.value):
            if len(v) == 0:
                v.getparent().remove(v)

        return etree.tostring(odm_elements)
1169546
def parse_xml_node(self, node):
        '''

        '''
        self.id = node.getAttributeNS(RTS_NS, 'id')
        self._config_data = []
        for d in node.getElementsByTagNameNS(RTS_NS, 'ConfigurationData'):
            self._config_data.append(ConfigurationData().parse_xml_node(d))
        return self
98985
def anyxml(self, node, elem, module, path):
        """"""
        nel, newm, path = self.sample_element(node, elem, module, path)
        if path is None:
            return
        if self.annots:
            nel.append(etree.Comment(" anyxml "))
250940
def fromxml(node):
        """"""
        if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access
            node = parsexmlstring(node)

        args = []

        if node.tag == 'profile':
            for node in node:
                if node.tag == 'input':
                    for subnode in node:
                        if subnode.tag.lower() == 'inputtemplate':
                            args.append(InputTemplate.fromxml(subnode))
                elif node.tag == 'output':
                    for subnode in node:
                        if subnode.tag.lower() == 'outputtemplate':
                            args.append(OutputTemplate.fromxml(subnode))
                        elif subnode.tag.lower() == 'parametercondition':
                            args.append(ParameterCondition.fromxml(subnode))
        return Profile(*args)
1072207
def xml(self, text=TEXT):
        
        def convert(line):
            xml = "  <item>\n"
            for f in line.index:
                xml += "    <field name=\"%s\">%s</field>\n" % (f, line[f])
            xml += "  </item>\n"
            return xml
        return "<items>\n" + '\n'.join(self._data.apply(convert, axis=1)) + \
               "</items>"
1171526
def _load_xml(self):
        
        if self._xml is not None:
            return
        matcher = "\[(?:Normal|Conditional) Substitution\(index=(\d+), type=\d+\)\]"
        self._xml = re.sub(matcher, "{\\1:}",
                           self._template_node.template_format().replace("{", "{{").replace("}", "}}"))
316742
function(node, settings) {
      var prefix = settings('prefix') || '',
          circle = document.createElementNS(settings('xmlns'), 'circle');

      // Defining the node's circle
      circle.setAttributeNS(null, 'data-node-id', node.id);
      circle.setAttributeNS(null, 'class', settings('classPrefix') + '-node');
      circle.setAttributeNS(
        null, 'fill', node.color || settings('defaultNodeColor'));

      // Returning the DOM Element
      return circle;
    }
293468
public void add(XmlReader node)
    {
        Check.notNull(node);

        final Element element = node.getElement();
        document.adoptNode(element);
        root.appendChild(element);
    }
756960
def update_file(filename, items):
    '''
    '''
    # TODO: Implement something in the templates to denote whether the value
    # being replaced is an XML attribute or a value. Perhaps move to dyanmic
    # XML tree building rather than string replacement.
    should_escape = filename.endswith('addon.xml')

    with open(filename, 'r') as inp:
        text = inp.read()

    for key, val in items.items():
        if should_escape:
            val = saxutils.quoteattr(val)
        text = text.replace('{%s}' % key, val)
    output = text

    with open(filename, 'w') as out:
        out.write(output)
247782
def parse_xml(self, node):
        
        self._set_properties(node)
        self.extend(TiledObject(self.parent, child)
                    for child in node.findall('object'))

        return self
803082
private void put(Object obj, Element node) throws Exception {
		if (!(obj instanceof Map)) {
			throw new IllegalArgumentException("Object for put is not a Map: "
					+ obj);
		}
		@SuppressWarnings("unchecked")
		Map<Object, Object> map = (Map<Object, Object>) obj;

		String name = getAttribute(node, "name");
		Object value = value(obj, node);
		map.put(name, value);
		if (LOG.isDebugEnabled()) {
			LOG.debug("XML " + obj + ".put(" + name + "," + value + ")");
		}
	}
381687
def addElement(self, parent, tag, value):
        """"""
        elem = self.rss.createElement(tag)
        node = self.rss.createTextNode(value)
        return parent.appendChild(elem).appendChild(node)