Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
lotek
Starting Member
42 Posts |
Posted - 2006-03-07 : 05:04:35
|
| Im parsing some xml that has an encoded #62; (& # 6 2 ;) character and sql chokes with a "XML parsing error: A name contained an invalid character." Anything i can do about this?ThanksMatt |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2006-03-07 : 11:43:25
|
quote: Originally posted by lotek Im parsing some xml that has an encoded #62; (& # 6 2 ;) character and sql chokes with a "XML parsing error: A name contained an invalid character." Anything i can do about this?
Where is this greater-than character? If the error message is anything to go by, it sounds like it's in an element or attribute name, which isn't allowed. |
 |
|
|
lotek
Starting Member
42 Posts |
Posted - 2006-03-07 : 12:16:46
|
| It looks like this:<tag1>#62;</tag1> (there is an appersand before the pound...)When i take it out everything is fine... Leave it in and i get the error message... |
 |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2006-03-07 : 14:44:46
|
| Hmm, I think something must be unescaping the character reference back into an actual greater-than before it's getting to the XML parser... which would be strange.We probably need a little more information about where the XML is that you're parsing, what you're parsing it with and how it's getting passed into the parser.It shouldn't make a difference, but does it still happens if you use the XML predefined entity & g t ; instead of a numeric character reference? |
 |
|
|
lotek
Starting Member
42 Posts |
Posted - 2006-03-07 : 15:31:12
|
| I think your post led me to the problem...there is a single quote lurking in the xml that is causing the problem. I was using the following trick to get rid of the single and double quotes:REPLACE(REPLACE(SUBSTRING( xml_response, ( 0*8000 ) + 1, 8000 ), '"', ''), '''', '''''')Which didn't work...so i just removed the quotes all together:REPLACE(REPLACE(SUBSTRING( xml_response, ( 0*8000 ) + 1, 8000 ), '"', ''), '''', '')Is there a better way than this to deal with quotes?Thanks! |
 |
|
|
|
|
|
|
|