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 "Jean-Christophe ARNU (JX)" <ar...@paratronic.fr> on 2003/08/01 10:39:02 UTC
Entities and dynamic Documents
Hi,
I use a SVG Document with a defined entity defined like this in DOCTYPE :
<!ENTITY opal '<polygon
points="-50,-50 50,-50 50,50 -50,50"
style="font-size:12;fill:#ff0000;fill-rule:evenodd;stroke:#000000;stroke-widt
h:5.25;"
id="polygon552" />'>
This entity is not referenced in the text file document but is referenced
later (after loading) when I query a database to get each "entityref"
coordinates.
I then group all entities into a GElement and I append it as a child to the
root Element.
My Document is ALWAYS_DYNAMIC and display is not updated. I tried then to
print the whole document to a debug SVG file to see how batik handles Entities
and entities ref (using DOMUtilities.writeDocument. When I load the document
with sodipodi and others editing tools, Entity definition (and doctype)
disappeared from the file, thus refs could not be satisfied... (meaning, my
appendChild of the GElement with entity refs worked in the document body)
So my question is : does Batik keeps entity defs after loading even they're
not used? Does my way of doing such an operation is not compliant with the
Batik API or processing operations sequence? How could I get this work?
Thanks a lot!
P.S : When copy paste the generated GElement bloc from my generated file to
the source file (where Entity is defined), I get a correct and well formed SVG
File and rendered output is what I want...
--
Jean-Christophe ARNU
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Entities and dynamic Documents
Posted by Thomas DeWeese <Th...@Kodak.com>.
Jean-Christophe ARNU (JX) wrote:
> Le Wed, 06 Aug 2003 07:11:22 -0400
> Thomas DeWeese <Th...@Kodak.com> me disait que :
>> useElt.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#foo");
> Okaye, thank you, it works now! I'm happy :)
Good.
> Is there a way to get batik work without beeing connected to the
> internet. I mean that the parser should connect to the differents URL to
> validate (if any validation is applicable) the document (with the
> different namespaces and so on)? I've been using my own XML parser to
> display simple SVG drawings (path based elements), and I was able to
> avoid connection to the internet. This question is really important for
> me because, several application's users are not connected to the
> internet and are not able to.
I'm not 100% certain I follow what you want. In general the
answer is yes. If you look at
sources/org/apache/batik/dom/svg/SAXSVGDocumentFactory.java
There is a method: resolveEntity This is called to try and
locate DTD's and the like. This class already 'short circuits'
many DTD's to be either a minimal DTD when not validating or
a local copy of the SVG DTD. The list is controllable through
the resource file:
xml-batik/resources/org/apache/batik/dom/svg/resources/dtdids.properties
> Thanks again for your preceding answers and in advance for the hypothetic
> ones :)
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Entities and dynamic Documents
Posted by "Jean-Christophe ARNU (JX)" <ar...@paratronic.fr>.
Le Wed, 06 Aug 2003 07:11:22 -0400
Thomas DeWeese <Th...@Kodak.com> me disait que :
> You are most likely setting the attribute named "xlink:href"
> as opposed to the attribute "href" in the 'xlink' namespace:
>
> useElt.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#foo");
>
Okaye, thank you, it works now! I'm happy :)
Is there a way to get batik work without beeing connected to the internet. I
mean that the parser should connect to the differents URL to validate (if any
validation is applicable) the document (with the different namespaces and so
on)? I've been using my own XML parser to display simple SVG drawings (path
based elements), and I was able to avoid connection to the internet. This
question is really important for me because, several application's users are
not connected to the internet and are not able to.
Thanks again for your preceding answers and in advance for the hypothetic
ones :)
--
Jean-Christophe ARNU
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Entities and dynamic Documents
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi,
Jean-Christophe ARNU (JX) wrote:
> Le Wed, 6 Aug 2003 11:39:11 +0200
> Jean-Christophe ARNU (JX) <ar...@paratronic.fr> me disait que :
> Now I would like to use the use element.
>
> I have several use element in my original doc which are correctly placed.
> Then after loading time, I want to add dynamically use elements in the
> document. (I place them after querying the database). When I appendChild() a g
> element containing the use element, I get the following exception whereas I
> use the same use element in the original document (I mean the same URI).
>
> The URI '' specified on the element <use> is invalid
You are most likely setting the attribute named "xlink:href"
as opposed to the attribute "href" in the 'xlink' namespace:
useElt.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#foo");
> at
> org.apache.batik.bridge.SVGUseElementBridge.buildCompositeGraphicsNode(Unknown
> Source)
> at org.apache.batik.bridge.SVGUseElementBridge.createGraphicsNode(Unknown
> Source)
> at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
> at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
> at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
> at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
> at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
> at org.apache.batik.bridge.SVGGElementBridge.handleElementAdded(Unknown
> Source)
> at
> org.apache.batik.bridge.SVGGElementBridge.handleDOMNodeInsertedEvent(Unknown
> Source)
> at
> org.apache.batik.bridge.BridgeContext$DOMNodeInsertedEventListener.handleEven
> t(Unknown Source)
> at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown
> Source)
> at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
> at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
> at org.apache.batik.dom.AbstractParentNode.fireDOMNodeInsertedEvent(Unknown
> Source)
> at org.apache.batik.dom.AbstractParentNode.appendChild(Unknown Source)
> at com.paratronic.supervisor.ui.SVGDisplay.addStations(SVGDisplay.java:372)
>
> My URI is absolutely not empty.... So where do I go wrong?
>
> Thanks for any clue! :)
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Entities and dynamic Documents
Posted by "Jean-Christophe ARNU (JX)" <ar...@paratronic.fr>.
Le Wed, 6 Aug 2003 11:39:11 +0200
Jean-Christophe ARNU (JX) <ar...@paratronic.fr> me disait que :
> In fact it was the case. Refs were not put in the DOM tree.
> Well use element should be a good way to do what I wanted to do :)
Now I would like to use the use element.
I have several use element in my original doc which are correctly placed.
Then after loading time, I want to add dynamically use elements in the
document. (I place them after querying the database). When I appendChild() a g
element containing the use element, I get the following exception whereas I
use the same use element in the original document (I mean the same URI).
The URI '' specified on the element <use> is invalid
at
org.apache.batik.bridge.SVGUseElementBridge.buildCompositeGraphicsNode(Unknown
Source)
at org.apache.batik.bridge.SVGUseElementBridge.createGraphicsNode(Unknown
Source)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
at org.apache.batik.bridge.SVGGElementBridge.handleElementAdded(Unknown
Source)
at
org.apache.batik.bridge.SVGGElementBridge.handleDOMNodeInsertedEvent(Unknown
Source)
at
org.apache.batik.bridge.BridgeContext$DOMNodeInsertedEventListener.handleEven
t(Unknown Source)
at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown
Source)
at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
at org.apache.batik.dom.AbstractParentNode.fireDOMNodeInsertedEvent(Unknown
Source)
at org.apache.batik.dom.AbstractParentNode.appendChild(Unknown Source)
at com.paratronic.supervisor.ui.SVGDisplay.addStations(SVGDisplay.java:372)
My URI is absolutely not empty.... So where do I go wrong?
Thanks for any clue! :)
--
Jean-Christophe ARNU
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Entities and dynamic Documents
Posted by "Jean-Christophe ARNU (JX)" <ar...@paratronic.fr>.
Le Tue, 05 Aug 2003 20:34:45 -0400
Thomas DeWeese <Th...@Kodak.com> me disait que :
> To be honest I don't have an idea how Batik will respond
> to this use of entities. However I think entities are the wrong
> way to go. The 'use' element - is intended for this purpose.
>
>
> > My Document is ALWAYS_DYNAMIC and display is not updated.
>
> Make sure you change the document in the UpdateManager thread
> (however I suspect that Batik is simply not handling the Entity Refs).
In fact it was the case. Refs were not put in the DOM tree.
Well use element should be a good way to do what I wanted to do :)
Thanks!
--
Jean-Christophe ARNU
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Entities and dynamic Documents
Posted by Thomas DeWeese <Th...@Kodak.com>.
Jean-Christophe ARNU (JX) wrote:
> Hi,
> I use a SVG Document with a defined entity defined like this in DOCTYPE :
>
> <!ENTITY opal '<polygon
> points="-50,-50 50,-50 50,50 -50,50"
>
> style="font-size:12;fill:#ff0000;fill-rule:evenodd;stroke:#000000;stroke-widt
> h:5.25;"
> id="polygon552" />'>
>
> This entity is not referenced in the text file document but is referenced
> later (after loading) when I query a database to get each "entityref"
> coordinates.
>
> I then group all entities into a GElement and I append it as a child to the
> root Element.
To be honest I don't have an idea how Batik will respond
to this use of entities. However I think entities are the wrong
way to go. The 'use' element - is intended for this purpose.
> My Document is ALWAYS_DYNAMIC and display is not updated.
Make sure you change the document in the UpdateManager thread
(however I suspect that Batik is simply not handling the Entity Refs).
> I tried then to
> print the whole document to a debug SVG file to see how batik handles Entities
> and entities ref (using DOMUtilities.writeDocument. When I load the document
> with sodipodi and others editing tools, Entity definition (and doctype)
> disappeared from the file, thus refs could not be satisfied... (meaning, my
> appendChild of the GElement with entity refs worked in the document body)
>
> So my question is : does Batik keeps entity defs after loading even they're
> not used? Does my way of doing such an operation is not compliant with the
> Batik API or processing operations sequence? How could I get this work?
>
> Thanks a lot!
>
>
> P.S : When copy paste the generated GElement bloc from my generated file to
> the source file (where Entity is defined), I get a correct and well formed SVG
> File and rendered output is what I want...
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org