xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raphael Parree <rpar...@gmail.com>
Subject Re: XMLFilterImpl producing SVG instream-foreign-object
Date Mon, 15 Mar 2010 06:35:20 GMT
Hi,

I have meanwhiel found a way of making it work - i am sure there must be a
better way; what i'm doing below smells pretty bad...
I SAX parse the SVG and propagate its SAX events to the XmlFilter's parent
content handler:
===================================
XMLReader xmlReader = XMLReaderFactory.createXMLReader();

*final ContentHandler ch = super.getContentHandler();*
xmlReader.setContentHandler(new DefaultHandler() {

   @Override
   public void startElement(String uri, String localName, String qName,
Attributes a)  {
     *ch*.startElement(uri, localName, qName, a);
   }

   @Override
   public void endElement(String uri, String localName, String qName) throws
SAXException {
     *ch*.endElement(uri, localName, qName);
   }

   @Override
   public void characters(char[] chars, int start, int length) throws
SAXException {
     *ch*.characters(chars, start, length);
   }
});

xmlReader.parse(new InputSource(new StringReader(svgText)));
===================================


On Thu, Feb 18, 2010 at 1:30 PM, Raphael Parree <rparree@gmail.com> wrote:

> I am still struggling with this one...anybody might have a answer or
> direction?
>
> On Tue, Feb 9, 2010 at 10:40 AM, Raphael Parree <rparree@gmail.com> wrote:
>
>> Hi,
>>
>> I wrote an XMLFilterImpl which produces a instream-foreign-object. In
>> another filter i was able to call the super methods to push the result in
>> the FO tree: In this case i can not use that because the XML of the SVG
>> needs to be parsed
>>
>> String svgText = umlDiagramProducer.produceSVGText(s);
>>
>> super.startElement(FONS, "instream-foreign-object",
>> "fo:instream-foreign-object", attributes);
>> //what am i going to put here???
>> super.endElement(FONS, "instream-foreign-object",
>> "fo:instream-foreign-object");
>>
>>
>> I tried super.parse(new InputSource(new StringReader(svgText)));
>> and a new SAXParser passing the parent contenthandler, but all results in
>> exceptions.
>>
>> Thanks!
>> --
>> Raphael Parree
>>
>>
>
>
> --
> Raphael Parree
> CTO
> SOA Evangelist
>
> phone +33 673 75 34 62
> Disclaimer...
> "The information contained in this message may be confidential and is
> intended to be exclusively for the addressee. Sender's written permission is
> needed prior to forwarding or otherwise using the content of the message,
> whether completely or partially. Should you receive this message
> unintentionally, please do not use the contents herein and notify the sender
> immediately by return e-mail. Please rely on your own virus checking, no
> responsibility is taken by the sender for any damage rising out of any bug
> or virus infection."
>
>


-- 
Raphael Parree
CTO
SOA Evangelist

phone +33 673 75 34 62
Disclaimer...
"The information contained in this message may be confidential and is
intended to be exclusively for the addressee. Sender's written permission is
needed prior to forwarding or otherwise using the content of the message,
whether completely or partially. Should you receive this message
unintentionally, please do not use the contents herein and notify the sender
immediately by return e-mail. Please rely on your own virus checking, no
responsibility is taken by the sender for any damage rising out of any bug
or virus infection."

Mime
View raw message