Skip to content

Encoded characters are decoded in output? #2

@bandophahita

Description

@bandophahita

Is there a way of preventing the Formatter.format_string() from decoding encoded characters in the original xml?

Example:

xmlstr = """<ogc:Filter someattrib="example with encoded chars &lt; &gt; that should stay encoded"><ogc:PropertyIsEqualTo><ogc:PropertyName>stationid_alpha</ogc:PropertyName><ogc:Literal>val</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>"""
formatter = xmlformatter.Formatter()
outstr = formatter.format_string(xmlstr)
print outstr

Output:

<ogc:Filter someattrib="example with encoded chars < > that should stay encoded">
  <ogc:PropertyIsEqualTo>
    <ogc:PropertyName>stationid_alpha</ogc:PropertyName>
    <ogc:Literal>val</ogc:Literal>
  </ogc:PropertyIsEqualTo>
</ogc:Filter>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions