Set new XML string
190925
def xml(self, value):
        """"""

        self._xml = value
        self._root = s2t(value)
598180
def set_string(self, string):
        """"""
        self.string = string
        self.length = len(string)
        self.reset_position()
921691
def update_xml_element(self):
        

        if not hasattr(self, 'xml_element'):
            self.xml_element = etree.Element(self.name, nsmap=NSMAP)

        self.xml_element.clear()
        self.xml_element.set('id', self.id)

        for child in self.children:
            child.update_xml_element()
            self.xml_element.append(child.xml_element)

        return self.xml_element
1208749
def update_xml_element(self):
        

        if not hasattr(self, 'xml_element'):
            self.xml_element = etree.Element(self.name, nsmap=NSMAP)

        for element in self.xml_element:
            self.xml_element.remove(element)

        self.xml_element.tail = ''
        self.xml_element.text = self.convert_html_to_xml()

        return self.xml_element
521292
def writeXML(self, n):
        
        self.stream.write(TYPE_XMLSTRING)
        ref = self.context.getObjectReference(n)

        if ref != -1:
            self._writeInteger(ref << 1)

            return

        self.context.addObject(n)

        self.serialiseString(xml.tostring(n).encode('utf-8'))
1182601
public function set($html_string) {
		$libxml_use_internal_errors = libxml_use_internal_errors(true);
		// workaround to handle UTF-8
		$this->loadHtml('<?xml encoding="UTF-8">' . $html_string);
		libxml_use_internal_errors($libxml_use_internal_errors);
		$this->xpath = new \DOMXPath($this);
	}
155680
def addObjectFromXML(xmlObject, XMLToObjectFunc,
                     topLevelName, idKey, updateList):
    

    # Get the current object to update
    contentElement = getNodeByName(xmlObject, "content")
    objectNode = getNodeByName(contentElement, topLevelName)
    dupObjects = None
    newObject = XMLToObjectFunc(objectNode)
    try:
        kwargs = {idKey: getattr(newObject, idKey)}
        dupObjects = type(newObject).objects.filter(**kwargs)
    except type(newObject).DoesNotExist:
        pass
    if dupObjects and dupObjects.count() > 1:
        raise Exception(
            "Duplicate object with identifier %s" % getattr(newObject, idKey)
        )
    newObject.save()
    return newObject
21115
final XML newXMLFromJs(Object inputObject) {
        String frag;

        if (inputObject == null || inputObject == Undefined.instance) {
            frag = "";
        } else if (inputObject instanceof XMLObjectImpl) {
            // todo: faster way for XMLObjects?
            frag = ((XMLObjectImpl) inputObject).toXMLString();
        } else {
            frag = ScriptRuntime.toString(inputObject);
        }

        if (frag.trim().startsWith("<>")) {
            throw ScriptRuntime.typeError("Invalid use of XML object anonymous tags <></>.");
        }

        if (frag.indexOf("<") == -1) {
            //    Solo text node
            return newXML(XmlNode.createText(options, frag));
        }
        return parse(frag);
    }
1139193
function xmlString()
    {
        $doc = new DOMDocument( '1.0', 'utf-8' );
        $root = $doc->createElement( "ezmatrix" );
        $doc->appendChild( $root );

        $name = $doc->createElement( "name", $this->Name );
        $root->appendChild( $name );

        $columnsNode = $doc->createElement( "columns" );

        $sequentalColumns = $this->Matrix['columns']['sequential'];
        $columnAmount = $this->NumColumns;
        $columnsNode->setAttribute( 'number', $columnAmount );
        $root->appendChild( $columnsNode );

        if ( $sequentalColumns != null )
        {
            for( $i = 0; $i < $columnAmount; $i++ )
            {
                $column = $sequentalColumns[$i];
                if ( $column != null && $column['identifier'] != 'col_' . ($i+1) )
                {
                    unset( $columnNode );
                    $columnNode = $doc->createElement( 'column' );
                    $columnNode->appendChild( $doc->createTextNode( $column['name'] ) );
                    $columnNode->setAttribute( 'num', $i );
                    $columnNode->setAttribute( 'id', $column['identifier'] );

                    $columnsNode->appendChild( $columnNode );
                }
            }

        }

        $rowsNode =  $doc->createElement( "rows" );
        $rowAmount = $this->NumRows;

        $rowsNode->setAttribute( 'number', $rowAmount );

        $root->appendChild( $rowsNode );

        foreach ( $this->Cells as $cell )
        {
            unset( $cellNode );
            $cellNode = $doc->createElement( 'c' );
            $cellNode->appendChild( $doc->createTextNode( $cell ) );

            $root->appendChild( $cellNode );
        }

        return $this->domString( $doc );
    }
1370816
XML makeXmlFromString(XMLName name, String value) {
        try {
            return newTextElementXML(this.node, name.toQname(), value);
        } catch(Exception e) {
            throw ScriptRuntime.typeError(e.getMessage());
        }
    }
1353120
def write_xml(self, as_string=False):
        """"""
        if not as_string:
            et.ElementTree(self.xmlreport).write('{}/{}.xml'.format(self.outpath, self.outputprefix), pretty_print=True, xml_declaration=True)
        else:
            output = et.tostring(self.xmlreport, pretty_print=True)
            if config.RAWSTRING:
                output = repr(output)
            print(output)
500315
def xml(self, indent=4, **kwargs):
        
        writer = StringIO()
        self.write(writer, indent=indent, **kwargs)
        return writer.getvalue()
351822
def to_xml_string(str = '')
      return if empty?
      str << '<definedNames>'
      each { |defined_name| defined_name.to_xml_string(str) }
      str << '</definedNames>'
    end
1032984
def add_from_xmlnode(self, element):
        """"""
        if self.tree is None:
            root = ET.Element('interface')
            root.append(element)
            self.tree = tree = ET.ElementTree(root)
            self.root = tree.getroot()
            self.objects = {}
            # ET.dump(tree)
        else:
            # TODO: append to current tree
            pass
906108
function(xmlElement) {
    this.arguments_ = [];
    for (var i = 0, childNode; childNode = xmlElement.childNodes[i]; i++) {
      if (childNode.nodeName.toLowerCase() == 'arg') {
        this.arguments_.push(childNode.getAttribute('name'));
      }
    }
    this.updateParams_();
    Blockly.Procedures.mutateCallers(this);

    // Show or hide the statement input.
    this.setStatements_(xmlElement.getAttribute('statements') !== 'false');
  }
629054
private void writeXML(String xml) {
        String resourceName = System.getProperty(CONFIG_FILENAME_KEY);
        if (resourceName == null) {
            return;
        } else {
            URL rUrl = ClassLoader.getSystemResource(resourceName);
            if (rUrl != null) {
                File file = new File(rUrl.getFile());
                if (file != null && file.canWrite()) {
                    FileWriter fw = null;
                    try {
                        fw = new FileWriter(file);
                        fw.write(xml);
                        fw.close();
                    } catch (IOException ioe) {
                        //@TODO log it?
                    } finally {
                        try {
                            fw.close();
                        } catch (IOException ioee) {
                            ; //Nothing to do.
                        }
                        fw = null;
                        file = null;
                    }
                }
            }
        }
    }
73580
private function loadXML()
    {
        $xml = str_replace($this->replaceNamespaces, '', $this->getXml());
        $this->xmlData = \simplexml_load_string($xml);
    }