quick-xml icon indicating copy to clipboard operation
quick-xml copied to clipboard

Reader Namespaces at the current level

Open jose-pr opened this issue 4 years ago • 3 comments

I would like to suggest two functions be added to the reader

  • Add a function to resolve a prefix to a namespace, currently you need a qname (prefix+":"+name)
  • Add a function to get an iterator or vec of all the current namespaces, returning (ns_prefix, ns_uri)

jose-pr avatar Aug 14 '21 20:08 jose-pr

Would you mind writing a PR?

tafia avatar Aug 18 '21 01:08 tafia

I'm curious. Is the mapping of the namespace alias to the canonical URI stored anywhere currently? If so, does that storage method allow reassigning aliases in child levels?

wt avatar Jan 24 '23 18:01 wt

Is the mapping of the namespace alias to the canonical URI stored anywhere currently?

Yes, of course: https://github.com/tafia/quick-xml/blob/add740632a62e0cfdef022e0bdf960009f63f611/src/reader/ns_reader.rs#L27-L28

If so, does that storage method allow reassigning aliases in child levels?

Yes, see the implementation of this struct: https://github.com/tafia/quick-xml/blob/add740632a62e0cfdef022e0bdf960009f63f611/src/name.rs#L390-L400

Mingun avatar Jan 24 '23 19:01 Mingun