Generate a DC XML string.
332616
def generate_dc_xml(dc_dict):
    """"""
    # Define the root namespace.
    root_namespace = '{%s}' % DC_NAMESPACES['oai_dc']
    # Set the elements namespace URL.
    elements_namespace = '{%s}' % DC_NAMESPACES['dc']
    schema_location = ('http://www.openarchives.org/OAI/2.0/oai_dc/ '
                       'http://www.openarchives.org/OAI/2.0/oai_dc.xsd')
    root_attributes = {
        '{%s}schemaLocation' % XSI: schema_location,
    }
    # Return the DC XML string.
    return pydict2xmlstring(
        dc_dict,
        ordering=DC_ORDER,
        root_label='dc',
        root_namespace=root_namespace,
        elements_namespace=elements_namespace,
        namespace_map=DC_NAMESPACES,
        root_attributes=root_attributes,
    )
591840
def generate(self):
        """"""
        base = ''
        if self.xml_base:
            base = ' xml:base="%s"' % escape(self.xml_base, True)
        yield u'<entry%s>\n' % base
        yield u'  ' + _make_text_block('title', self.title, self.title_type)
        yield u'  <id>%s</id>\n' % escape(self.id)
        yield u'  <updated>%s</updated>\n' % format_iso8601(self.updated, self.timezone)
        if self.published:
            yield u'  <published>%s</published>\n' % \
                  format_iso8601(self.published, self.timezone)
        if self.url:
            yield u'  <link href="%s" />\n' % escape(self.url)
        for author in self.author:
            yield u'  <author>\n'
            yield u'    <name>%s</name>\n' % escape(author['name'])
            if 'uri' in author:
                yield u'    <uri>%s</uri>\n' % escape(author['uri'])
            if 'email' in author:
                yield u'    <email>%s</email>\n' % escape(author['email'])
            yield u'  </author>\n'
        for link in self.links:
            yield u'  <link %s/>\n' % ''.join('%s="%s" ' % \
                (k, escape(link[k], True)) for k in link)
        if self.summary:
            yield u'  ' + _make_text_block('summary', self.summary,
                                           self.summary_type)
        if self.content:
            if issubclass(self.content.__class__, dict):
                if "content" in self.content:
                    yield u'  <content %s>%s</content>\n' % (' '.join('%s="%s"' % \
                        (k, escape(self.content[k], True)) for k in self.content if k != "content"), escape(self.content["content"]))
                else:
                    yield u'  <content %s/>\n' % ' '.join('%s="%s" ' % \
                        (k, escape(self.content[k], True)) for k in self.content)
            else:
                yield u'  ' + _make_text_block('content', self.content,
                                           self.content_type)
        yield u'</entry>\n'
805967
def to_xml(self):
        """"""
        assert self.connection != None
        s = '<?xml version="1.0" encoding="UTF-8"?>\n'
        s += '<InvalidationBatch xmlns="http://cloudfront.amazonaws.com/doc/%s/">\n' % self.connection.Version
        for p in self.paths:
            s += '    <Path>%s</Path>\n' % self.escape(p)
        s += '    <CallerReference>%s</CallerReference>\n' % self.caller_reference
        s += '</InvalidationBatch>\n'
        return s
35193
def toxml(self):
        

        return '<ComponentRequirement name="{0}"'.format(self.name) + '' + \
            (' description = "{0}"'.format(self.description) if self.description else '') +\
            '/>'
401445
def generate(basename, xml_list):
    ''''''

    for idx in range(len(xml_list)):
        xml = xml_list[idx]
        xml.xml_idx = idx
        generate_one(basename, xml)
    copy_fixed_headers(basename, xml_list[0])
787180
public function generateXMLRequestString()
    {
        $enabledMetadataTypes = array();
        if ($this->enableSocialTags) {
            $enabledMetadataTypes[] = 'GenericRelations';
        }
        if ($this->enableGenericRelations) {
            $enabledMetadataTypes[] = 'SocialTags';
        }

        $xml  = '<c:params xmlns:c="http://s.opencalais.com/1/pred/" ';
        $xml .= 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">';
        $xml .= '<c:processingDirectives ';
        $xml .= 'c:contentType="' . $this->contentType . '" ';
        $xml .= 'c:enableMetadataType="' . implode(',', $enabledMetadataTypes) . '" ';
        $xml .= 'c:outputFormat="' . $this->outputFormat . '" ';
        $xml .= 'c:docRDFaccessible="' . ($this->docRDFaccessible ? 'true' : 'false') . '" ';
        $xml .= '></c:processingDirectives>';
        $xml .= '<c:userDirectives ';
        $xml .= 'c:allowDistribution="' . ($this->allowDistribution ? 'true' : 'false') . '" ';
        $xml .= 'c:allowSearch="' . ($this->allowSearch ? 'true' : 'false') . '" ';
        $xml .= '></c:userDirectives>';
        $xml .= '<c:externalMetadata></c:externalMetadata>';
        $xml .= '</c:params>';

        return $xml;
    }
