Generator for an XML row
5658
def xml_row(row, lang):
    '''
    
    '''
    for elem in row:
        name = elem.get('name')
        child = elem[0]
        ftype = re.sub(r'\{[^}]+\}', '', child.tag)
        if ftype == 'literal':
            ftype = '{}, {}'.format(ftype, child.attrib.get(XML_LANG, 'none'))
        yield (name, (child.text, ftype))
109037
function getAllChildRowIndex(row) {
    // if(row.allChildRowIndex && row.allChildRowIndex.length > 0){
    // 	return row.allChildRowIndex;
    // }
    row.allChildRowIndex = new Array();
    this.getAllChildRowIndexFun(row, row.allChildRowIndex);
    return row.allChildRowIndex;
}
510266
private ObjectNode convertRow(ObjectNode reuse, RowTypeInfo info, Row row) {
		if (reuse == null) {
			reuse = mapper.createObjectNode();
		}
		final String[] fieldNames = info.getFieldNames();
		final TypeInformation<?>[] fieldTypes = info.getFieldTypes();

		// validate the row
		if (row.getArity() != fieldNames.length) {
			throw new IllegalStateException(String.format(
				"Number of elements in the row '%s' is different from number of field names: %d", row, fieldNames.length));
		}

		for (int i = 0; i < fieldNames.length; i++) {
			final String name = fieldNames[i];

			final JsonNode fieldConverted = convert(reuse, reuse.get(name), fieldTypes[i], row.getField(i));
			reuse.set(name, fieldConverted);
		}

		return reuse;
	}
553784
def row_iter(self):
        """"""
        for k in utils.range_(self.side):
            yield self.row(k)
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)
22417
public static void appendXMLToTable(final TableRow row, final XMLUtil xmlUtil,
                                        final Appendable appendable) throws IOException {
        if (row == null) appendable.append("<row />");
        else row.appendXMLToTable(xmlUtil, appendable);
    }
230347
def item_at(self, row, column):
        
        return self.children[str(row)].children[str(column)]
539481
void generateRaXml(Definition def, String outputDir)
   {
      if (!def.isUseAnnotation())
      {
         try
         {
            outputDir = outputDir + File.separatorChar + "src" + File.separatorChar +
                  "main" + File.separatorChar + "resources";
            FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
            RaXmlGen raGen = getRaXmlGen(def);
            raGen.generate(def, rafw);
            rafw.close();
         }
         catch (IOException ioe)
         {
            ioe.printStackTrace();
         }
      }
   }
1252524
function TR(options, items) {
    options = options || {};

    this.title = options.title || '';
    this.link = options.link || '';
    this.description = options.description || '';
    this.language = options.language || 'ru';

    this.items = items || [];

    this.item = function (data) {
        data = data || {};
        this.items.push(itemData(data));
        return this;
    };

    this.xml = function () {
        return xml(generateXML(this));
    };
}
1365681
def iter_rows(self, start=None, end=None):
        """"""
        start = start or 0
        end = end or self.nrows
        for i in range(start, end):
            yield self.iloc[i, :]
513960
private String genXML(Set nodes) throws IOException {
        Iterator it = nodes.iterator();
        StringBuffer buf = new StringBuffer(1024);
        buf.append(StateHelper.XML_DOC_START);
        buf.append(getSynchInterval());
        buf.append(StateHelper.XML_DOC_START_END);
        while (it.hasNext()) {
            Node n = (Node) it.next();
            buf.append(StateHelper.XML_NODE_TAG_START);
            buf.append(StateHelper.encodeMACAddress(n.getNodeIdentifier()));
            buf.append(StateHelper.XML_NODE_TAG_AFTER_ID);
            buf.append(n.getClockSequence());
            buf.append(StateHelper.XML_NODE_TAG_AFTER_CSEQ);
            buf.append(n.getLastTimestamp());
            buf.append(StateHelper.XML_NODE_TAG_END);
        }
        buf.append(StateHelper.XML_DOC_END);
        return buf.toString();
    }
806635
def row_factory(cursor, row):
    """"""
    d = {}
    for idx, col in enumerate(cursor.description):
        d[col[0]] = row[idx]
    return d
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'
506653
def xml_records(filename):
    
    with Evtx(filename) as evtx:
        for xml, record in evtx_file_xml_view(evtx.get_file_header()):
            try:
                yield to_lxml(xml), None
            except etree.XMLSyntaxError as e:
                yield xml, e
473532
def raw_row_generator(self):
        """"""
        from rowgenerators import get_generator

        self.doc.set_sys_path()  # Set sys path to package 'lib' dir in case of python function generator

        ru = self.resolved_url

        try:
            resource = ru.resource # For Metapack urls

            return resource.row_generator
        except AttributeError:
            pass

        ut = ru.get_resource().get_target()

        # Encoding is supposed to be preserved in the URL but isn't
        source_url = parse_app_url(self.url)

        # source_url will be None for Sql terms.

        ut.encoding = self.get_value('encoding') or (source_url.encoding if source_url else None)

        g = get_generator(ut,  resource=self,
                          doc=self._doc, working_dir=self._doc.doc_dir,
                          env=self.env)

        assert g, ut

        return g
102316
def _build_row(self, row, parent, align, border):
        
        tr = etree.SubElement(parent, 'tr')
        tag = 'td'
        if parent.tag == 'thead':
            tag = 'th'
        cells = self._split_row(row, border)
        # We use align here rather than cells to ensure every row
        # contains the same number of columns.
        for i, a in enumerate(align):
            c = etree.SubElement(tr, tag)
            try:
                c.text = cells[i].strip()
            except IndexError:
                c.text = ""
            if a:
                c.set('align', a)
488844
def yield_rows(adapter):
    ''''''
    csvfile = StringIO()
    writer = get_writer(csvfile)
    # Generate header
    writer.writerow(adapter.header())
    yield csvfile.getvalue()
    del csvfile

    for row in adapter.rows():
        csvfile = StringIO()
        writer = get_writer(csvfile)
        writer.writerow(row)
        yield csvfile.getvalue()
        del csvfile