SAXSerializer does not transmit namespace declarations as attributes
Hi all, I am using the SAXSerializer to generate SAX events from an org.basex.query.value.item.Item instance.
The Item instance represents the database doc's root in this specific case:
<r:root xmlns:r="r" xmlns:x="x" x:attr="test">
</r:root>It seems that when the following method is called:
org.xml.sax.ContentHandler.startElement(String, String, String, Attributes)
the attributes map is missing namespace declarations (I would expect the ns declarations to be mapped to attributes).
I.e. the above r:root element will be provided with just the x:attr in the attributes map, but not the xmlns:x as attribute.
Do you have any solutions for this issue? How do I get the namespaces when startElement() is executed?
Thanks!
Hi Erdal,
I remember that the SAXSerializer class was written by one of our users [1]. Maybe you are interested in having a closer look at the code?
Christian
Quoted text · Erdal Karaca · 24 lines
On Wed, Nov 19, 2014 at 9:29 PM, Erdal Karaca <erdal.karaca.de at gmail.com> wrote: > Hi all, > I am using the SAXSerializer to generate SAX events from an > org.basex.query.value.item.Item instance. > > The Item instance represents the database doc's root in this specific case: > > <r:root xmlns:r="r" xmlns:x="x" x:attr="test"> > </r:root> > > It seems that when the following method is called: > > org.xml.sax.ContentHandler.startElement(String, String, String, Attributes) > > the attributes map is missing namespace declarations (I would expect the ns > declarations to be mapped to attributes). > > I.e. the above r:root element will be provided with just the x:attr in the > attributes map, but not the xmlns:x as attribute. > > Do you have any solutions for this issue? How do I get the namespaces when > startElement() is executed? > > Thanks!
Written for BaseX 7.9. BaseX may have changed since: please check the current documentation.