<fo:external-graphic src="url(/Path/1&2.jpg)"/>

Since the above line is XML (XML/FO) the parser sees the "&" and will expect the following characters to be either a character reference or a XML entity. So when attempting to parse the string &1.jpg)"/> this is obviously invalid XML. So the & must be converted to it's entity representation &amp; Think of the "&" and ";" characters as open and close quotes for literal strings in an expression (i.e. name = "John Smith"). The XML parser sees "&" and looks for a ";" terminating character (in the case of entities). If the string between the delimiters is a recognized entity name like amp, quot, gt, or lt. then the entity is valid and the parsing of the entity should be handled properly.

Actually if I try to escape the &, it displays the "&amp;" inside the pdf like "me &amp; you" ... So it doesn't work:(

You need to check your XML source that is passed to the XML/FO parser and make sure that the string "me &amp; you" is not already escaped in some way.

On Jun 5, 2007, at 8:35 AM, WO Dev wrote:

Hello Jean-François,

Actually if I try to escape the &, it displays the "&amp;" inside the pdf like "me &amp; you" ... So it doesn't work:(


Xavier

Here is a method that 'escape' some chars.
We call this method before inserting a string (comming from an eo attribute for example) into a fo-xml stream.

        static public String transformeCaracteresSpeciaux(String chaine) {
                if (chaine != null) {
                        String uneSt =  chaine.replaceAll("&", "&amp;");
                        uneSt = uneSt.replaceAll("\"", "&quot;");  
                        uneSt = uneSt.replaceAll("<", "&lt;");
                        uneSt = uneSt.replaceAll(">", "&gt;");
                        return uneSt;
                }
                return chaine;
        }

- jfv

Le 07-06-05 à 04:49, WO Dev a écrit :

Hello,

I couldn't find the answer on the FOP archives, so I'm posting to this list as some of you know FOP (a lot better than me;))

I'm trying to figure out how to make a pdf using FOP...
Well actually I think I'm pretty close, but I don't even know how it looks like as there's still one crash:

I have some text with & inside, so I was able to make them to work by using <![CDATA[my_string]]>.

But I also have some images with a & in their names like:
<fo:external-graphic src="url(/Path/1&2.jpg)"/>

So FOP crash on that...

I can't change the name of the images, how can I make FOP to work with this name?

Thanks for your help

Xavier

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/ jean_francois_veillette%40yahoo.ca

This email sent to [EMAIL PROTECTED]



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/robertwalker1% 40mac.com

This email sent to [EMAIL PROTECTED]

--
Robert Walker
[EMAIL PROTECTED]



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to