You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> on 2005/12/12 20:37:14 UTC
Creating attributes in a different namespace?
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
Re: Creating attributes in a different namespace?
Posted by "G. Wade Johnson" <gw...@anomaly.org>.
The proprietary namespace thing works great in Batik. I've used it for quite a
few projects.
G. Wade
On Tue, 13 Dec 2005 08:06:49 +0700
Tonny Kohar <to...@kiyut.com> wrote:
> Hi,
>
> On Mon, 2005-12-12 at 14:37 -0500, Bishop, Michael W. CONTR J9C880
> wrote:
> > How do I do something similar to what the Image element does in SVG?
> >
> > 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);
>
> You also need to declare the proprietary namespace in the svg tag as
> well.
> - First declare in the the namespace in the svg tag
> - Second use that namespace in each element you are interested with
>
> Not sure if it is work in batik, I never use proprietary namespace, but
> the DOM Spec indicate like that
>
> Regards
> Tonny Kohar
> --
> Sketsa
> SVG Graphics Editor
> http://www.kiyut.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
--
There are trivial truths and there are great Truths. The opposite of a
trivial truth is obviously false. The opposite of a great Truth is also
true. -- Neils Bohr
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Creating attributes in a different namespace?
Posted by Tonny Kohar <to...@kiyut.com>.
Hi,
On Mon, 2005-12-12 at 14:37 -0500, Bishop, Michael W. CONTR J9C880
wrote:
> How do I do something similar to what the Image element does in SVG?
>
> 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);
You also need to declare the proprietary namespace in the svg tag as
well.
- First declare in the the namespace in the svg tag
- Second use that namespace in each element you are interested with
Not sure if it is work in batik, I never use proprietary namespace, but
the DOM Spec indicate like that
Regards
Tonny Kohar
--
Sketsa
SVG Graphics Editor
http://www.kiyut.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org