115608
def to_xml_string(str = '')
      # macro attribute should be optional!
      str << '<xdr:graphicFrame>'
      str << '<xdr:nvGraphicFramePr>'
      str << ('<xdr:cNvPr id="' << @anchor.drawing.index.to_s << '" name="' << 'item_' << @anchor.drawing.index.to_s << '"/>')
      str << '<xdr:cNvGraphicFramePr/>'
      str << '</xdr:nvGraphicFramePr>'
      str << '<xdr:xfrm>'
      str << '<a:off x="0" y="0"/>'
      str << '<a:ext cx="0" cy="0"/>'
      str << '</xdr:xfrm>'
      str << '<a:graphic>'
      str << ('<a:graphicData uri="' << XML_NS_C << '">')
      str << ('<c:chart xmlns:c="' << XML_NS_C << '" xmlns:r="' << XML_NS_R << '" r:id="' << rId << '"/>')
      str << '</a:graphicData>'
      str << '</a:graphic>'
      str << '</xdr:graphicFrame>'
    end
639974
void generateMbeanXml(Definition def, String outputDir)
   {
      String mbeanName = def.getDefaultValue().toLowerCase(Locale.US);
      if (def.getRaPackage() != null && !def.getRaPackage().equals(""))
      {
         if (def.getRaPackage().indexOf('.') >= 0)
         {
            mbeanName = def.getRaPackage().substring(def.getRaPackage().lastIndexOf('.') + 1);
         }
         else
            mbeanName = def.getRaPackage();
      }

      try
      {
         outputDir = outputDir + File.separatorChar + "src" + File.separatorChar +
               "main" + File.separatorChar + "resources" + File.separatorChar + "jca";
         FileWriter mbfw = Utils.createFile(mbeanName + ".xml", outputDir);
         MbeanXmlGen mbGen = new MbeanXmlGen();
         mbGen.generate(def, mbfw);
         mbfw.close();
      }
      catch (IOException ioe)
      {
         ioe.printStackTrace();
      }
   }
1277926
def gen_xml_doc(self):
        
        res = self.make_doc()
        var_tag = """
        <text:user-field-decl office:value-type="string"
        office:string-value="%s" text:name="py3o.%s"/>"""
        text_tag = """<text:p text:style-name="P1">
            <text:user-field-get text:name="py3o.%s">%s</text:user-field-get>
        </text:p>
        """
        keys = res.keys()
        keys.sort()
        texts = ""
        vars = ""
        for key in keys:
            value = res[key]
            vars += var_tag % (value, key)
            texts += text_tag % (key, value)
        return CONTENT_TMPL % (vars, texts)
1294790
def toxml(self):
        

        return '<ComponentReference name="{0}" type="{1}"'.format(self.name, self.type) + \
          (' local = "{0}"'.format(self.local) if self.local else '') + \
            '/>'
877338
def to_xml_string(str = '')
      super(str) do
        str << ("<c:" << node_name << ">")
        str << ('<c:grouping val="' << grouping.to_s << '"/>')
        str << ('<c:varyColors val="' << vary_colors.to_s << '"/>')
        @series.each { |ser| ser.to_xml_string(str) }
        @d_lbls.to_xml_string(str) if @d_lbls
        yield if block_given?
        axes.to_xml_string(str, :ids => true)
        str << ("</c:" << node_name << ">")
        axes.to_xml_string(str)
      end
    end
