xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bishop, Michael W. CONTR J9C880" <Michael.Bis...@je.jfcom.mil>
Subject Creating attributes in a different namespace?
Date Mon, 12 Dec 2005 19:37:14 GMT
How do I do something similar to what the Image element does in SVG?
When you use Batik to create an Image element, it comes out like:

 

<image xmlns:xlink="..."/>

 

I need to import attributes from another namespace in all my elements.
I add these elements like this:

 

Element.setAttributeNS(NS_URI, NS_ATTR, value);

 

However, I can't retrieve these values at all (they come back as blank
strings):

 

Element.getAttributeNS(NS_URI, NS_ATTR) or
element.getAttribute(NS_ATTR);

 

I think I need an additional xmlns:ns declared, but how do you add one
to an element?  The examples I can find online talk about creating the
entire element in another namespace.  I want an SVG element with NS_URI
attributes.

 

<rect xmlns:someOtherNamespace="http://x.y.z/a" x="0" y="0" w="10"
h="10" someOtherNamespace:center="5"/>

 

Michael Bishop

 

 


Mime
View raw message