Opened 16 years ago

Closed 16 years ago

#1669 defect closed fixed (fixed)

Parser in domish does not keep unreferenced namespace declarations

Reported by: ff Owned by:
Priority: normal Milestone:
Component: words Keywords:
Cc: Branch:


When parsing xml chunks like this one

<SOAP-ENV:Envelope xmlns:SOAP-ENC=''
<TheMethod SOAP-ENC:root='1'>
<v1 xsi:type='xsd:string'>p1</v1>
<v2 xsi:type='xsd:string'>p2</v2>

and then re-serializing it, the parser in domish produces an output like the following one:

<xn0:Envelope xmlns:xn0=''
<TheMethod xmlns:xn1='' 
<v1 xmlns:xn2=''
<v2 xmlns:xn2=''

In the result the declaration xmlns:xsd='' is no more reported, because it is not explicitely used in the document, but as value of xsi:type attribute. The usage of qualifying namespaces in attribute values is questioned, but used in SOAP, WSDL, XSLT and XML Schemas. For this reason it is important to keep track of namespace declarations where they are found, even if not used in the document.

A possibile solution could be to store namespace declarations as regular attributes of the elements where they appear.

Change History (6)

comment:1 Changed 16 years ago by Ralph Meijer

Owner: changed from Jean-Paul Calderone to Ralph Meijer
Status: newassigned

comment:2 Changed 16 years ago by Ralph Meijer

Owner: Ralph Meijer deleted
Status: assignednew

This is fixed in source:branches/domish-keep-prefixes-1669. Also, I fixed DomishStreamTests to not use xpath, but interact with the Element objects directly.

comment:3 Changed 16 years ago by Ralph Meijer

Keywords: review added

comment:4 Changed 16 years ago by tld

Keywords: review removed

Code seems fine to me. Could use more test cases, but then again, I always think code could use more test cases.

comment:5 Changed 16 years ago by Ralph Meijer

Resolution: fixed
Status: newclosed

(In [16718]) Local prefix storage

Author: ralphm Reviewer: tld Fixes #1669

This allows for elements to store namespace declarations. When parsing and subsequential serialization, the result should have the same prefixes defined in the same place in the element tree.

  • Fix a parsing issue in the expat based parser so that the default namespace is , not None for prefixed elements without a bare xmlns declaration.
  • Redo DomishStreamTests to not use xpath, but interact with the Element objects themselves.

comment:6 Changed 11 years ago by <automation>

Note: See TracTickets for help on using tickets.