Re: Escaped BLOB data in XML

2004-08-13 Thread Paul DuBois
At 10:46 -0700 8/12/04, Karam Chand wrote:
Hello,
i have a table with a LONGBLOB column. We store some
small images in it. I want to export them in XML
format with schema like:
data
data
...
...
Now the problem is even if I mysql_real_escape() and
changing entities like <,> to < & > the data
some of the characters are of ascii value 12,13 etc.
None of the XML parsers are able to recognise it and
they throw up error? I googled but couldnt find a
refernce on how to handle such characters in XML.
I assume you mean mysql_real_escape_string(), not
mysql_real_escape()?
mysql_real_escape_string() is intended for escaping data that
you are including in statements to be sent *to* the server.
It is not for escaping data that you get back *from* the
server in the result from a query.
The issue you're describing is an XML issue, not a
MySQL issue.  You'll probably get more help if you post
your question (which boils down to "how can I write out
binary data to an XML file?") on an XML-related list.
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: Escaped BLOB data in XML

2004-08-13 Thread Chris Blackwell
If you base64 encode your binary, it will be valid inside the xml.  As far
as I know this is the accepted way to transfer binary objects using xml.

chris 

-Original Message-
From: Karam Chand [mailto:[EMAIL PROTECTED] 
Sent: 13 August 2004 05:09
To: Keith Ivey; [EMAIL PROTECTED]
Subject: Re: Escaped BLOB data in XML

This leads me to another question. What are the valid ASCII characters that
XML parser understands. 

Are they only a-1,A-Z,0-9,., etc or some other characters.

Regards,
Karam
--- Karam Chand <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> Hmmm. I was figuring that out. mysql_escape_string() only escapes 
> characters like \r, \n, \\, 0 etc. it still keep other non-character 
> data same like it keep ascii 15 to ascii 15 that no parser is able to 
> handle.
> 
> Isnt there any better way then base64 to handle this.
> Just like replacin < to < solves the problem in the data?
> 
> Regards,
> Karam
> 
> --- Keith Ivey <[EMAIL PROTECTED]> wrote:
> 
> > Karam Chand wrote:
> > 
> > >i have a table with a LONGBLOB column. We store
> > some
> > >small images in it. I want to export them in XML format with schema 
> > >like:
> > >
> > >data
> > >data
> > >...
> > >...
> > >
> > >Now the problem is even if I mysql_real_escape()
> > and
> > >changing entities like <,> to < & > the
> data
> > >some of the characters are of ascii value 12,13
> > etc.
> > >None of the XML parsers are able to recognise it
> > and
> > >they throw up error? I googled but couldnt find a refernce on how 
> > >to handle such characters in XML.
> > >  
> > >
> > 
> > This doesn't have anything to do with MySQL.  XML isn't really 
> > designed for directly containing binary data, so people
> generally
> > use Base64 encoding (or
> > occasionally some other method of encoding binary data in ASCII).  
> > The XML parser isn't going to be able to return the raw binary data 
> > -- you'll have to decode it.
> > 
> > --
> > Keith Ivey <[EMAIL PROTECTED]>
> > Washington, DC
> > 
> > 
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:   
> >
>
http://lists.mysql.com/[EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
>   
> __
> Do you Yahoo!?
> Yahoo! Mail - Helps protect you from nasty viruses.
> http://promotions.yahoo.com/new_mail
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:   
>
http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 




__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Escaped BLOB data in XML

2004-08-12 Thread Karam Chand
This leads me to another question. What are the valid
ASCII characters that XML parser understands. 

Are they only a-1,A-Z,0-9,., etc or some other
characters.

Regards,
Karam
--- Karam Chand <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> Hmmm. I was figuring that out. mysql_escape_string()
> only escapes characters like \r, \n, \\, 0 etc. it
> still keep other non-character data same like it
> keep
> ascii 15 to ascii 15 that no parser is able to
> handle.
> 
> Isnt there any better way then base64 to handle
> this.
> Just like replacin < to < solves the problem in
> the
> data?
> 
> Regards,
> Karam
> 
> --- Keith Ivey <[EMAIL PROTECTED]> wrote:
> 
> > Karam Chand wrote:
> > 
> > >i have a table with a LONGBLOB column. We store
> > some
> > >small images in it. I want to export them in XML
> > >format with schema like:
> > >
> > >data
> > >data
> > >...
> > >...
> > >
> > >Now the problem is even if I mysql_real_escape()
> > and
> > >changing entities like <,> to < & > the
> data
> > >some of the characters are of ascii value 12,13
> > etc.
> > >None of the XML parsers are able to recognise it
> > and
> > >they throw up error? I googled but couldnt find a
> > >refernce on how to handle such characters in XML.
> > >  
> > >
> > 
> > This doesn't have anything to do with MySQL.  XML
> > isn't really designed for
> > directly containing binary data, so people
> generally
> > use Base64 encoding (or
> > occasionally some other method of encoding binary
> > data in ASCII).  The XML
> > parser isn't going to be able to return the raw
> > binary data -- you'll 
> > have to
> > decode it.
> > 
> > -- 
> > Keith Ivey <[EMAIL PROTECTED]>
> > Washington, DC
> > 
> > 
> > -- 
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:   
> >
>
http://lists.mysql.com/[EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
>   
> __
> Do you Yahoo!?
> Yahoo! Mail - Helps protect you from nasty viruses.
> http://promotions.yahoo.com/new_mail
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:   
>
http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 




__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Escaped BLOB data in XML

2004-08-12 Thread Karam Chand
Hello,

Hmmm. I was figuring that out. mysql_escape_string()
only escapes characters like \r, \n, \\, 0 etc. it
still keep other non-character data same like it keep
ascii 15 to ascii 15 that no parser is able to handle.

Isnt there any better way then base64 to handle this.
Just like replacin < to < solves the problem in the
data?

Regards,
Karam

--- Keith Ivey <[EMAIL PROTECTED]> wrote:

> Karam Chand wrote:
> 
> >i have a table with a LONGBLOB column. We store
> some
> >small images in it. I want to export them in XML
> >format with schema like:
> >
> >data
> >data
> >...
> >...
> >
> >Now the problem is even if I mysql_real_escape()
> and
> >changing entities like <,> to < & > the data
> >some of the characters are of ascii value 12,13
> etc.
> >None of the XML parsers are able to recognise it
> and
> >they throw up error? I googled but couldnt find a
> >refernce on how to handle such characters in XML.
> >  
> >
> 
> This doesn't have anything to do with MySQL.  XML
> isn't really designed for
> directly containing binary data, so people generally
> use Base64 encoding (or
> occasionally some other method of encoding binary
> data in ASCII).  The XML
> parser isn't going to be able to return the raw
> binary data -- you'll 
> have to
> decode it.
> 
> -- 
> Keith Ivey <[EMAIL PROTECTED]>
> Washington, DC
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:   
>
http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 




__
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Escaped BLOB data in XML

2004-08-12 Thread Keith Ivey
Karam Chand wrote:
i have a table with a LONGBLOB column. We store some
small images in it. I want to export them in XML
format with schema like:
data
data
...
...
Now the problem is even if I mysql_real_escape() and
changing entities like <,> to < & > the data
some of the characters are of ascii value 12,13 etc.
None of the XML parsers are able to recognise it and
they throw up error? I googled but couldnt find a
refernce on how to handle such characters in XML.
 

This doesn't have anything to do with MySQL.  XML isn't really designed for
directly containing binary data, so people generally use Base64 encoding (or
occasionally some other method of encoding binary data in ASCII).  The XML
parser isn't going to be able to return the raw binary data -- you'll 
have to
decode it.

--
Keith Ivey <[EMAIL PROTECTED]>
Washington, DC
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]