Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
SQL
ce
clients
clustering
connect
datamining
datawarehouse
dts
fulltext
jdbcdriver
msde
mseq
newusers
notificationsvcs
odbc
olap
programming
replication
reportingsvcs
security
securitytools
server
setup
sqlxml.viewmapper
tools
xml
  
 
date: Mon, 16 Jun 2008 12:59:04 -0700 (PDT),    group: microsoft.public.sqlserver.xml        back       


FOR XML PATH node element containing "<" character   
I want my result set to include the "<" character within the node
element name however the sql compiler is returning an invalid
character err. msg. ("..contains an invalid XML identifier as required
by FOR XML; '''(0x0027) is the first character at fault.").  I've
tried to use the "<" however that's not working either.

Thanks for any suggestions.

Below is a sample of the query:

Select
         age,
         Male<250,
         Male<250
FROM #tmp
FOR XML Path('Test')
date: Mon, 16 Jun 2008 12:59:04 -0700 (PDT)   author:   unknown

Re: FOR XML PATH node element containing "<" character   
AFAIK that's not allowed by the XML Recommendation.  Characters like that 
are usually created using some special encoding like this:

Male_x0027_250

Although that sort of defeats the purpose of what it appears you're trying 
to do here.  You might consider something like this:

Male_lt_250
Male_less_than_250

Or something similar to indicate what you're trying to express.


-- 

========
Michael Coles
"Pro SQL Server 2008 XML"
http://www.amazon.com/Pro-SQL-Server-2008-XML/dp/1590599837/


 wrote in message 
news:bab11ca4-c67b-470e-8ec8-bb3dddcb5931@d1g2000hsg.googlegroups.com...
>I want my result set to include the "<" character within the node
> element name however the sql compiler is returning an invalid
> character err. msg. ("..contains an invalid XML identifier as required
> by FOR XML; '''(0x0027) is the first character at fault.").  I've
> tried to use the "<" however that's not working either.
>
> Thanks for any suggestions.
>
> Below is a sample of the query:
>
> Select
>         age,
>         Male<250,
>         Male<250
> FROM #tmp
> FOR XML Path('Test')
date: Mon, 16 Jun 2008 21:42:06 -0400   author:   Michael Coles michaelcoREPLACE_THIS_WITH_AT_SIGNoptonline.net

Re: FOR XML PATH node element containing "<" character   
Oops, "Characters like that are usually *encoded*" in element names...

-- 

========
Michael Coles
"Pro SQL Server 2008 XML"
http://www.amazon.com/Pro-SQL-Server-2008-XML/dp/1590599837/


"Michael Coles" <michaelcoREPLACE_THIS_WITH_AT_SIGNoptonline.net> wrote in 
message news:ueLAbtB0IHA.4476@TK2MSFTNGP06.phx.gbl...
> AFAIK that's not allowed by the XML Recommendation.  Characters like that 
> are usually created using some special encoding like this:
>
> Male_x0027_250
>
> Although that sort of defeats the purpose of what it appears you're trying 
> to do here.  You might consider something like this:
>
> Male_lt_250
> Male_less_than_250
>
> Or something similar to indicate what you're trying to express.
>
>
> -- 
>
> ========
> Michael Coles
> "Pro SQL Server 2008 XML"
> http://www.amazon.com/Pro-SQL-Server-2008-XML/dp/1590599837/
>
>
>  wrote in message 
> news:bab11ca4-c67b-470e-8ec8-bb3dddcb5931@d1g2000hsg.googlegroups.com...
>>I want my result set to include the "<" character within the node
>> element name however the sql compiler is returning an invalid
>> character err. msg. ("..contains an invalid XML identifier as required
>> by FOR XML; '''(0x0027) is the first character at fault.").  I've
>> tried to use the "<" however that's not working either.
>>
>> Thanks for any suggestions.
>>
>> Below is a sample of the query:
>>
>> Select
>>         age,
>>         Male<250,
>>         Male<250
>> FROM #tmp
>> FOR XML Path('Test')
>
>
date: Mon, 16 Jun 2008 21:44:16 -0400   author:   Michael Coles michaelcoREPLACE_THIS_WITH_AT_SIGNoptonline.net

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us