cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniele Madama" <>
Subject Re: Problem with jxtg and sax
Date Wed, 17 Nov 2004 10:40:20 GMT

after a lot of time on JXTG and DOMStreamer I see where the really problem
is. The namespace was declared in the rigth way, the Document is correct
and streaming it does'n create any problem.

On this DOM I apply a cforms binding, and I create some node using
jxpathContext.createPathAndSetValue(), passing first parameter like
qualified name "puei:id" as specified on jxpath documentation [1]. The
createPathAndSetValue() method use AbstractFactory.createObject(). I think
that jxpat use the same node to get the namespaceURI or pointer setted
through jxpathContext.setNamespaceContextPointer().

So I set the root pointer (see xml in the previous mail) as pointer for
namespace, after serializing the document it seems well, but in
DOMStreamer$NamespaceNormalizingDOMStreamer.startNode() the namespaceURI
variable was never setted. In this way the contentHandler.startElement()
with a qName having a prefix e without namespaceURI throw the exception in
respect of w3c XML specification.

The suspect is that jxpath don't find the namespace declaration and so it
create element using qname as name without namespace.

Now I must to find a solution:

- Instead of use createPathAndSetValue() create a Node with a namespace,
and set it as value of the pointer.

- Add this code to DOMStreamer before startElement() at line 446

                    if (namespaceURI.equals("")) {
                        NamedNodeMap attrs =
                        for (int i=0; i<attrs.getLength(); i++) {
                            Node attr = attrs.item(i);
                            if (attr.getNodeName().equals("xmlns:" +
prefix)) {
                                namespaceURI = attr.getNodeValue();

that if namespaceURI was not declared try to find it's declaration in root
element of DOM.



Daniele Madama

Pro-netics s.r.l.
Via Elio Lampridio Cerva 127/c
Tel. 0651530849

View raw message