You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Thierry Kormann <tk...@sophia.inria.fr> on 2001/07/04 14:03:39 UTC

Re: Bug?

On Wednesday 04 July 2001 13:19, Andreas Bielk wrote:
> Here is the situation:
>
> We add a <use> element to an existing DOM tree with:
>
> It´s clear that there´s a bug in getNode(), but is that really the problem?
> When we serializes the DOM to a textfile

Sorry but I don't think there is a bug in getNode. I think you have not 
specified the URI of the document (this one is required to handle use 
element).

> (org.apache.batik.dom.util.DOMUtilities.writeDocument)
> the "href" attribute of the <use> have a missing namespace prefix.

According to the DOM spec, the setAttributeNS method takes a qualifiedName 
and not a localName.

The setAttributeNS(xlinkNamespaceURI, "xlink:href", ...);

will solve your second problem.

Thierry.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


RE: Bug?

Posted by Andreas Bielk <an...@codesense.com>.
> Sorry but I don't think there is a bug in getNode. I think you have not
> specified the URI of the document (this one is required to handle use
> element).
>
> > (org.apache.batik.dom.util.DOMUtilities.writeDocument)
> > the "href" attribute of the <use> have a missing namespace prefix.

Ok, but is it really a good design to let URIResolver.getNode()
result in a NullPointerExcepion when the URI is missing?

Hmm, shouldn´t the document URI specified if I create the DOM with:
SAXSVGDocumentFactory factory = new
SAXSVGDocumentFactory("org.apache.xerces.parsers.SAXParser");
SVGOMDocument document =
factory.createDocument("http://codesense.com/templates/"+id,new
StringReader(_data));

> According to the DOM spec, the setAttributeNS method takes a
> qualifiedName
> and not a localName.
>
> The setAttributeNS(xlinkNamespaceURI, "xlink:href", ...);
> will solve your second problem.

Doh! I knew that :-') that solved the NullPointerException...

Thanks / Andreas

/**********************************************************
                  C o d e S e n s e  A B
       Marinens väg 30, SE-136 40 Haninge, Sweden
Office: +46 (0)8 - 707 32 30  GSM: +46 (0)70 - 532 92 01
                 http://www.codesense.com
***********************************************************/
    (PGP public key available at: search.keyserver.net)


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org