Re: special characters

2003-11-25 Thread Chris Pratt
The XML could be source XML that still needs to be combined with an XSL-T
transformation to become an XSL-FO stylesheet, or it could be an already
formatted XSL-FO stylesheet document, the term from the previous emails was
ambiguous, since they're all XML.  With that in mind, how you would treat
them differs.  In the case where you have a simple XML data document and an
XSL-T file, you could use the org.jdom.transform.JDOMSource to feed the
document to the transformer.  In the case where you already have an XSL-FO
document, you could use the org.jdom.output.SAXOutputter as input to the FOP
Driver class and skip the memory wasting step of converting the document to
an in memory string.
  (*Chris*)

- Original Message - 
From: "Prabhat Kumar (IT)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 25, 2003 11:01 AM
Subject: RE: special characters


>>Or if your XML is already XSL-FO, you can use the
>>org.jdom.output.SAXOutputter class to directly interface with the fop

What do you mean by this? The generated XML is just that -- a bunch of tags
and values. Do you mean that when the FO style sheet is applied to an XML,
the result is another XML? Is this what you mean by 'already XSL-FO'?


-Original Message-
From: Chris Pratt [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 1:27 PM
To: [EMAIL PROTECTED]
Subject: Re: special characters


Even better than converting it to a stream, you can use the
org.jdom.transform.JDOMSource as the XML Source parameter to the
Transformation process.  Or if your XML is already XSL-FO, you can use the
org.jdom.output.SAXOutputter class to directly interface with the fop
Driver.
  (*Chris*)

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 25, 2003 2:03 AM
Subject: Re: special characters


> There's a nice way to manipulate XML Data with the JDOM API :
> http://www.jdom.org
>
> Starting from strings, you can easily create a JDOM tree object and then
> output it to a stream (and then transform your xsl-fo tree). You don't
> have to worry about special characters. You just have to care for the size
> of your tree, which musn't be too big, for memory reasons.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




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


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





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



Re: special characters

2003-11-25 Thread Jeremias Maerki
The speed-freaks will say that taking a detour via a DOM or JDOM is
suboptimal. Granted, directly generating SAX events may seem more
difficult at first, but it's definitely faster as fewer objects are
constructed and garbage collected. But given FOP's speed it probably
doesn't matter much.

On 25.11.2003 19:26:51 Chris Pratt wrote:
> Even better than converting it to a stream, you can use the
> org.jdom.transform.JDOMSource as the XML Source parameter to the
> Transformation process.  Or if your XML is already XSL-FO, you can use the
> org.jdom.output.SAXOutputter class to directly interface with the fop
> Driver.


Jeremias Maerki


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



RE: special characters

2003-11-25 Thread Prabhat Kumar (IT)
>>Or if your XML is already XSL-FO, you can use the
>>org.jdom.output.SAXOutputter class to directly interface with the fop

What do you mean by this? The generated XML is just that -- a bunch of tags and 
values. Do you mean that when the FO style sheet is applied to an XML, the 
result is another XML? Is this what you mean by 'already XSL-FO'?


-Original Message-
From: Chris Pratt [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 1:27 PM
To: [EMAIL PROTECTED]
Subject: Re: special characters


Even better than converting it to a stream, you can use the
org.jdom.transform.JDOMSource as the XML Source parameter to the
Transformation process.  Or if your XML is already XSL-FO, you can use the
org.jdom.output.SAXOutputter class to directly interface with the fop
Driver.
  (*Chris*)

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 25, 2003 2:03 AM
Subject: Re: special characters


> There's a nice way to manipulate XML Data with the JDOM API :
> http://www.jdom.org
>
> Starting from strings, you can easily create a JDOM tree object and then
> output it to a stream (and then transform your xsl-fo tree). You don't
> have to worry about special characters. You just have to care for the size
> of your tree, which musn't be too big, for memory reasons.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




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


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



Re: special characters

2003-11-25 Thread Chris Pratt
Even better than converting it to a stream, you can use the
org.jdom.transform.JDOMSource as the XML Source parameter to the
Transformation process.  Or if your XML is already XSL-FO, you can use the
org.jdom.output.SAXOutputter class to directly interface with the fop
Driver.
  (*Chris*)

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 25, 2003 2:03 AM
Subject: Re: special characters


> There's a nice way to manipulate XML Data with the JDOM API :
> http://www.jdom.org
>
> Starting from strings, you can easily create a JDOM tree object and then
> output it to a stream (and then transform your xsl-fo tree). You don't
> have to worry about special characters. You just have to care for the size
> of your tree, which musn't be too big, for memory reasons.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




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



Re: special characters

2003-11-25 Thread mathieu . fretiere
There's a nice way to manipulate XML Data with the JDOM API :
http://www.jdom.org

Starting from strings, you can easily create a JDOM tree object and then 
output it to a stream (and then transform your xsl-fo tree). You don't 
have to worry about special characters. You just have to care for the size 
of your tree, which musn't be too big, for memory reasons.


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



Re: special characters

2003-11-25 Thread Jeremias Maerki
No, AFAIK Digester is for the opposite direction: Parsing XML into
objects. Have a look at the examples here:
http://xml.apache.org/fop/embedding.html#examples

They describe (step-by-step) how to generate SAX events from Java
objects and use that approach with FOP.

On 24.11.2003 23:42:05 Prabhat Kumar (IT) wrote:
> Thanks for the suggestions. Yes I do generate the XML as a String.
> That's because we get back Data as Objects from the database via
> Hibernate. I then call a toXMLString() method on this Object to return
> get an XML String.
> 
> My XML knowledge is pretty rudimentary. So where would you suggest that
> I generate the XML using SAX/DOM. I've heard that the  Digester does a
> pretty nifty job, do you suggest this? Any other?


Jeremias Maerki


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



RE: special characters

2003-11-24 Thread Prabhat Kumar (IT)
Hey,

Thanks for the suggestions. Yes I do generate the XML as a String. That's 
because we get back Data as Objects from the database via Hibernate. I then 
call a toXMLString() method on this Object to return get an XML String.

My XML knowledge is pretty rudimentary. So where would you suggest that I 
generate the XML using SAX/DOM. I've heard that the  Digester does a pretty 
nifty job, do you suggest this? Any other?

Thanks in Advance,

Prabhat.


-Original Message-
From: J.Pietschmann [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 4:14 PM
To: [EMAIL PROTECTED]
Subject: Re: special characters


Prabhat Kumar (IT) wrote:

> I am having to escape special characters such as apostrophes (replace with
> &apos) to get them to display correctly on PDFs. Is this really necessary?
> 
> Basically What I do is,
> 
> 1. Read Database.
 > 2. Generate XML for this data.
 > 2a. During this generation, replace characters such as apostrophes, quotes,
 > ampersands with ' " & respectively.
 > 3. Apply XSL-FO transormations to this XML 4. Write the
> generated PDF's bytes to a the ServletOutputStream.
> 
> Step 2a seems wasteful to me. Has anyone had to do this before? Is there a
> better way?

It depends. It seems you generate the XML as string. In this case you
have always to escape the ampersand. The apostrophe and quote characters
need only to be escaped in attribute values (and even then not always),
there is no need to replace them in text content.

You can look at generating a DOM, or SAX events. In this case you must
not escape special XML characters, but this also means you can't store
XML snippets with markup in your database.

J.Pietschmann


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


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



Re: special characters

2003-11-24 Thread J.Pietschmann
Prabhat Kumar (IT) wrote:
I am having to escape special characters such as apostrophes (replace with
&apos) to get them to display correctly on PDFs. Is this really necessary?
Basically What I do is,
1. Read Database.
> 2. Generate XML for this data.
> 2a. During this generation, replace characters such as apostrophes, quotes,
> ampersands with ' " & respectively.
> 3. Apply XSL-FO transormations to this XML 4. Write the
generated PDF's bytes to a the ServletOutputStream.
Step 2a seems wasteful to me. Has anyone had to do this before? Is there a
better way?
It depends. It seems you generate the XML as string. In this case you
have always to escape the ampersand. The apostrophe and quote characters
need only to be escaped in attribute values (and even then not always),
there is no need to replace them in text content.
You can look at generating a DOM, or SAX events. In this case you must
not escape special XML characters, but this also means you can't store
XML snippets with markup in your database.
J.Pietschmann
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: special characters

2003-10-17 Thread Stefan Champailler
You're character is probably outside the encoding of your XML file. What's the 
encoding of your file (it's set in the header : 


> Hello:
>
>   I'm trying to print a special character for bullets, but everytime FOP
> encounters this statement, it halts with the message: "An invalid xml
> character (unicode: 0xb7) was found in the file."
>
>  
>   ·
>  
>
> If I change the number to, say, *, all is well.
>
> Can anyone tell me how to make · into a valid character?
>
> Cheers
>
> Jon
>
> -Original Message-
> From: Chris Bowditch [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 01, 2003 12:47 AM
> To: [EMAIL PROTECTED]
> Subject: Re: xml/xsl in one fileL
>
>
> From: "J.Pietschmann" <[EMAIL PROTECTED]>
>
> >Well, for a start I gather the original poster didn't
> >want to have a reference to the XSLT in the XML file
> >but the XSLT code itself, perhaps something like
>
> Oh I see, that wasnt my understanding of the request, but perhaps you are
> right. In which case it would not be a simple task to implement.
>
> 
>
> >In either case the XSLT code can be extracted with a filter,
> >but it is certainly more laboriously than just extracting
> >the reference. There are a few more details needing attention,
> >for example how namespaces declared on the elements
> >enclosing the XSLT code but not referenced there will be
> >handled.
>
> Yes I am now enlighted processing XSLT embedded in the XML would not be
> easy.
>
> >The second assuption is that the user wouldn't mind if the
> >document is opened andprocessed twice. A reasonable assumption
> >for a file, but more difficult to asses for documents addressed
> >by HTTP URLs, and even more difficult for on-the-fly generated
> >XML, as it often happens at DB interfaces.
>
> A good point, but if this was the only negative I would be inclined to
> apply the 80-20 rule of software development (i.e. no software satisfies
> all user requirements, so just settle for satisfying 80% of them)
>
> Chris
>
> _
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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



Re: special characters

2003-10-16 Thread Chris Bowditch
From: Jon Steeves <[EMAIL PROTECTED]>
	I'm trying to print a special character for bullets, but everytime FOP 
encounters this statement, it halts with the message: "An invalid xml 
character (unicode: 0xb7) was found in the file."
This is most likely an encoding problem. How are you running FOP? From 
command line with XSL and XML files? Check the processing instruction at the 
top (first line) of your files for the encoding.

There is more information about this on the website;
http://xml.apache.org/fop/fo.html#xml-entity-chars

Chris
_
Find a cheaper internet access deal - choose one to suit you. 
http://www.msn.co.uk/internetaccess

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


Re: special characters

2003-02-05 Thread J.Pietschmann
Jon Steeves wrote:
  The special characters that didn't appear in the previous email are: pi, omega, and sigma.
Well, as Roland said, chances are you need to declare the XML
file to be encoded in the greek subset of ISO-8859 (IIRC
 
If this causes the parser to choke, use character references.
Pull the Unicode encodings from
 http://www.unicode.org/charts/charindex.html
Umm, greek letters aren't individually exposed there. Use
the code charts instread.
For example small pi is π, sigma σ etc.
J.Pietschmann
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: special characters

2003-02-04 Thread Roland Neilands
Jon,

You seem to have the same problem with emailing your characters to the list
as in your PDF.

As well as this:
http://xml.apache.org/fop/faq.html#faq-N10402

the other problem might be not using the correct file encoding declaration
eg.


in your XML/XSL to match the actual file encodings(file editor, Save As -
Type).

Regards,
Roland

> -Original Message-
> From: Jon Steeves [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 5 February 2003 10:07 AM
> To: '[EMAIL PROTECTED]'
> Subject: special characters
>
>
> Hello:
>
>   I want the PDF we generate to be able to print special
> characters such as: ? ? ?.  Right now these are rendered as: P S O.
> Do I have to add a font to FOP or is there a simpler method
> to do this?
>
> Cheers
>
> Jon Steeves
> [EMAIL PROTECTED]
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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



RE: special characters

2003-02-04 Thread Jon Steeves
Followup:

  The special characters that didn't appear in the previous email are: pi, 
omega, and sigma.

Cheers

-Original Message-
From: Jon Steeves 
Sent: Tuesday, February 04, 2003 3:07 PM
To: '[EMAIL PROTECTED]'
Subject: special characters


Hello:

I want the PDF we generate to be able to print special characters such 
as: ? ? ?.  Right now these are rendered as: P S O.
Do I have to add a font to FOP or is there a simpler method to do this?

Cheers

Jon Steeves
[EMAIL PROTECTED]


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

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



Re: Special Characters

2002-12-30 Thread Joerg Pietschmann
On Monday 30 December 2002 16:55, you wrote:
> My problem is that sometimes FOP creates an invalid PDF file
> because of a special character (such the Euro sign, for example).  Each
> time this happens, I look for that character in my code and replace it with
> an equivalent character or the Unicode representation.
>
> My question is, is there a known list of characters which will cause FOP to
> fail?

How do you define an "invalid PDF file"? Does Acrobat Reader refuse
to open such a file, does FOP raise an error or does the file just contain
an "#" or other unexpected glyphs?

Firstly, you should probably learn about character encodings in XML.
Each XML file starts with an XML declaration:
  
The declaration above means the file is UTF-8 encoded. You can't
for example edit this file with Windows Notepad and enter an Euro
sign (unless you have W2K or later and use "save as UTF-8").
You can put an encoding into the XML declaration, like
  
which means the file is ISO-8859-1 or Latin-1 encoded, the most
used character encoding. However, you still can't dit this file with
Windows Notepad and enter an Euro sign, because Windows usually
uses an extension of ISO-8859-1 called CP1252 or something similar,
and contrary to the example above, FOP will not catch this and simply
output a "#".
If in doubt, restrict yourself to the ASCII character range and enter each
Unicode character outside this range as XML character reference. The
Euro sign is for example € (including the semicolon). See
 http://www.unicode.org/charts/charindex.html
for a lookup table.
Alternatively, get an XML aware editor and use it exclusively.
Look also into the XML spec for more info:
  http://www.w3.org/TR/REC-xml

The second problem is that the standard fonts don't contain glyphs for most
Unicode characters. Helvetica (Arial), Times and Courier have only glyphs
for most of the characters from the ISO-8859-1 range (and a few characters 
outside this range), Symbol and Zapf Dingbats cover other ranges. See the
fonts.fo file in the FOP example directory tree for details. You can render
this file to PDF and see all characters supported out of the box. If there is
no glyph in the font for the required character, FOP uses "#" or the
equivalent in the font's encoding (it is some other glyph for the Symbol and
the Dingbat font).
For all other characters, you have to install a user font containing glyphs
for the characters you want to display. See docs/html-docs/font.html for more
info about this topic.

J.Pietschmann

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