Skip to content

Problem when writing attributes when using namespaces #42 #44

@mat813

Description

@mat813

Hi,

I was continuing to try and figure out where the problem was for AS207960/xml-serde#15, and I ended up thinking that the problem is somehow not in xml_serde but in xml-rs.

After adding a lot of tracing to xml-rs, and quickly writing a "debug passthrough" Write impl, what I end up with is this.

xml::writer::emitter::emit_start_element gets called with this:

self= Emitter {
  config: EmitterConfig {
    line_separator: "\n",
    indent_string: "  ",
    perform_indent: true,
    perform_escaping: false,
    write_document_declaration: true,
    normalize_empty_elements: true,
    cdata_to_characters: true,
    keep_element_names_stack: true,
    autopad_comments: true,
    pad_self_closing: false
  },
  nst: NamespaceStack([Namespace({"": "domain"})]),
  indent_level: 0,
  indent_stack: [WroteNothing],
  element_names: [],
  start_document_emitted: false,
  just_wrote_start_element: false
}
name=Name {
  local_name: "stuff",
  namespace: None,
  prefix: None
}
attributes=[
  Attribute { name: Name { local_name: "a", namespace: Some("domain"), prefix: None }, value: "123" }
]

What the writer gets is this:

buf: "<"
buf: "stuff"
buf: " a"
buf: "=\""
buf: "123"
buf: "\""
buf: ">"
buf: "foobar"
buf: "</"
buf: "stuff"
buf: ">"

So, from what I understand, the attribute is passed correctly to xml-rs, but the output of the attribute of the does not contain a namespace.

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