Monday, March 12, 2012

illegal xml character

I got this from the w3:
[2a] RestrictedChar ::= [#x1-#x8] | [#xB-#xC] |
[#xE-#x1F] | [#x7F-#x84] | [#x86-#x9F]
http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-Char
I'm not much of a hex guy, is there anyway in SQL to
figure out which characters there are, basically someway I
can create a script that will parse out the bad characters?
Regards,
Bryan

>--Original Message--
>Alternatively what I want to do is just select out the
>records I do need and cast them as xml. Do I still have
>the same operators I would if I had a native XML
datatype.
>For instance:
>select top 10
> cast(bidData as xml) as bidData.query
>(X_NBTA05/PB/PROPCODE)
>from
> tblBidData bid
>inner join
> tblRFPProgram rfp
>on
> rfp.ProgName = bid.CorpRFPNumber
>where
> ProgTypeID = 2
>
>I get:
>Msg 102, Level 15, State 1, Line 5
>Incorrect syntax near '.'.
>
character
>.
>You means something like:
declare @.x nvarchar(50)
set @.x = CAST (0x3000310032004000070020003000 as nvarchar(50))
WHILE LEN(@.x) > 0 AND NOT(SUBSTRING(@.x, 1, 1) > CAST(0x0100 as nvarchar(1))
AND SUBSTRING(@.x, 1, 1) < CAST(0x0800 as nvarchar(1))
OR SUBSTRING(@.x, 1, 1) = CAST(0x0B00 as nvarchar(1))
OR SUBSTRING(@.x, 1, 1) = CAST(0x0C00 as nvarchar(1)))
BEGIN
SELECT @.x = SUBSTRING(@.x,2,LEN(@.x))
SELECT @.x
END
IF LEN(@.x) > 0 SELECT 'Error'
?
HTH
Michael
<anonymous@.discussions.microsoft.com> wrote in message
news:0cf801c4ed45$7623f1d0$a501280a@.phx.gbl...
>I got this from the w3:
> [2a] RestrictedChar ::= [#x1-#x8] | [#xB-#xC] |
> [#xE-#x1F] | [#x7F-#x84] | [#x86-#x9F]
> http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-Char
> I'm not much of a hex guy, is there anyway in SQL to
> figure out which characters there are, basically someway I
> can create a script that will parse out the bad characters?
> Regards,
> Bryan
>
> datatype.
> character|||Michael,
You never seize to amaze me. Thank you.
Bryan
>--Original Message--
>You means something like:
>declare @.x nvarchar(50)
>set @.x = CAST (0x3000310032004000070020003000 as nvarchar
(50))
>WHILE LEN(@.x) > 0 AND NOT(SUBSTRING(@.x, 1, 1) > CAST
(0x0100 as nvarchar(1))
>AND SUBSTRING(@.x, 1, 1) < CAST(0x0800 as nvarchar(1))
>OR SUBSTRING(@.x, 1, 1) = CAST(0x0B00 as nvarchar(1))
>OR SUBSTRING(@.x, 1, 1) = CAST(0x0C00 as nvarchar(1)))
>BEGIN
>SELECT @.x = SUBSTRING(@.x,2,LEN(@.x))
>SELECT @.x
>END
>IF LEN(@.x) > 0 SELECT 'Error'
>
>?
>
>HTH
>Michael
><anonymous@.discussions.microsoft.com> wrote in message
>news:0cf801c4ed45$7623f1d0$a501280a@.phx.gbl...
someway I
characters?
what
>
>.
>

No comments:

Post a Comment