Save this service port into an xml.dom.Element object.
176856
def save_xml(self, doc, element):
        ''''''
        element.setAttributeNS(XSI_NS, XSI_NS_S + 'type', 'rtsExt:serviceport_ext')
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'name', self.name)
        if self.comment:
            element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                   self.comment)
        if self.visible != True:
            element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                                   str(self.visible).lower())
        for p in self.properties:
            new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                   RTS_EXT_NS_S + 'Properties')
            properties_to_xml(new_prop_element, p, self.properties[p])
            element.appendChild(new_prop_element)
674802
def save_xml(self, doc, element):
        ''''''
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'groupID', self.group_id)
        for m in self.members:
            new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'Members')
            m.save_xml(doc, new_element)
            element.appendChild(new_element)
226042
def fromxml(node):
        """"""
        if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access
            node = ElementTree.parse(StringIO(node)).getroot()
        if node.tag in globals():
            id = ''
            paramflag = ''
            name = ''
            description = ''
            kwargs = {}
            error = None
            for attrib, value in node.attrib.items():
                if attrib == 'id':
                    id = value
                elif attrib == 'paramflag':
                    paramflag = value
                elif attrib == 'name':
                    name = value
                elif attrib == 'description':
                    description = value
                elif attrib == 'error':
                    error = value
                else:
                    kwargs[attrib] = value

            #extra parsing for choice parameter (TODO: put in a better spot)
            if 'multi' in kwargs and (kwargs['multi'] == 'yes' or kwargs['multi'] == '1' or kwargs['multi'] == 'true'):
                kwargs['value'] = []

            for subtag in node: #parse possible subtags
                if subtag.tag == 'choice': #extra parsing for choice parameter (TODO: put in a better spot)
                    if 'choices' not in kwargs: kwargs['choices'] = {}
                    kwargs['choices'][subtag.attrib['id']] = subtag.text
                    if 'selected' in subtag.attrib and (subtag.attrib['selected'] == '1' or subtag.attrib['selected'] == 'yes'):
                        if 'multi' in kwargs and (kwargs['multi'] == 'yes' or kwargs['multi'] == '1' or kwargs['multi'] == 'true'):
                            kwargs['value'].append(subtag.attrib['id'])
                        else:
                            kwargs['value'] = subtag.attrib['id']

            parameter = globals()[node.tag](id, name, description, **kwargs) #return parameter instance
            if error:
                parameter.error = error #prevent error from getting reset
            return parameter
        else:
            raise Exception("No such parameter exists: " + node.tag)
549729
def save_xml(self, doc, element):
        ''''''
        element.setAttributeNS(XSI_NS, XSI_NS_S + 'type', 'rtsExt:dataport_connector_ext')
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'connectorId',
                               self.connector_id)
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'name', self.name)
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'dataType', self.data_type)
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'interfaceType',
                               self.interface_type)
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'dataflowType',
                               self.data_flow_type)
        if self.subscription_type:
            element.setAttributeNS(RTS_NS, RTS_NS_S + 'subscriptionType',
                                   self.subscription_type)
        if self.push_interval != 0.0:
            element.setAttributeNS(RTS_NS, RTS_NS_S + 'pushInterval',
                                   str(self.push_interval))
        if self.comment:
            element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                   self.comment)
        if self.visible != True:
            element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                                   str(self.visible).lower())
        new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'sourceDataPort')
        self.source_data_port.save_xml(doc, new_element)
        element.appendChild(new_element)
        new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'targetDataPort')
        self.target_data_port.save_xml(doc, new_element)
        element.appendChild(new_element)
        for p in self.properties:
            new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                   RTS_EXT_NS_S + 'Properties')
            properties_to_xml(new_prop_element, p, self.properties[p])
            element.appendChild(new_prop_element)
715100
protected function SaveElement()
    {
        $this->submit->SetName($this->Value('Name'));
        $this->submit->SetValue($this->Value('Value'));
        return $this->submit;
    }
442843
def save_xml(self, doc, element):
        ''''''
        element.setAttributeNS(XSI_NS, XSI_NS_S + 'type', 'rtsExt:component_ext')
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'id', self.id)
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'pathUri', self.path_uri)
        if self.active_configuration_set:
            element.setAttributeNS(RTS_NS, RTS_NS_S + 'activeConfigurationSet',
                                   self.active_configuration_set)
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'instanceName',
                               self.instance_name)
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'compositeType',
                               comp_type.to_string(self.composite_type))
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'isRequired',
                               str(self.is_required).lower())
        if self.comment:
            element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                   self.comment)
        element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                               str(self.visible).lower())
        for port in self.data_ports:
            new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'DataPorts')
            port.save_xml(doc, new_element)
            element.appendChild(new_element)
        for port in self.service_ports:
            new_element = doc.createElementNS(RTS_NS,
                                              RTS_NS_S + 'ServicePorts')
            port.save_xml(doc, new_element)
            element.appendChild(new_element)
        for cs in self.configuration_sets:
            new_element = doc.createElementNS(RTS_NS,
                                              RTS_NS_S + 'ConfigurationSets')
            cs.save_xml(doc, new_element)
            element.appendChild(new_element)
        for ec in self.execution_contexts:
            new_element = doc.createElementNS(RTS_NS,
                                              RTS_NS_S + 'ExecutionContexts')
            ec.save_xml(doc, new_element)
            element.appendChild(new_element)
        for p in self.participants:
            new_element = doc.createElementNS(RTS_NS,
                                              RTS_NS_S + 'Participants')
            p.save_xml(doc, new_element)
            element.appendChild(new_element)
        new_element = doc.createElementNS(RTS_EXT_NS,
                                          RTS_EXT_NS_S + 'Location')
        self._location.save_xml(doc, new_element)
        element.appendChild(new_element)
        for p in self.properties:
            new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                   RTS_EXT_NS_S + 'Properties')
            properties_to_xml(new_prop_element, p, self.properties[p])
            element.appendChild(new_prop_element)
115670
protected void adoptElement(DomXmlElement elementToAdopt) {
    Document document = this.domElement.getOwnerDocument();
    Element element = elementToAdopt.domElement;

    if (!document.equals(element.getOwnerDocument())) {
      Node node = document.adoptNode(element);
      if (node == null) {
        throw LOG.unableToAdoptElement(elementToAdopt);
      }
    }
  }
99822
def save(self, data, xparent=None):
        
        if xparent is not None:
            elem = ElementTree.SubElement(xparent, 'dict')
        else:
            elem = ElementTree.Element('dict')

        for key, value in sorted(data.items()):
            xitem = ElementTree.SubElement(elem, 'item')
            xitem.set('key', nstr(key))
            XmlDataIO.toXml(value, xitem)

        return elem
1113053
def createElement(self, tag: str) -> Node:
        """"""
        return create_element(tag, base=self._default_class)
131393
def saveXml(self, xml):
        
        if xml is None:
            return False
        
        # save order data
        xml.set('headerState', str(self.header().saveState().toBase64()))
        xml.set('sortColumn', str(self.sortColumn()))
        xml.set('sortOrder', str(int(self.sortOrder())))
        xml.set('sortingEnabled', str(self.isSortingEnabled()))
        
        return True
777426
def to_xml
      xml = Builder::XmlMarkup.new
      case
      when @self_closing && @content_type == 'container'
        xml.tag!(@name, @attributes)
      when @value.nil?
        xml.tag!(@name, @attributes.merge!("xsi:nil" => "true"))
      when ::Hash === @value
        xml.tag!(@name, @attributes) { xml << XmlFu::Hash.to_xml(@value) }
      when ::Array === @value
        case @content_type
        when "collection"
          xml << XmlFu::Array.to_xml(@value.flatten, {
            :key => (@self_closing ? "#{@name}/" : @name),
            :attributes => @attributes,
            :content_type => "collection"
          })
        when "container"
          xml.tag!(@name, @attributes) { xml << XmlFu::Array.to_xml(@value) }
        else
          # Shouldn't be anything else
        end
      else
        xml.tag!(@name, @attributes) { xml << self.value.to_s }
      end
      xml.target!
    end
42245
public void save(final XmlWriter w) throws KNXMLException
	{
		/* XML layout:
		 <datapoint stateBased=[true|false] name=string mainNumber=int dptID=string
		 priority=string>
		 knxAddress
		 ...
		 </datapoint>
		*/
		w.writeStartElement(TAG_DATAPOINT);
		w.writeAttribute(ATTR_STATEBASED, Boolean.toString(stateBased));
		w.writeAttribute(ATTR_NAME, name);
		w.writeAttribute(ATTR_MAINNUMBER, Integer.toString(mainNo));
		w.writeAttribute(ATTR_DPTID, dptId == null ? "" : dptId);
		w.writeAttribute(ATTR_PRIORITY, priority.toString());
		main.save(w);
		doSave(w);
		w.writeEndElement();
	}
712394
function(element) {
  if ('outerHTML' in element) return element.outerHTML;
  var ns = "http://www.w3.org/1999/xhtml";
  var container = document.createElementNS(ns, '_');
  var elemProto = (window.HTMLElement || window.Element).prototype;
  var xmlSerializer = new XMLSerializer();
  var html;
  if (document.xmlVersion) {
    return xmlSerializer.serializeToString(element);
  } else {
    container.appendChild(element.cloneNode(false));
    html = container.innerHTML.replace('><', '>' + element.innerHTML + '<');
    container.innerHTML = '';
    return html;
  }
}
34532
public static String serialize(Element element) {
        Writer sw = new StringBuilderWriter();
        serialize(new DOMSource(element), sw);
        return sw.toString();
    }
655405
def _create_xml_node(tag, prefix=None, ns=None):
    """"""
    if prefix and ns:
        ET.register_namespace(prefix, ns)
    if ns:
        return ET.Element("{"+ns+"}"+tag)
    else:
        return ET.Element(tag)
886066
def create_web_element(self, element_id):
        """"""
        return self._web_element_cls(self, element_id, w3c=self.w3c)
408149
def saveXml(self, xml):
        
        # save grouping
        xtree = ElementTree.SubElement(xml, 'tree')
        self.uiRecordTREE.saveXml(xtree)
        
        # save the query
        query = self.query()
        if query:
            query.toXml(ElementTree.SubElement(xml, 'query'))