Hi Piyush,

   I think the problem is that the SVG attributes are in
the 'null' namespace not the SVG namespace (this is confusing
because the elements must be in the SVG namespace):

path[i].setAttributeNS(svgNS, "stroke",
    namedNodes.getNamedItemNS(svgNS,"stroke").getNodeValue());

   getNamedItemNS in this case is likely returning null.
   Also as you might guess setting the 'svg:stroke"
attribute is not likely to have any effect on the display.

Piyush Rai wrote:

Hi,

I have a NodeList of path elements in an SVG file.
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
NodeList paths = document.getElementsByTagNameNS(svgNS,"path");

I am also creating an equal number of empty paths(by setting 'd' attribute as "").

numberOfPaths = paths.getLength();
path = new Element[numberOfPaths];

Now I want to set other attributes of these new paths to that of original paths(from the SVG file itself, instead of constant values). I am trying this(for example, the "stroke" attribute):
NamedNodeMap namedNodes = paths.item(i).getAttributes();
//path[i].setAttributeNS(null, "stroke", "#00ffff"); THIS WORKS FINE
path[i].setAttributeNS(svgNS, "stroke",namedNodes.getNamedItemNS(svgNS,"stroke").getNodeValue());
And similarly for other attributes.


But I am getting NullPointerException. All the statements are in the order as written here. What could be the reason! for this? Any thoughts?
--Piyush.


Do you Yahoo!?
New and Improved Yahoo! Mail <http://us.rd.yahoo.com/mail_us/taglines/10/*http://promotions.yahoo.com/new_mail/static/efficiency.html> - Send 10MB messages!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to