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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 XML query error

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2011-05-10 : 01:01:34
Hi all,

I am having issue with below query pls help me correct this one as i am new to XML.

set @profAttendees = ''
set @contactAttendees = ''

if (isnull(@Prof_Attendees_IDs,'')<>'') begin
set @Prof_Attendees_IDs = @Prof_Attendees_IDs +','
set @profAttendees = replace('<attendees_hcp><hcp_id>'+replace(@Prof_Attendees_IDs, ',','</hcp_id><interaction_attendee_type_ids><interaction_attendee_type_id>1</interaction_attendee_type_id></interaction_attendee_type_ids></attendees_hcp><attendees_hcp
><hcp_id>')+'endofThis','<attendees_hcp><hcp_id>endofThis','')
end
if (isnull(@LitDrop_Attendees_IDs,'')<>'') begin
set @LitDrop_Attendees_IDs = @LitDrop_Attendees_IDs +','
set @contactAttendees = replace('<attendees_hcp><hcp_id>'+replace(@LitDrop_Attendees_IDs, ',','</hcp_id><interaction_attendee_type_ids><interaction_attendee_type_id>2</interaction_attendee_type_id></interaction_attendee_type_ids></attendees_hcp><attende
es_hcp><hcp_id>')+'endofThis','<attendees_hcp><hcp_id>endofThis','')
end

if (isnull(@Prof_Attendees_IDs,'')<>'' or isnull(@LitDrop_Attendees_IDs,'')<>'') begin
set @interaction_attendee_hcps = '<?xml version="1.0"?><root>'+@profAttendees+@contactAttendees+'</root>'
end


Eror: Msg 9436, Level 16, State 1, Procedure web_SaveAssessment_new, Line 78
XML parsing: line 3, character 1095, end tag does not match start tag


pls help

Thanks,
Gangadhara MS
SQL Developer and DBA

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-05-10 : 07:31:09
The error message is saying that the opening tags and closing tags do not match. Two important rules for valid XML are the following:

1. Every opening tag must be self closing or must have a corresponding closing tag. For example:

<!-- This is an (empty) self-closing node -->
<Book />

<!-- This is a valide XML node -->
<Book>A Tail of Two Cities</Book>

The second rule is that nodes cannot straddle each other, they should be nested. For example, this is not valid XML.

<Book><Author>Charles Dickens</Book></Author>


Check your code to see if you are violating either of these conditions. I tried to copy and paste your code - but you have many variables defined which I don't have, so I am not able to parse it.
Go to Top of Page
   

- Advertisement -