1254833
def generate(basename, xml_list):
    """"""

    if os.path.isdir(basename):
        filename = os.path.join(basename, 'MAVLink.swift')
    else:
        filename = basename

    msgs = []
    enums = []
    filelist = []
    for xml in xml_list:
        msgs.extend(xml.message)
        enums.extend(xml.enum)
        filelist.append(os.path.basename(xml.filename))
    
    outf = open(filename, "w")
    generate_header(outf, filelist, xml_list)
    generate_enums_info(enums, msgs)
    generate_enums(outf, enums, msgs)
    generate_messages_info(msgs)
    generate_messages(outf, msgs)
    append_static_code('Parser.swift', outf)
    generate_message_mappings_array(outf, msgs)
    generate_message_lengths_array(outf, msgs)
    generate_message_crc_extra_array(outf, msgs)
    outf.close()
429678
def to_xml_string(str='')
      add_worksheet(name: 'Sheet1') unless worksheets.size > 0
      str << '<?xml version="1.0" encoding="UTF-8"?>'
      str << ('<workbook xmlns="' << XML_NS << '" xmlns:r="' << XML_NS_R << '">')
      str << ('<workbookPr date1904="' << @@date1904.to_s << '"/>')
      views.to_xml_string(str)
      str << '<sheets>'
      if is_reversed
        worksheets.reverse_each { |sheet| sheet.to_sheet_node_xml_string(str) }
      else
        worksheets.each { |sheet| sheet.to_sheet_node_xml_string(str) }
      end
      str << '</sheets>'
      defined_names.to_xml_string(str)
      unless pivot_tables.empty?
        str << '<pivotCaches>'
        pivot_tables.each do |pivot_table|
          str << ('<pivotCache cacheId="' << pivot_table.cache_definition.cache_id.to_s << '" r:id="' << pivot_table.cache_definition.rId << '"/>')
        end
        str << '</pivotCaches>'
      end
      str << '</workbook>'
    end
1041982
private String prepareXmlForParsing(String xml) throws TheDavidBoxClientException{
		//Escape all & symbols in the response so it can parse it later
		xml = xml.replaceAll("&", "&amp;");
		
		String xmlReady;
		try {
			//It repairs the encoding to allow all utf-8 symbols
			xmlReady = new String(xml.getBytes(), CHARSET_ENCODING);
		} catch (UnsupportedEncodingException e) {
			throw new TheDavidBoxClientException(e);
		}
		return xmlReady;
	}
378559
def toxml(self):
        

        return '<DerivedParameter name="{0}"'.format(self.name) +\
          (' dimension="{0}"'.format(self.dimension) if self.dimension else '') +\
          (' value="{0}"'.format(self.value) if self.value else '') +\
          '/>'
1265719
def generate(basename, xml):
    ''''''
    if basename.endswith('.lua'):
        filename = basename
    else:
        filename = basename + '.lua'

    msgs = []
    enums = []
    filelist = []
    for x in xml:
        msgs.extend(x.message)
        enums.extend(x.enum)
        filelist.append(os.path.basename(x.filename))

    for m in msgs:
        if xml[0].little_endian:
            m.fmtstr = '<'
        else:
            m.fmtstr = '>'
        for f in m.ordered_fields:
            m.fmtstr += mavfmt(f)
        m.order_map = [ 0 ] * len(m.fieldnames)
        for i in range(0, len(m.fieldnames)):
            m.order_map[i] = m.ordered_fieldnames.index(m.fieldnames[i])

    print("Generating %s" % filename)
    outf = open(filename, "w")
    generate_preamble(outf)
    generate_msg_table(outf, msgs)
    generate_body_fields(outf)
    
    for m in msgs:
        generate_msg_fields(outf, m)
    
    for m in msgs:
        generate_payload_dissector(outf, m)
    
    generate_packet_dis(outf)
#    generate_enums(outf, enums)
#    generate_message_ids(outf, msgs)
#    generate_classes(outf, msgs)
#    generate_mavlink_class(outf, msgs, xml[0])
#    generate_methods(outf, msgs)
    generate_epilog(outf)
    outf.close()
    print("Generated %s OK" % filename)
674017
def highwiredict2xmlstring(highwire_elements, ordering=HIGHWIRE_ORDER):
    """"""
    # Sort the elements by the ordering list.
    highwire_elements.sort(key=lambda obj: ordering.index(obj.name))
    root = Element('metadata')
    for element in highwire_elements:
        attribs = {'name': element.name, 'content': element.content}
        SubElement(root, 'meta', attribs)
    # Create the XML tree.
    return '<?xml version="1.0" encoding="UTF-8"?>\n' + tostring(
        root,
        pretty_print=True
    )