I found out the problem is in my svg file:
function startDrag(evt)
{
        dragging = true;
        offX = evt.getClientX/*here need ()*/-evt.getTarget().getAttribute("cx");

offY = evt.getClientY/*here need ()*/-evt.getTarget().getAttribute("cy");
}
I miss "()" after those method, so offX and offY will always be NaN, not a number can't assign to cx or cy, so it will araise a exception, but the exception didn't tell me what is wrong there, will this called a bug?





From: "Liu Eric" <[EMAIL PROTECTED]>
Reply-To: "Batik Users" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Why setAttribute in script will raise exception in Batik
SVGBrowser?
Date: Tue, 30 Dec 2003 09:41:23 +0800

The attachment is the svg file I tested, when drag the circle, it work soomthly in Adobe SVGViewer, but in Squiggle, it give me a totally odd exception:The attribute 'cx' of the element <circle> is invalid. I've read the FAQ, and tried the setAttributeNS method, the result is same.
Later I found the exception raise originally from org.apache.batik.parser.LengthParser.parseLength() method, it report "character.unexpected" error, I feel too strange this exception is warppered and rethrowed in org.apache.batik.bridge.UnitProcessor.svgToUserSpace class that I don't even know what is wrong there.
Any one have idea about this?


OS: winxp with sp1
JDK: sun jdk 1.4.1


Eric



// the exception stack printed
org.apache.batik.bridge.BridgeException: file:/G:/Downloads/Java/tools/batik-src-1.5/xml-batik/move_circle.svg:0
The attribute 'cx' of the element <circle> is invalid


at org.apache.batik.bridge.UnitProcessor.svgToUserSpace(UnitProcessor.java:307)



at org.apache.batik.bridge.UnitProcessor.svgHorizontalCoordinateToUserSpace(UnitProcessor.java:238)



at org.apache.batik.bridge.SVGCircleElementBridge.buildShape(SVGCircleElementBridge.java:62)



at org.apache.batik.bridge.SVGCircleElementBridge.handleDOMAttrModifiedEvent(SVGCircleElementBridge.java:106)



at org.apache.batik.bridge.BridgeContext$DOMAttrModifiedEventListener.handleEvent(BridgeContext.java:1041)



at org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:227)



at org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:184)



at org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:413)

at org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElement.java:502)



at org.apache.batik.dom.AbstractAttr.setNodeValue(AbstractAttr.java:133)

at org.apache.batik.dom.AbstractAttr.setValue(AbstractAttr.java:176)

at org.apache.batik.dom.AbstractElement.setAttribute(AbstractElement.java:123)

...........

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
<< move_circle.svg >>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn



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



Reply via email to