The unicode XML snippet for the ``<c:cat>`` element for this series,
        containing the category labels and spreadsheet reference.
485068
def cat_xml(self):
        
        categories = self._series.categories

        if categories.are_numeric:
            return self._numRef_cat_tmpl.format(**{
                'wksht_ref':     self._series.categories_ref,
                'number_format': categories.number_format,
                'cat_count':     categories.leaf_count,
                'cat_pt_xml':    self._cat_num_pt_xml,
                'nsdecls':       '',
            })

        if categories.depth == 1:
            return self._cat_tmpl.format(**{
                'wksht_ref':  self._series.categories_ref,
                'cat_count':  categories.leaf_count,
                'cat_pt_xml': self._cat_pt_xml,
                'nsdecls':    '',
            })

        return self._multiLvl_cat_tmpl.format(**{
            'wksht_ref': self._series.categories_ref,
            'cat_count': categories.leaf_count,
            'lvl_xml':   self._lvl_xml(categories),
            'nsdecls':   '',
        })
1337792
def xmllint_format(xml):
    
    parser = ET.XMLParser(resolve_entities=False, strip_cdata=False, remove_blank_text=True)
    document = ET.fromstring(xml, parser)
    return ('%s\n%s' % ('<?xml version="1.0" encoding="UTF-8"?>', ET.tostring(document, pretty_print=True).decode('utf-8'))).encode('utf-8')
331581
def xmlchars(text):
    
    invalid = list(range(0x9))
    invalid.extend([0xb, 0xc])
    invalid.extend(range(0xe, 0x20))
    return re.sub('|'.join('\\x%0.2X' % i for i in invalid), '', text)
1076908
def pretty_xml(string_input, add_ns=False):
    
    if add_ns:
        elem = "<foo "
        for key, value in DOC_CONTENT_ATTRIB.items():
            elem += ' %s="%s"' % (key, value)
        string_input = elem + ">" + string_input + "</foo>"
    doc = minidom.parseString(string_input)
    if add_ns:
        s1 = doc.childNodes[0].childNodes[0].toprettyxml("  ")
    else:
        s1 = doc.toprettyxml("  ")
    return s1
1076941
def xml(self) -> _BaseXML:
        
        if self._xml:
            return self.raw_xml.decode(self.encoding)
        else:
            return etree.tostring(self.element, encoding='unicode').strip()
1076963
def cat(self):
        
        categories = self._series.categories

        if categories.are_numeric:
            return parse_xml(
                self._numRef_cat_tmpl.format(**{
                    'wksht_ref':     self._series.categories_ref,
                    'number_format': categories.number_format,
                    'cat_count':     categories.leaf_count,
                    'cat_pt_xml':    self._cat_num_pt_xml,
                    'nsdecls':       ' %s' % nsdecls('c'),
                })
            )

        if categories.depth == 1:
            return parse_xml(
                self._cat_tmpl.format(**{
                    'wksht_ref':  self._series.categories_ref,
                    'cat_count':  categories.leaf_count,
                    'cat_pt_xml': self._cat_pt_xml,
                    'nsdecls':    ' %s' % nsdecls('c'),
                })
            )

        return parse_xml(
            self._multiLvl_cat_tmpl.format(**{
                'wksht_ref': self._series.categories_ref,
                'cat_count': categories.leaf_count,
                'lvl_xml':   self._lvl_xml(categories),
                'nsdecls':   ' %s' % nsdecls('c'),
            })
        )
699039
def xml(self):
        

        self.pendingvalidation()

        E = ElementMaker(namespace="http://ilk.uvt.nl/folia",nsmap={'xml' : "http://www.w3.org/XML/1998/namespace", 'xlink':"http://www.w3.org/1999/xlink"})
        attribs = {}
        attribs['{http://www.w3.org/XML/1998/namespace}id'] = self.id

        #if self.version:
        #    attribs['version'] = self.version
        #else:
        attribs['version'] = FOLIAVERSION

        attribs['generator'] = 'pynlpl.formats.folia-v' + LIBVERSION

        metadataattribs = {}
        metadataattribs['{' + NSFOLIA + '}type'] = self.metadatatype

        if isinstance(self.metadata, ExternalMetaData):
            metadataattribs['{' + NSFOLIA + '}src'] = self.metadata.url

        e = E.FoLiA(
            E.metadata(
                E.annotations(
                    *self.xmldeclarations()
                ),
                *self.xmlmetadata(),
                **metadataattribs
            )
            , **attribs)
        for text in self.data:
            e.append(text.xml())
        return e
90993
def snr_series_to_xml(snr_series, document, sngl_inspiral_id):
    
    snr_lal = snr_series.lal()
    snr_lal.name = 'snr'
    snr_lal.sampleUnits = ''
    snr_xml = _build_series(snr_lal, (u'Time', u'Time,Real,Imaginary'), None,
                            'deltaT', 's')
    snr_node = document.childNodes[-1].appendChild(snr_xml)
    eid_param = ligolw_param.Param.build(u'event_id', u'ilwd:char',
                                         sngl_inspiral_id)
    snr_node.appendChild(eid_param)
