Hi Jeff,
Jeff Abernathy <[EMAIL PROTECTED]> wrote on 05/23/2007
02:35:43 PM:
> I'm having trouble inserting a "use" element into a Document. This
> is a basic drawing application that has a "stamp" tool, and for this
> stamp I'm using a group. When I try to append the use element to the
> document I get the error "The attribute "xlink:href" of the element
> <use> is required". The xlink:href attribute is most certainly
> present, here is the code that creates the element:
> element.setAttributeNS(SketchPadConstants.SVG_XLINK_NS, "xlink:
> href", GROUP_NAME);
You will also get this error if the value of the
xlink:href attribute is the empty string. Is it possible that
GROUP_NAME isn't getting set for some reason?
>
> final Element element = getElement();
> element.setAttributeNS(SketchPadConstants.SVG_XLINK_NS,
> X_ATTRIBUTE_NAME, "" + origin.getX());
> element.setAttributeNS(SketchPadConstants.SVG_XLINK_NS,
> Y_ATTRIBUTE_NAME, "" + origin.getY());
Also as someone else pointed out the 'x' and 'y' attributes
on the use element are not in the xlink namespace, they are in
the 'null' namespace.
> If I save the document to the file system after inserting a few of
> these stamps, and then open it, the stamps render without any
> problems. Could there be something that is happening under the
> covers in the save/open process?
There is lots that happens during the save/restore processes
in particular the namespaces are rebound based on the prefixes.
So if your constant for the XLINK NS was wrong this is the behavior
you would see.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]