xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McCormack <...@mcc.id.au>
Subject Re: a0:space="preserve"
Date Fri, 01 Aug 2008 01:52:46 GMT
Hi Helder.

Thomas DeWeese:
> >    My guess would be as a result of serializing an SVG that
> > had it's xml:space attribute set like this:
> >
> >         e.setAttributeNS(XML_NS, "space", "preserve");
> >
> >    The serializer is probably creating the namespace
> > prefix 'a0' since you didn't provide one.  If I'm right you
> > should set the xml:space attribute with:
> >
> >         e.setAttributeNS(XML_NS, "xml:space", "preserve");

Helder Magalhães:
> Could you provide a pointer where this is stated? That is, the need to
> insert the external namespace prefix ("xml:"). I've searched for it in
> the specification [1] but, apparently according to the qualifier name
> definition [2], the prefix is labeled optional... Also, I wasn't able
> to find related material within the pointer [3] provided by Cameron.

Right, it’s optional to provide a prefix in there.  The serialiser at
it’s written (well, when the bugs are ironed out) will use the given
prefix if it correctly corresponds to the namespaceURI of the attribute.
Otherwise, it will look up an existing prefix, and if one doesn’t exist,
it’ll create one (the “a0” that emzic found).

The “xml” prefix is always assumed to be declared, can optionally be
explicitly declared (as long as it has the right namespace URI) but must
not be bound to a different prefix.  That’s where the bug comes in.

(“xmlns” on the other hand must never be declared.)

> Are there strong reasons to always use the namespace prefix (plus the
> colon) within Batik or any other known implementation(s)? Should this
> question be taken to the SVG Developers [4] forum?

Although setting the prefix doesn’t affect what namespaceURI the node is
in, it will make it easier for you to get out a namespace well-formed
document from a naive serialiser.

-- 
Cameron McCormack ≝ http://mcc.id.au/

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message