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 Weiming Zhang <We...@UCHSC.edu> on 2003/10/30 19:33:22 UTC

rendering embedded svg

Hi,

The svg specification shows a simple SVG content embedded inline as a
fragment within a parent XML document:
	<?xml version="1.0" standalone="yes"?>
<parent xmlns="http://example.org"
       xmlns:svg="http://www.w3.org/2000/svg">
   <!-- parent contents here -->
   <svg:svg width="4cm" height="8cm" version="1.1">
      <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm" />
   </svg:svg>
   <!-- ... -->
</parent>

Is it possible to rendering such svg content with Batik? I want to use
some custom XML tags to add some extra information to the document. For
example, I may specify for certain group of graphic shapes, there are
certain callbacks. Those callbacks will be specified as either elements
or attributes. 

Thanks a lot in advance.

wz






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


Re: rendering embedded svg

Posted by Weiming Zhang <We...@UCHSC.edu>.
Thank you so much. This is really helpful.

wz

On Sat, 2003-11-01 at 05:44, Thomas DeWeese wrote:
> Weiming Zhang wrote:
> 
> >>>I want to use
> >>>some custom XML tags to add some extra information to the document. For
> >>>example, I may specify for certain group of graphic shapes, there are
> >>>certain callbacks. Those callbacks will be specified as either elements
> >>>or attributes. 
> 
> Thomas DeWeese wrote:
> 
> >>    This makes me think that you may want (or at least get away with)
> >>something that looks more like:
> >>
> >>      <svg:svg width="4cm" height="8cm" version="1.1"
> >>          xmlns="http://example.org"
> >>         xmlns:svg="http://www.w3.org/2000/svg">
> >>        <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm">
> >>	  <callback-list>
> >>	     <!-- callbacks for the ellipse element -->
> >>	     <callback name="foo" function="bar"/>
> >>	  </callback-list>
> >>        </svg:ellipse>
> >>     </svg:svg>
> >>
> >>    This will work trivially "right out of the box".
> > 
> > This indeed works! But the callback related elements are not in SVG DTD,
> > so batik does not validate the document? 
> 
>    It does not do so by default[*] (even so Batik does check things
> fairly closely).  Even with that the SVG Specification states that an
> SVG document is valid if it validates according to the SVG DTD after elements
> that are not in the SVG namespace have been removed.
> 
> [*] Squiggle has runtime options to turn on validation, although I don't
> believe it strips foreign namespaces prior to validation.
> 
> > If I make a DTD or schema by
> > adding some extra information to SVG DTD (is it possible to do
> > inheritance with a DTD?), how can I let batik know?
> 
>    The SVG DTD has a number of 'extension' entities that you can
> use to insert your elements as allowed children of the SVG elements.
> I can't tell you much more than this as I am not a DTD expert (and it
> is my belief that you need to be to make use of this feature :).
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 




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


Re: rendering embedded svg

Posted by Thomas DeWeese <Th...@Kodak.com>.
Weiming Zhang wrote:

>>>I want to use
>>>some custom XML tags to add some extra information to the document. For
>>>example, I may specify for certain group of graphic shapes, there are
>>>certain callbacks. Those callbacks will be specified as either elements
>>>or attributes. 

Thomas DeWeese wrote:

>>    This makes me think that you may want (or at least get away with)
>>something that looks more like:
>>
>>      <svg:svg width="4cm" height="8cm" version="1.1"
>>          xmlns="http://example.org"
>>         xmlns:svg="http://www.w3.org/2000/svg">
>>        <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm">
>>	  <callback-list>
>>	     <!-- callbacks for the ellipse element -->
>>	     <callback name="foo" function="bar"/>
>>	  </callback-list>
>>        </svg:ellipse>
>>     </svg:svg>
>>
>>    This will work trivially "right out of the box".
> 
> This indeed works! But the callback related elements are not in SVG DTD,
> so batik does not validate the document? 

   It does not do so by default[*] (even so Batik does check things
fairly closely).  Even with that the SVG Specification states that an
SVG document is valid if it validates according to the SVG DTD after elements
that are not in the SVG namespace have been removed.

[*] Squiggle has runtime options to turn on validation, although I don't
believe it strips foreign namespaces prior to validation.

> If I make a DTD or schema by
> adding some extra information to SVG DTD (is it possible to do
> inheritance with a DTD?), how can I let batik know?

   The SVG DTD has a number of 'extension' entities that you can
