Link to home
Start Free TrialLog in
Avatar of enrique_aeo
enrique_aeo

asked on

XML: The XML parse error 0xc00ce505 occurred on line number 3, near the XML text "

i have this store procedure
create procedure usp_chk (@xmldoc nvarchar(100))
as

begin
      declare @hind int

      exec sp_xml_preparedocument @hind output, @xmldoc
      select *
      from openxml (@hind,'Root/Location/Item',2)
      with
            (
                  LocID int '../@LocID',
                  ItemID int,
                  ItemDesc varchar(50),
                  Qty int
            )
      exec sp_xml_removedocument @hind

end

when i test
--Testing
go
declare @xmldoc nvarchar(1000)
set @xmldoc = '<Root>
<Location LocationID="1" LocName="East Warehouse">
      <Item ItemID="22" ItemDesc="Keyboard" Qty="120">
      </Item>
      <Item ItemID="27" ItemDesc="Flat Screen" Qty="72">
      </Item>
</Location>
</Root>'

exec usp_chk  @xmldoc

i have this error
The XML parse error 0xc00ce505 occurred on line number 3, near the XML text "      <Item ItemID="22" ItemDesc="Keyboard" Q".
Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1
The error description is 'A name contained an invalid character.'.
Msg 8179, Level 16, State 5, Procedure usp_chk, Line 7
Could not find prepared statement with handle 0.
Msg 6607, Level 16, State 3, Procedure sp_xml_removedocument, Line 1
sp_xml_removedocument: The value supplied for parameter number 1 is invalid.

SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial