Return the REST XML for this item, with the current values,
 for saving or updating
491713
def rest_xml
      uea = rest_rexml
      doc = REXML::Document.new APIConnection::XML_HEADER
      doc << uea
      return doc.to_s
    end
953953
def to_xml(self):
        '''
        
        '''
        for n, v in { "amount": self.amount, "date": self.date,
                     "method":self.method}.items():
            if is_empty_or_none(v):
                raise PaymentError("'%s' attribute cannot be empty or " \
                                       "None." % n)

        doc = Document()
        root = doc.createElement("payment")
        super(Payment, self).to_xml(root)
        self._create_text_node(root, "amount", self.amount)
        self._create_text_node(root, "method", self.method)
        self._create_text_node(root, "reference", self.ref, True)
        self._create_text_node(root, "date", self.date)
        return root
237086
def xml(self, indent = ""):
        """""" #(independent of web.py for support in CLAM API)
        if not indent:
            xml = '<?xml version="1.0" encoding="UTF-8"?>\n'
        else:
            xml = ""
        xml += indent + "<CLAMMetaData format=\"" + self.__class__.__name__ + "\""
        if self.mimetype:
            xml += " mimetype=\""+self.mimetype+"\""
        if self.schema:
            xml += " schema=\""+self.schema+"\""
        if self.inputtemplate:
            xml += " inputtemplate=\""+self.inputtemplate+"\""
        xml += ">\n"

        for key, value in self.data.items():
            xml += indent + "  <meta id=\""+clam.common.util.xmlescape(key)+"\">"+clam.common.util.xmlescape(str(value))+"</meta>\n"

        if self.provenance:
            xml += self.provenance.xml(indent + "  ")

        xml += indent +  "</CLAMMetaData>"
        return xml
1267673
def getCurrentItem(self): # TODO: rename? getCurrentItemAndIndex? getCurrentTuple? getCurrent?
        
        currentIndex = self.getRowCurrentIndex()
        currentItem = self.model().getItem(currentIndex)
        return currentItem, currentIndex
630726
def _get_xml(self, *args, **kwargs):
        
        req = self.session_xml.get(*args, **kwargs)
        return req
1222456
def _post_xml(self, *args, **kwargs):
        

        if 'timeout' not in kwargs:
            kwargs['timeout'] = self.timeout

        req = self.session_xml.post(*args, **kwargs)
        return req
567052
def xml(self):
        
        rels_elm = CT_Relationships.new()
        for rel in self.values():
            rels_elm.add_rel(
                rel.rId, rel.reltype, rel.target_ref, rel.is_external
            )
        return rels_elm.xml
38071
def update_xml_element(self):
        

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

        self.xml_element.set('system', str(self.system))
        self.xml_element.text = self.text

        return self.xml_element
953107
def CurrentNode(self):
        
        ret = libxml2mod.xmlTextReaderCurrentNode(self._o)
        if ret is None:raise treeError('xmlTextReaderCurrentNode() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
363727
def serialize(self, now=None):
        
        if self._tree is not None:
            return self._tree
        el = etree.Element(utils.lxmlns("mets") + self.tag, ID=self.id_string)
        self.subsections.sort()
        for child in self.subsections:
            el.append(child.serialize(now))
        return el
605410
def to_xml(options={})
      options[:indent] ||= 2
      xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
      xml.instruct! unless options[:skip_instruct]

      obj_name = self.class.resource_name.singularize
      
      # Turn our OpenStruct attributes into a hash we can export to XML
      obj_attrs = self.marshal_dump
      
      xml.tag!(obj_name) do
        obj_attrs.each do |key,value|
          next if key.to_sym == :link # Don't feed back links to server
          case value
            when ::Hash
              value.to_xml(
                options.merge({ 
                  :root => key, 
                  :skip_instruct => true 
                })
              )
            when ::Array
              value.to_xml(
                options.merge({ 
                  :root => key, 
                  :children => key.to_s.singularize, 
                  :skip_instruct => true
                })
              )
            else
              xml.tag!(key, value)
          end
        end
      end
    end
103771
def data(self, root):
        ''''''
        value = self.dict()
        children = [node for node in root if isinstance(node.tag, basestring)]
        for attr, attrval in root.attrib.items():
            attr = attr if self.attr_prefix is None else self.attr_prefix + attr
            value[attr] = self._fromstring(attrval)
        if root.text and self.text_content is not None:
            text = root.text.strip()
            if text:
                if self.simple_text and len(children) == len(root.attrib) == 0:
                    value = self._fromstring(text)
                else:
                    value[self.text_content] = self._fromstring(text)
        count = Counter(child.tag for child in children)
        for child in children:
            if count[child.tag] == 1:
                value.update(self.data(child))
            else:
                result = value.setdefault(child.tag, self.list())
                result += self.data(child).values()
        # if simple_text, elements with no children nor attrs become '', not {}
        if isinstance(value, dict) and not value and self.simple_text:
            value = ''
        return self.dict([(root.tag, value)])
1284734
def serialize(self, content):
        
        return self.xmldoc_tpl % (
            'true' if self.response.status_code == HTTP_200_OK else 'false',
            str(self.resource.api or ''),
            int(mktime(datetime.now().timetuple())),
            super(XMLTemplateEmitter, self).serialize(content)
        )
347208
def get(self, default=None, callback=None):
        """
        value = self._xml.text if self._xml.text else default
        return callback(value) if callback else value
780024
def update(self, data):
        
        data = values.of({'Data': serialize.object(data), })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return DocumentInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            sid=self._solution['sid'],
        )
205843
function(padId, options, callback) {
    var serializer = serializers[options.exportFormat];
    _loadPad(padId, options.revision, function(pad){
        PadProcessor.getSerializedPad(pad, commentLoader, serializer, options, function(result){
            if (prettyData && options.pretty) {
                var prettyResult = options.exportFormat === "json" ? prettyData.json(result) : prettyData.xml(result);
                callback(prettyResult);
            } else {
                callback(result);
            }
        });
    });
}
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