use to insert your elements as allowed children of the SVG elements.
I can't tell you much more than this as I am not a DTD expert (and it
is my belief that you need to be to make use of this feature :).




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


Re: rendering embedded svg

Posted by "G. Wade Johnson" <gw...@anomaly.org>.
Since I only added local mods to the file, I did explicit error
checking. That also allowed me to verify data types, etc. which are
not handled by DTDs.

G. Wade

On 18 Nov 2003 10:20:52 -0700
"Weiming Zhang" <We...@UCHSC.edu> wrote:

> I used it too. it did work. But I could not validate it. Did you
> validate your files or you implemented other ways to check for error?
> 
> I really appreciate your help.
> 
> Weiming
> 
> On Tue, 2003-11-18 at 09:48, G. Wade Johnson wrote:
> > Remember, DTDs are not namespace-aware.
> > 
> > I did not extend the SVG DTD at all. I added elements (and
> > attributes that were part of a separate namespace. For example,
> > 
> > <svg width="400" height="300"
> >      xmlns="http://www.w3.org/2000/svg"
> >      xmlns:xlink="http://www.w3.org/1999/xlink"
> >      xmlns:gwj="http://www.anomaly.org/mock_namespace">
> > 
> >   <g id="CoolComponent" gwj:extra="Extra attribute information">
> >     <metadata>
> >       <gwj:special>Putting the extra tags in a metadata tag is
> >         probably the cleanest approach.</gwj:special>
> >     </metadata>
> >     <rect x="50" y="50" width="300" height="200" fill="blue"/>
> >     <gwj:other id="NotPartOfSVG">But it is not
> >     required.</gwj:special>
> >   </g>
> > 
> > </svg>
> > 
> > Warning: The above has not actually been tested. However, I've used
> > all of the techniques I've shown in different SVG pages.
> > 
> > HTH,
> > G. Wade
> > 
> > On 18 Nov 2003 09:37:41 -0700
> > "Weiming Zhang" <We...@UCHSC.edu> wrote:
> > 
> > > Hi, Wade,
> > > 
> > > When you added new elements or attributes with different name
> > > space to the file, did you use internal DTD to extend SVG DTD? The
> > > SVG specification states it can be done with internal DTD. But I
> > > might have to extend it quite a lot and I do not want to give a
> > > big internal repetitive DTD to each file. Is there a way to do it
> > > with external DTD?
> > > 
> > > Thanks.
> > > 
> > > Weiming
> > > 
> > > On Fri, 2003-10-31 at 11:09, wade.johnson@abbnm.com wrote:
> > > > The way I did this on a similar project was to put the
> > > > new elements and attributes in a different namespace.
> > > > 
> > > > Batik does not try to render those elements, but it does
> > > > make them available through the DOM.
> > > > 
> > > > G. Wade
> > > > 
> > > > Weiming Zhang wrote:
> > > > > Hi,
> > > > > 
> > > > > Thank you very much.
> > > > > 
> > > > >>>Is it possible to rendering such svg content with Batik? 
> > > > >>
> > > > >>    Yes, and no.  There are some issues with the above
> > > > >example,>like Batik requires an SVGDocument with a 'getRoot'
> > > > >method that>returns the 'root' SVG element.  So you might be
> > > > >able to write a>'hacked' document object that 'behaved'
> > > > >correctly however...
> > > > > 
> > > > > I tried the sample from SVG specification but it did not work.
> > > > > You are right, it has to have svg element as root for batik
> > > > > rendering.
> > > > > 
> > > > > 
> > > > >>>I want to use
> > > > >>>some custom XML tags to add some extra information to the
> > > > >document. For>>example, I may specify for certain group of
> > > > >graphic shapes, there are>>certain callbacks. Those callbacks
> > > > >will be specified as either elements>>or attributes. 
> > > > >>
> > > > >>    This makes me think that you may want (or at least get
> > > > >away with)>something that looks more like:
> > > > >>
> > > > >>      <svg:svg width="4cm" height="8cm" version="1.1"
> > > > >>          xmlns="http://example.org"
> > > > >>         xmlns:svg="http://www.w3.org/2000/svg">
> > > > >>        <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm">
> > > > >>	  <callback-list>
> > > > >>	     <!-- callbacks for the ellipse element -->
> > > > >>	     <callback name="foo" function="bar"/>
> > > > >>	  </callback-list>
> > > > >>        </svg:ellipse>
> > > > >>     </svg:svg>
> > > > >>
> > > > >>    This will work trivially "right out of the box".
> > > > > 
> > > > > This indeed works! But the callback related elements are not
> > > > > in SVG DTD, so batik does not validate the document? If I make
> > > > > a DTD or schema by adding some extra information to SVG DTD
> > > > > (is it possible to do inheritance with a DTD?), how can I let
> > > > > batik know?
> > > > > 
> > > > > Thanks.
> > > > > 
> > > > > wz
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > -------------------------------------------------------------
> > > > > -------- To unsubscribe, e-mail:
> > > > > batik-users-unsubscribe@xml.apache.org For additional
> > > > > commands, e-mail: batik-users-help@xml.apache.org
> > > > > 
> > > > > 
> > > > 
> > > > 
> > > > 
> > > > ---------------------------------------------------------------
> > > > ------ To unsubscribe, e-mail:
> > > > batik-users-unsubscribe@xml.apache.org For additional commands,
> > > > e-mail: batik-users-help@xml.apache.org
> > > > 
> > > 
> > > 
> > > 
> > > 
> > > -----------------------------------------------------------------
> > > ---- To unsubscribe, e-mail:
> > > batik-users-unsubscribe@xml.apache.org For additional commands,
> > > e-mail: batik-users-help@xml.apache.org
> > 
> > 
> > -- 
> > A 'language' is a dialect with an army.
> > 
> > -------------------------------------------------------------------
> > -- To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> > 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org


-- 
You write code as if the person who will maintain your code is a violent
psychopath who knows where you live.                  -- John F. Woods

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


Re: rendering embedded svg

Posted by Weiming Zhang <We...@UCHSC.edu>.
I used it too. it did work. But I could not validate it. Did you
validate your files or you implemented other ways to check for error?

I really appreciate your help.

Weiming

On Tue, 2003-11-18 at 09:48, G. Wade Johnson wrote:
> Remember, DTDs are not namespace-aware.
> 
> I did not extend the SVG DTD at all. I added elements (and attributes
> that were part of a separate namespace. For example,
> 
> <svg width="400" height="300"
>      xmlns="http://www.w3.org/2000/svg"
>      xmlns:xlink="http://www.w3.org/1999/xlink"
>      xmlns:gwj="http://www.anomaly.org/mock_namespace">
> 
>   <g id="CoolComponent" gwj:extra="Extra attribute information">
>     <metadata>
>       <gwj:special>Putting the extra tags in a metadata tag is
>         probably the cleanest approach.</gwj:special>
>     </metadata>
>     <rect x="50" y="50" width="300" height="200" fill="blue"/>
>     <gwj:other id="NotPartOfSVG">But it is not required.</gwj:special>
>   </g>
> 
> </svg>
> 
> Warning: The above has not actually been tested. However, I've used
> all of the techniques I've shown in different SVG pages.
> 
> HTH,
> G. Wade
> 
> On 18 Nov 2003 09:37:41 -0700
> "Weiming Zhang" <We...@UCHSC.edu> wrote:
> 
> > Hi, Wade,
> > 
> > When you added new elements or attributes with different name space to
> > the file, did you use internal DTD to extend SVG DTD? The SVG
> > specification states it can be done with internal DTD. But I might
> > have to extend it quite a lot and I do not want to give a big internal
> > repetitive DTD to each file. Is there a way to do it with external
> > DTD?
> > 
> > Thanks.
> > 
> > Weiming
> > 
> > On Fri, 2003-10-31 at 11:09, wade.johnson@abbnm.com wrote:
> > > The way I did this on a similar project was to put the
> > > new elements and attributes in a different namespace.
> > > 
> > > Batik does not try to render those elements, but it does
> > > make them available through the DOM.
> > > 
> > > G. Wade
> > > 
> > > Weiming Zhang wrote:
> > > > Hi,
> > > > 
> > > > Thank you very much.
> > > > 
> > > >>>Is it possible to rendering such svg content with Batik? 
> > > >>
> > > >>    Yes, and no.  There are some issues with the above example,
> > > >>like Batik requires an SVGDocument with a 'getRoot' method that
> > > >>returns the 'root' SVG element.  So you might be able to write a
> > > >>'hacked' document object that 'behaved' correctly however...
> > > > 
> > > > I tried the sample from SVG specification but it did not work. You
> > > > are right, it has to have svg element as root for batik rendering.
> > > > 
> > > > 
> > > >>>I want to use
> > > >>>some custom XML tags to add some extra information to the
> > > >document. For>>example, I may specify for certain group of graphic
> > > >shapes, there are>>certain callbacks. Those callbacks will be
> > > >specified as either elements>>or attributes. 
> > > >>
> > > >>    This makes me think that you may want (or at least get away
> > > >with)>something that looks more like:
> > > >>
> > > >>      <svg:svg width="4cm" height="8cm" version="1.1"
> > > >>          xmlns="http://example.org"
> > > >>         xmlns:svg="http://www.w3.org/2000/svg">
> > > >>        <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm">
> > > >>	  <callback-list>
> > > >>	     <!-- callbacks for the ellipse element -->
> > > >>	     <callback name="foo" function="bar"/>
> > > >>	  </callback-list>
> > > >>        </svg:ellipse>
> > > >>     </svg:svg>
> > > >>
> > > >>    This will work trivially "right out of the box".
> > > > 
> > > > This indeed works! But the callback related elements are not in
> > > > SVG DTD, so batik does not validate the document? If I make a DTD
> > > > or schema by adding some extra information to SVG DTD (is it
> > > > possible to do inheritance with a DTD?), how can I let batik know?
> > > > 
> > > > Thanks.
> > > > 
> > > > wz
> > > > 
> > > > 
> > > > 
> > > > 
> > > > -----------------------------------------------------------------
> > > > ---- To unsubscribe, e-mail:
> > > > batik-users-unsubscribe@xml.apache.org For additional commands,
> > > > e-mail: batik-users-help@xml.apache.org
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > -------------------------------------------------------------------
> > > -- To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: batik-users-help@xml.apache.org
> > > 
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 
> -- 
> A 'language' is a dialect with an army.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 




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


Re: rendering embedded svg

Posted by "G. Wade Johnson" <gw...@anomaly.org>.
Remember, DTDs are not namespace-aware.

I did not extend the SVG DTD at all. I added elements (and attributes
that were part of a separate namespace. For example,

<svg width="400" height="300"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:gwj="http://www.anomaly.org/mock_namespace">

  <g id="CoolComponent" gwj:extra="Extra attribute information">
    <metadata>
      <gwj:special>Putting the extra tags in a metadata tag is
        probably the cleanest approach.</gwj:special>
    </metadata>
    <rect x="50" y="50" width="300" height="200" fill="blue"/>
    <gwj:other id="NotPartOfSVG">But it is not required.</gwj:special>
  </g>

</svg>

Warning: The above has not actually been tested. However, I've used
all of the techniques I've shown in different SVG pages.

HTH,
G. Wade

On 18 Nov 2003 09:37:41 -0700
"Weiming Zhang" <We...@UCHSC.edu> wrote:

> Hi, Wade,
> 
> When you added new elements or attributes with different name space to
> the file, did you use internal DTD to extend SVG DTD? The SVG
> specification states it can be done with internal DTD. But I might
> have to extend it quite a lot and I do not want to give a big internal
> repetitive DTD to each file. Is there a way to do it with external
> DTD?
> 
> Thanks.
> 
> Weiming
> 
> On Fri, 2003-10-31 at 11:09, wade.johnson@abbnm.com wrote:
> > The way I did this on a similar project was to put the
> > new elements and attributes in a different namespace.
> > 
> > Batik does not try to render those elements, but it does
> > make them available through the DOM.
> > 
> > G. Wade
> > 
> > Weiming Zhang wrote:
> > > Hi,
> > > 
> > > Thank you very much.
> > > 
> > >>>Is it possible to rendering such svg content with Batik? 
> > >>
> > >>    Yes, and no.  There are some issues with the above example,
> > >>like Batik requires an SVGDocument with a 'getRoot' method that
> > >>returns the 'root' SVG element.  So you might be able to write a
> > >>'hacked' document object that 'behaved' correctly however...
> > > 
> > > I tried the sample from SVG specification but it did not work. You
> > > are right, it has to have svg element as root for batik rendering.
> > > 
> > > 
> > >>>I want to use
> > >>>some custom XML tags to add some extra information to the
> > >document. For>>example, I may specify for certain group of graphic
> > >shapes, there are>>certain callbacks. Those callbacks will be
> > >specified as either elements>>or attributes. 
> > >>
> > >>    This makes me think that you may want (or at least get away
> > >with)>something that looks more like:
> > >>
> > >>      <svg:svg width="4cm" height="8cm" version="1.1"
> > >>          xmlns="http://example.org"
> > >>         xmlns:svg="http://www.w3.org/2000/svg">
> > >>        <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm">
> > >>	  <callback-list>
> > >>	     <!-- callbacks for the ellipse element -->
> > >>	     <callback name="foo" function="bar"/>
> > >>	  </callback-list>
> > >>        </svg:ellipse>
> > >>     </svg:svg>
> > >>
> > >>    This will work trivially "right out of the box".
> > > 
> > > This indeed works! But the callback related elements are not in
> > > SVG DTD, so batik does not validate the document? If I make a DTD
> > > or schema by adding some extra information to SVG DTD (is it
> > > possible to do inheritance with a DTD?), how can I let batik know?
> > > 
> > > Thanks.
> > > 
> > > wz
> > > 
> > > 
> > > 
> > > 
> > > -----------------------------------------------------------------
> > > ---- To unsubscribe, e-mail:
> > > batik-users-unsubscribe@xml.apache.org For additional commands,
> > > e-mail: batik-users-help@xml.apache.org
> > > 
> > > 
> > 
> > 
> > 
> > -------------------------------------------------------------------
> > -- To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> > 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org


-- 
A 'language' is a dialect with an army.

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


Re: rendering embedded svg

Posted by Weiming Zhang <We...@UCHSC.edu>.
Hi, Wade,

When you added new elements or attributes with different name space to
the file, did you use internal DTD to extend SVG DTD? The SVG
specification states it can be done with internal DTD. But I might have
to extend it quite a lot and I do not want to give a big internal
repetitive DTD to each file. Is there a way to do it with external DTD?

Thanks.

Weiming

On Fri, 2003-10-31 at 11:09, wade.johnson@abbnm.com wrote:
> The way I did this on a similar project was to put the
> new elements and attributes in a different namespace.
> 
> Batik does not try to render those elements, but it does
> make them available through the DOM.
> 
> G. Wade
> 
> Weiming Zhang wrote:
> > Hi,
> > 
> > Thank you very much.
> > 
> >>>Is it possible to rendering such svg content with Batik? 
> >>
> >>    Yes, and no.  There are some issues with the above example,
> >>like Batik requires an SVGDocument with a 'getRoot' method that
> >>returns the 'root' SVG element.  So you might be able to write a
> >>'hacked' document object that 'behaved' correctly however...
> > 
> > I tried the sample from SVG specification but it did not work. You are
> > right, it has to have svg element as root for batik rendering.
> > 
> > 
> >>>I want to use
> >>>some custom XML tags to add some extra information to the document. For
> >>>example, I may specify for certain group of graphic shapes, there are
> >>>certain callbacks. Those callbacks will be specified as either elements
> >>>or attributes. 
> >>
> >>    This makes me think that you may want (or at least get away with)
> >>something that looks more like:
> >>
> >>      <svg:svg width="4cm" height="8cm" version="1.1"
> >>          xmlns="http://example.org"
> >>         xmlns:svg="http://www.w3.org/2000/svg">
> >>        <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm">
> >>	  <callback-list>
> >>	     <!-- callbacks for the ellipse element -->
> >>	     <callback name="foo" function="bar"/>
> >>	  </callback-list>
> >>        </svg:ellipse>
> >>     </svg:svg>
> >>
> >>    This will work trivially "right out of the box".
> > 
> > This indeed works! But the callback related elements are not in SVG DTD,
> > so batik does not validate the document? If I make a DTD or schema by
> > adding some extra information to SVG DTD (is it possible to do
> > inheritance with a DTD?), how can I let batik know?
> > 
> > Thanks.
> > 
> > wz
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 




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


Re: rendering embedded svg

Posted by "wade.johnson@abbnm.com" <wa...@abbnm.com>.
The way I did this on a similar project was to put the
new elements and attributes in a different namespace.

Batik does not try to render those elements, but it does
make them available through the DOM.

G. Wade

Weiming Zhang wrote:
> Hi,
> 
> Thank you very much.
> 
>>>Is it possible to rendering such svg content with Batik? 
>>
>>    Yes, and no.  There are some issues with the above example,
>>like Batik requires an SVGDocument with a 'getRoot' method that
>>returns the 'root' SVG element.  So you might be able to write a
>>'hacked' document object that 'behaved' correctly however...
> 
> I tried the sample from SVG specification but it did not work. You are
> right, it has to have svg element as root for batik rendering.
> 
> 
>>>I want to use
>>>some custom XML tags to add some extra information to the document. For
>>>example, I may specify for certain group of graphic shapes, there are
>>>certain callbacks. Those callbacks will be specified as either elements
>>>or attributes. 
>>
>>    This makes me think that you may want (or at least get away with)
>>something that looks more like:
>>
>>      <svg:svg width="4cm" height="8cm" version="1.1"
>>          xmlns="http://example.org"
>>         xmlns:svg="http://www.w3.org/2000/svg">
>>        <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm">
>>	  <callback-list>
>>	     <!-- callbacks for the ellipse element -->
>>	     <callback name="foo" function="bar"/>
>>	  </callback-list>
>>        </svg:ellipse>
>>     </svg:svg>
>>
>>    This will work trivially "right out of the box".
> 
> This indeed works! But the callback related elements are not in SVG DTD,
> so batik does not validate the document? If I make a DTD or schema by
> adding some extra information to SVG DTD (is it possible to do
> inheritance with a DTD?), how can I let batik know?
> 
> Thanks.
> 
> wz
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 



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


Re: rendering embedded svg

Posted by Weiming Zhang <We...@UCHSC.edu>.
Hi,

Thank you very much.
> > Is it possible to rendering such svg content with Batik? 
> 
>     Yes, and no.  There are some issues with the above example,
> like Batik requires an SVGDocument with a 'getRoot' method that
> returns the 'root' SVG element.  So you might be able to write a
> 'hacked' document object that 'behaved' correctly however...
I tried the sample from SVG specification but it did not work. You are
right, it has to have svg element as root for batik rendering.

> 
> > I want to use
> > some custom XML tags to add some extra information to the document. For
> > example, I may specify for certain group of graphic shapes, there are
> > certain callbacks. Those callbacks will be specified as either elements
> > or attributes. 
> 
>     This makes me think that you may want (or at least get away with)
> something that looks more like:
> 
>       <svg:svg width="4cm" height="8cm" version="1.1"
>           xmlns="http://example.org"
>          xmlns:svg="http://www.w3.org/2000/svg">
>         <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm">
> 	  <callback-list>
> 	     <!-- callbacks for the ellipse element -->
> 	     <callback name="foo" function="bar"/>
> 	  </callback-list>
>         </svg:ellipse>
>      </svg:svg>
> 
>     This will work trivially "right out of the box".
This indeed works! But the callback related elements are not in SVG DTD,
so batik does not validate the document? If I make a DTD or schema by
adding some extra information to SVG DTD (is it possible to do
inheritance with a DTD?), how can I let batik know?

Thanks.

wz




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


Re: rendering embedded svg

Posted by Thomas DeWeese <Th...@Kodak.com>.
Weiming Zhang wrote:

> The svg specification shows a simple SVG content embedded inline as a
> fragment within a parent XML document:

> 	<?xml version="1.0" standalone="yes"?>
> <parent xmlns="http://example.org"
>        xmlns:svg="http://www.w3.org/2000/svg">
>    <!-- parent contents here -->
>    <svg:svg width="4cm" height="8cm" version="1.1">
>       <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm" />
>    </svg:svg>
>    <!-- ... -->
> </parent>
> 
> Is it possible to rendering such svg content with Batik? 

    Yes, and no.  There are some issues with the above example,
like Batik requires an SVGDocument with a 'getRoot' method that
returns the 'root' SVG element.  So you might be able to write a
'hacked' document object that 'behaved' correctly however...

> I want to use
> some custom XML tags to add some extra information to the document. For
> example, I may specify for certain group of graphic shapes, there are
> certain callbacks. Those callbacks will be specified as either elements
> or attributes. 

    This makes me think that you may want (or at least get away with)
something that looks more like:

      <svg:svg width="4cm" height="8cm" version="1.1"
          xmlns="http://example.org"
         xmlns:svg="http://www.w3.org/2000/svg">
        <svg:ellipse cx="2cm" cy="4cm" rx="2cm" ry="1cm">
	  <callback-list>
	     <!-- callbacks for the ellipse element -->
	     <callback name="foo" function="bar"/>
	  </callback-list>
        </svg:ellipse>
     </svg:svg>

    This will work trivially "right out of the box".




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