RE: Convert InputSource into a Character array

2007-04-06 Thread Sascha Schmidt
Hi Harshini,

I though you were using a large XML String (/Character-Array) with a
CharArrayReader to setup your InputSource. Maybe I was wrong? How do you
create your input source? It seems that someone uses and closes the
InputSource (i.e. the stream) before FOP is invoked? Things are still a bit
unclear for me. ;-) Could you please tell me, what you are doing before FOP
is invoked and what is done afterwards?

Cheers,
Sascha

 


 -Original Message-
 From: Harshini Madurapperuma [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 05, 2007 12:55 PM
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Convert InputSource into a Character array
 
 Hi all, and Sascha
 
 Sascha thanx a lot for ur ideas; but I'm not clear what u have meant by
 String xml in the
 MyInputSource constructor. And from where should I call this constructor?
 
 Harshini
 
 -Original Message-
 From: Sascha Schmidt [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 05, 2007 9:55 AM
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Convert InputSource into a Character array
 
 Hi all,
 
 I assume Harshini needs to get the original XML-String from a
 CharArrayReader (after rendering), which he used to equip the InputSource.
 IMHO there is no chance to get the XML-String back, because
 CharArrayReader.close() sets the internal Char-Buffer, which holds the
 XML-String, to null. Thus one would either need to introduce a new
 attribute
 somewhere in Harshinis class/code or extending class InputSource. I would
 prefer the second method. This should give you a start point:
 
 class MyInputSource extends InputSource{
 
   private String xml;
 
   public MyInputSource(String xml){
 super(new CharArrayReader(xml));
   }
 
   public String getXML(){
 return this.xml;
   }
 }
 
 
 Somewhere later...
 
 ((MyInputSource) source).getXML()
 
 returns the xml.
 
 Note that the code above is not tested, just typed in Outlook. ;-)
 
 Cheers,
 Sascha
 
 PS: Of course it is correct that FOP closes the stream after processing
 it.
 
 
   NORTHBIT
 RTF to XSL-FO, Reporting
 Dipl. Inf. Sascha Schmidt
 [EMAIL PROTECTED]
   www.northbit.de
 
 
  -Original Message-
  From: Harshini Madurapperuma [mailto:[EMAIL PROTECTED]
  Sent: Thursday, April 05, 2007 5:18 AM
  To: fop-users@xmlgraphics.apache.org
  Subject: RE: Convert InputSource into a Character array
 
  Hi;
 
  I have this character array, I converted that character array into to
  a InputSource and passed it as a parameter to a  render(XMLReader
  parser, InputSource source) method in the DRIVER class in fop.
 
  Within that render class I need to convert that InputSource (source)
  back into a character array (after doing some modifications inside
  that method). I tried to convert that as follows:
 
   if (source.getCharacterStream() != null) {
 BufferedReader reader = new
  BufferedReader(source.getCharacterStream());
 CharArrayWriter writer=new CharArrayWriter();
 int i=-1;
 while ((i=reader.read())!=-1)
 {
   writer.write(i);
  }
  reader.close();
  writer.close();
  }
 
  While doing that it raise this Exception:
   EXCEPTION---
   --
   --
   
  
   java.io.IOException: Stream closed at
   java.io.CharArrayReader.ensureOpen(CharArrayReader.java:65) at
   java.io.CharArrayReader.read(CharArrayReader.java:95) at
   java.io.BufferedReader.fill(BufferedReader.java:136) at
   java.io.BufferedReader.read(BufferedReader.java:157) at
   org.apache.fop.apps.Driver.render(Driver.java:557)
   
   --
 
  I need to know the reason or is there any other method to convert this
  and access the content of this inputSource?
 
  Thanx
  Harshini
 
 
 
  -Original Message-
  From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
  Sent: Thursday, April 05, 2007 12:11 AM
  To: fop-users@xmlgraphics.apache.org
  Subject: Re: Convert InputSource into a Character array
 
  I don't understand what you're trying to do. Maybe you should explain
  that before going into technical details.
 
  On 04.04.2007 06:08:53 Harshini Madurapperuma wrote:
   Hi All;
  
   In fop Driver class there is a method called
  
   public synchronized void render(XMLReader parser, InputSource source)
   throws FOPException {
  
 }
  
   Is there a way to convert that InputSource source back into a
   character array within that render class? I tried to do it by this
   way but it throws a Stream Closed Exception.
   
   --
   --
   --
   if (source.getCharacterStream() != null) {
 BufferedReader reader = new
   BufferedReader(source.getCharacterStream());
 CharArrayWriter writer=new CharArrayWriter();
 int i=-1;
 while 

Re: FOP 0.93 throws exception when it encounters a graphic

2007-04-06 Thread a_l . delmelle
- Oorspronkelijk bericht -
Van: Jeff Powanda [mailto:[EMAIL PROTECTED]

Hi Jeff,

I trying to update my DocBook system to FOP 0.93 and DocBook XSl 1.72.
Whenever I try to process a document that has a graphic I now get the
following exception:

 

SEVERE: Exception


Can you send a bit more of the stack trace? From the top of the stack trace you 
posted, we can't derive where exactly the FOP code is throwing the exception.

Thanks,

Andreas



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wrapping Long Text Without Spaces

2007-04-06 Thread Jeff Vannest
 Just FYI: the other known workaround (which fits some scenarios  
 better than inserting ZWSPs) would be to activate hyphenation, and  
 use a ZWSP as hyphenation-character... In that case, FOP will

This is new to me, so let me see if I understand: A ZWSP is implicit between
characters. For example, the word CAT would contain three characters and
two ZWSP: C-ZWSP-A-ZWSP-T. Setting hyphenation to ZWSP would allow wrapping
as:

CA
T

...or...

C
AT

I think this sounds like the solution to use!

Jeff




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Convert InputSource into a Character array

2007-04-06 Thread Harshini Madurapperuma
Hi Sascha;

This is my class overview; for u to get a rough idea. Initially I have a
char array which I have converted into InputSource. Then within the Driver
class in render method I want that InputSource to be converted back into a
char array.

My class

--
private char[]  fo;
CharArrayWriter fos = new CharArrayWriter(); 
fo =fos.toCharArray(); 


--
public void myMethod_1 (){

InputSource foSource = new InputSource(new CharArrayReader(fo));

Driver driver = new Driver();
driver.render(xmlReader, foSource);


}


FOP

---
Driver Class

public synchronized void render(XMLReader parser, InputSource source)
throws FOPException {

if (source.getCharacterStream() != null) {
BufferedReader reader = new
BufferedReader(source.getCharacterStream());
  CharArrayWriter writer=new CharArrayWriter();
   int i=-1;
   while ((i=reader.read())!=-1)
   {
 writer.write(i);
}
reader.close();
writer.close();
}



Thanx
Harshini.
 

-Original Message-
From: Sascha Schmidt [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 06, 2007 4:11 PM
To: fop-users@xmlgraphics.apache.org
Subject: RE: Convert InputSource into a Character array

Hi Harshini,

I though you were using a large XML String (/Character-Array) with a
CharArrayReader to setup your InputSource. Maybe I was wrong? How do you
create your input source? It seems that someone uses and closes the
InputSource (i.e. the stream) before FOP is invoked? Things are still a bit
unclear for me. ;-) Could you please tell me, what you are doing before FOP
is invoked and what is done afterwards?

Cheers,
Sascha

 


 -Original Message-
 From: Harshini Madurapperuma [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 05, 2007 12:55 PM
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Convert InputSource into a Character array
 
 Hi all, and Sascha
 
 Sascha thanx a lot for ur ideas; but I'm not clear what u have meant 
 by String xml in the MyInputSource constructor. And from where should 
 I call this constructor?
 
 Harshini
 
 -Original Message-
 From: Sascha Schmidt [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 05, 2007 9:55 AM
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Convert InputSource into a Character array
 
 Hi all,
 
 I assume Harshini needs to get the original XML-String from a 
 CharArrayReader (after rendering), which he used to equip the InputSource.
 IMHO there is no chance to get the XML-String back, because
 CharArrayReader.close() sets the internal Char-Buffer, which holds the 
 XML-String, to null. Thus one would either need to introduce a new 
 attribute somewhere in Harshinis class/code or extending class 
 InputSource. I would prefer the second method. This should give you a 
 start point:
 
 class MyInputSource extends InputSource{
 
   private String xml;
 
   public MyInputSource(String xml){
 super(new CharArrayReader(xml));
   }
 
   public String getXML(){
 return this.xml;
   }
 }
 
 
 Somewhere later...
 
 ((MyInputSource) source).getXML()
 
 returns the xml.
 
 Note that the code above is not tested, just typed in Outlook. ;-)
 
 Cheers,
 Sascha
 
 PS: Of course it is correct that FOP closes the stream after 
 processing it.
 
 
   NORTHBIT
 RTF to XSL-FO, Reporting
 Dipl. Inf. Sascha Schmidt
 [EMAIL PROTECTED]
   www.northbit.de
 
 
  -Original Message-
  From: Harshini Madurapperuma [mailto:[EMAIL PROTECTED]
  Sent: Thursday, April 05, 2007 5:18 AM
  To: fop-users@xmlgraphics.apache.org
  Subject: RE: Convert InputSource into a Character array
 
  Hi;
 
  I have this character array, I converted that character array into 
  to a InputSource and passed it as a parameter to a  
  render(XMLReader parser, InputSource source) method in the DRIVER
class in fop.
 
  Within that render class I need to convert that InputSource (source)
  back into a character array (after doing some modifications inside 
  that method). I tried to convert that as follows:
 
   if (source.getCharacterStream() != null) {
 BufferedReader reader = new
  BufferedReader(source.getCharacterStream());
 CharArrayWriter writer=new CharArrayWriter();
 int i=-1;
 while ((i=reader.read())!=-1)
 {
   writer.write(i);
  }
  reader.close();
  writer.close();
  }
 
  While doing that it raise this Exception:
   EXCEPTION-
   --
   --
   --
   
  
   java.io.IOException: Stream closed at
   java.io.CharArrayReader.ensureOpen(CharArrayReader.java:65)  

Re: Wrapping Long Text Without Spaces

2007-04-06 Thread Vincent Hennebert
Hi Jeff,

Jeff Vannest a écrit :
 Just FYI: the other known workaround (which fits some scenarios  
 better than inserting ZWSPs) would be to activate hyphenation, and  
 use a ZWSP as hyphenation-character... In that case, FOP will
 
 This is new to me, so let me see if I understand: A ZWSP is implicit between
 characters. For example, the word CAT would contain three characters and
 two ZWSP: C-ZWSP-A-ZWSP-T. Setting hyphenation to ZWSP would allow wrapping
 as:
snip/

Not exactly, in fact the two methods will lead to different results:
- either you manually put ZWSP after underscores in your words, which
  allow FOP to break words after them;
- or you enable hyphenation and use ZWSP instead of the regular hyphen
  character. Thus FOP will break inside words that it is able to
  hyphenate; if they aren't normal English words this may not work well
  and you may prefer the first method.


HTH,
Vincent


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wrapping Long Text Without Spaces

2007-04-06 Thread Andreas L Delmelle

On Apr 6, 2007, at 14:58, Vincent Hennebert wrote:

Hi Jeff / Vincent,


snip /
- or you enable hyphenation and use ZWSP instead of the regular hyphen
  character. Thus FOP will break inside words that it is able to
  hyphenate; if they aren't normal English words this may not work  
well

  and you may prefer the first method.


IIRC, this is not entirely correct: with hyphenation turned FOP will  
always hyphenate words, period. AFAIK, there is no situation where  
FOP wouldn't be able to hyphenate. Using the hyphenation patterns,  
you can only indicate that certain hyphenation points are  
undesirable, but you can never turn on hyphenation and do something  
magical to keep FOP from hyphenating.


So, IOW, there is no word that FOP won't be able to hyphenate.


Cheers,

Andreas


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: word page break

2007-04-06 Thread Pardha Paruchuri
Hi Jay,
   
  Thanks for your help. I have tried to add my code to the existing template as 
shown below but that was giving NPE error during transformation.
   
  xsl:template match=w:br
  !-- defines a page, column, or text-wrapping break --
  xsl:choose
  xsl:when test=@w:type='page'/
 !--xsl:attribute name=break-beforepage/xsl:attribute-- my 
code
 !--fo:block break-before=page/-- my code
  xsl:when test=@w:type='column'/
  !-- if @w:type=text-wrapping or omitted - it's a new-line break --
  xsl:otherwise
  fo:block/
  /xsl:otherwise
  /xsl:choose
  /xsl:template
   
  So I added a new template just before the existing one and that worked. Here 
is the new one
   
  xsl:template match=w:[EMAIL PROTECTED]:type='page']
  !-- defines a page, column, or text-wrapping break --
  fo:block break-before=page/ 
  /xsl:template
   
  Thank you,
  Pardha
   
  Jay Bryant [EMAIL PROTECTED] wrote:
  Hi, Pardha,
   
  I've done lots of work with WordML, so I can get you started on this one.
   
  Insert - Page Break produces the following element in Word's XML output (in 
the paragraph's text run):
   
  w:br w:type=page/
   
  When you do it from the paragraph properties, you get the following element 
(in the pPr element for the paragraph):
   
  w:pageBreakBefore/
   
  So, to catch them both, you need corresponding templates, thus:
   
  xsl:template match=w:pageBreakBefore
!-- Do whatever you do with page breaks here --
  /xsl:template
   
xsl:template match=w:[EMAIL PROTECTED]:type='page']
!-- Do whatever you do with page breaks here --
  /xsl:template
   
  If you do the same thing with the two kinds of breaks, you can process them 
in the same template, thus:
   
xsl:template match=w:pageBreakBefore|w:[EMAIL PROTECTED]:type='page']
!-- Do whatever you do with page breaks here --
  /xsl:template
   

  HTH
   
  Jay Bryant
  Bryant Communication Services
   

- Original Message - 
  From: Pardha Paruchuri 
  To: fop-users@xmlgraphics.apache.org 
  Sent: Monday, April 02, 2007 12:56 PM
  Subject: word page break
  

  Hi All,
   
  I am using FOP 0.20.5 to convert a WordML document into PDF. As there are 2 
types of pagebreaks in word, one the hard/soft page break(from menu 
insert-page break) and two the pagebreakbefore property on a 
paragraph(highlight a paragraph and right click to see properties), I see that 
it is able to convert a pagebreakbefore but not the hard page break. I am just 
using a stylesheet that microsoft recommends to convert WordML into XML-FO and 
I could not figure out where we can make a change in the stylesheet to fix this 
issue. As I am new to XSL and understand that this may not be a FOP problem but 
could someone give me a clue as to why it is not able to convert a hard page 
break.
   
  Thanks,
  Pardha

-
  Looking for earth-friendly autos? 
Browse Top Cars by Green Rating at Yahoo! Autos' Green Center. 

 
-
Sucker-punch spam with award-winning protection.
 Try the free Yahoo! Mail Beta.