Author |
Message
|
satayoday |
Posted: Mon Apr 20, 2009 1:13 am Post subject: How to pass special character as it is... |
|
|
Novice
Joined: 27 May 2007 Posts: 22
|
Hi all,
I am extracting records from a database and creating an output xml file using MB comput node.
The problem is some of the records containing special character that that i need to pass them as it is .As xml does not support special character hence it is not opening.I am not sure which type of special character may come.I want to write code in which any special character can pass.
Thanks in advance. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Apr 20, 2009 1:29 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
What type of DB field are you reading that has this 'special character' in it? _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Apr 20, 2009 2:36 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
As xml does not support special character hence it is not opening |
Please define 'it' and 'opening'. We are not mind-readers!
Please provide an example of the output XML that you are getting, and another example showing what you would like to get. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 20, 2009 3:01 am Post subject: Re: How to pass special character as it is... |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
satayoday wrote: |
I want to write code in which any special character can pass. |
Then you need to put all the database data in a CDATA section. This of course may cause a few problems for whoever's receiving your output XML. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Apr 20, 2009 3:26 am Post subject: Re: How to pass special character as it is... |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
satayoday wrote: |
I want to write code in which any special character can pass. |
Then you need to put all the database data in a CDATA section. |
Well, no. Not really.
CDATA Sections do not protect non-legal XML characters. Only some mapping from binary values to characters - perhaps in a 3 byte to 4 character scheme? - will do that. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 20, 2009 3:39 am Post subject: Re: How to pass special character as it is... |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Well, no. Not really.
CDATA Sections do not protect non-legal XML characters. |
I've always thought that CDATA elements are unparsed (unlike PCDATA) and hence can contain any character / data element. So what happens to a non-legal XML character in a CDATA section?
Of course, I'm not even talking about different character sets in this context. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Apr 20, 2009 3:48 am Post subject: Re: How to pass special character as it is... |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
mqjeff wrote: |
Well, no. Not really.
CDATA Sections do not protect non-legal XML characters. |
I've always thought that CDATA elements are unparsed (unlike PCDATA) and hence can contain any character / data element. So what happens to a non-legal XML character in a CDATA section?
Of course, I'm not even talking about different character sets in this context. |
The XML parse on the document fails, the same as it would with a non-legal XML character anywhere else.
CDATA sections have to be parsable enough for the XML parser to find the end tag, just like the entire XML document has to be parseable enough for the parser to find the closing tag for the root element. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 20, 2009 4:04 am Post subject: Re: How to pass special character as it is... |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
The XML parse on the document fails, the same as it would with a non-legal XML character anywhere else. |
Weird. My copy of XMLSpy says my quickly-knocked up XML document with an assortment of control characters and packd numbers in a CDATA is well formed.
mqjeff wrote: |
CDATA sections have to be parsable enough for the XML parser to find the end tag, just like the entire XML document has to be parseable enough for the parser to find the closing tag for the root element. |
I grant you that such a section can't contain the characters for a CDATA end tag, so the parser can find that sequence.
Investigation (or fiddling round) continues. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Apr 20, 2009 4:14 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 20, 2009 4:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
You don't get parsers the way you used to....  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Apr 20, 2009 11:30 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
In my experience, very few people 'get' parsers at all
Most think that parsing must be easy, just because their own brain is so effortlessly excellent at it. |
|
Back to top |
|
 |
satayoday |
Posted: Mon Apr 20, 2009 8:45 pm Post subject: What type of DB field are you reading that has this 'special |
|
|
Novice
Joined: 27 May 2007 Posts: 22
|
I am accessing DB2 database with column field type character having those special character |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Apr 20, 2009 9:28 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
You still have not given us an idea what this special character is..... _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
satayoday |
Posted: Mon Apr 20, 2009 9:35 pm Post subject: You still have not given us an idea what this special charac |
|
|
Novice
Joined: 27 May 2007 Posts: 22
|
I am getting the below mentioned special characters
Plössl ,Large 2 Metal ,& etc
The xml tags like this giving problem
<Manufacturer>10mm Plössl Eyepiece</Manufacturer> |
|
Back to top |
|
 |
kimbert |
Posted: Tue Apr 21, 2009 12:12 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
The xml tags like this giving problem |
You still have not explained what the problem is. Please see my previous answer, and provide the information that I requested. |
|
Back to top |
|
 |
|