1265790
def xml(self, indent = ""):
        """"""
        xml = indent + "<InputTemplate id=\""+self.id+"\" format=\"" + self.formatclass.__name__ + "\"" + " label=\"" + self.label + "\""
        if self.formatclass.mimetype:
            xml +=" mimetype=\""+self.formatclass.mimetype+"\""
        if self.formatclass.schema:
            xml +=" schema=\""+self.formatclass.schema+"\""
        if self.filename:
            xml +=" filename=\""+self.filename+"\""
        if self.extension:
            xml +=" extension=\""+self.extension+"\""
        if self.optional:
            xml +=" optional=\"yes\""
        else:
            xml +=" optional=\"no\""
        if self.unique:
            xml +=" unique=\"yes\""
        else:
            xml +=" unique=\"no\""
        if self.acceptarchive:
            xml +=" acceptarchive=\"yes\""
        else:
            xml +=" acceptarchive=\"no\""
        xml += ">\n"
        for parameter in self.parameters:
            xml += parameter.xml(indent+"    ") + "\n"
        if self.converters:
            for converter in self.converters:
                xml += indent + "    <converter id=\""+converter.id+"\">"+clam.common.util.xmlescape(converter.label)+"</converter>\n"
        if self.inputsources:
            for inputsource in self.inputsources:
                xml += inputsource.xml(indent+"    ")
        xml += indent + "</InputTemplate>"
        return xml
834782
def _parse_categories(element):
    
    reference = {}
    items = element.findall("./{%s}category" % WP_NAMESPACE)

    for item in items:
        term_id = item.find("./{%s}term_id" % WP_NAMESPACE).text
        nicename = item.find("./{%s}category_nicename" % WP_NAMESPACE).text
        name = item.find("./{%s}cat_name" % WP_NAMESPACE).text
        parent = item.find("./{%s}category_parent" % WP_NAMESPACE).text

        category = {
            "term_id": term_id,
            "nicename": nicename,
            "name": name,
            "parent": parent
        }

        reference[nicename] = category

    return _build_category_tree(None, reference=reference)
101224
function unicode2xml(unicodeList) {
    if (typeof unicodeList === 'number') {
        unicodeList = [unicodeList];
    }
    return unicodeList.map(function (u) {
        if (u < 0x20) {
            return '';
        }
        return u >= 0x20 && u <= 255
            ? string.encodeHTML(String.fromCharCode(u).toLowerCase())
            : '&#x' + u.toString(16) + ';';
    }).join('');
}
1116598
def _lvl_xml(self, categories):
        
        def lvl_pt_xml(level):
            xml = ''
            for idx, name in level:
                xml += (
                    '                  <c:pt idx="%d">\n'
                    '                    <c:v>%s</c:v>\n'
                    '                  </c:pt>\n'
                ) % (idx, escape('%s' % name))
            return xml

        xml = ''
        for level in categories.levels:
            xml += (
                '                <c:lvl>\n'
                '{lvl_pt_xml}'
                '                </c:lvl>\n'
            ).format(**{
                'lvl_pt_xml': lvl_pt_xml(level),
            })
        return xml
367370
def toxml(self):
        

        return '<Dimension name="{0}"'.format(self.name) +\
          (' m = "{0}"'.format(self.m) if self.m != 0 else '') +\
          (' l = "{0}"'.format(self.l) if self.l != 0 else '') +\
          (' t = "{0}"'.format(self.t) if self.t != 0 else '') +\
          (' i = "{0}"'.format(self.i) if self.i != 0 else '') +\
          (' k = "{0}"'.format(self.k) if self.k != 0 else '') +\
          (' n = "{0}"'.format(self.n) if self.n != 0 else '') +\
          (' j = "{0}"'.format(self.j) if self.j != 0 else '') +\
          '/>'
129522
def toXMLFeed(self):
        
        feed = self.toXML()

        xml_header = '<?xml version="1.0" encoding="UTF-8"?>\n'
        return xml_header + feed.toprettyxml(indent='  ')
1331119
def toxml(self):
        

        return '<With ' + \
          (' instance="{0}"'.format(self.instance) if self.instance else '') +\
          (' list="{0}"'.format(self.list) if self.list else '') + \
          (' index="{0}"'.format(self.index) if self.index else '') + \
          ' as="{1}"/>'.format(self.instance, self.as_)
1149079
def toxml(self):
        

        # Probably name should be removed altogether until its usage is decided, see
        # https://github.com/LEMS/LEMS/issues/4
        #  '''(' name = "{0}"'.format(self.name) if self.name else '') +\'''

        return '<Unit' +\
          (' symbol = "{0}"'.format(self.symbol) if self.symbol else '') +\
          (' dimension = "{0}"'.format(self.dimension) if self.dimension else '') +\
          (' power = "{0}"'.format(self.power) if self.power else '') +\
          (' scale = "{0}"'.format(self.scale) if self.scale else '') +\
          (' offset = "{0}"'.format(self.offset) if self.offset else '') +\
          (' description = "{0}"'.format(self.description) if self.description else '') +\
          '/>'
612827
def add_category_to_xml(xmldoc)
      return if category_name.to_s.empty?
      cat_elem = REXML::Element.new('category')

      if self.class::CATEGORY_DATA_TYPE == String
        cat_elem.text = @category_name.to_s
      elsif self.class::CATEGORY_DATA_TYPE == Hash
        cat_elem.add_element('name').text = @category_name.to_s
      else
        raise JSS::InvalidDataError, "Uknown CATEGORY_DATA_TYPE for class #{self.class}"
      end

      root = xmldoc.root

      if self.class::CATEGORY_SUBSET == :top
        root.add_element cat_elem
        return
      end

      parent = root.elements[self.class::CATEGORY_SUBSET.to_s]
      parent ||= root.add_element self.class::CATEGORY_SUBSET.to_s
      parent.add_element cat_elem
    end