May 22, 2003 at 8:23 am
Suggestions Please
I have an XML file defined as follows which fails to parse using OpenXMl.
<?xml version="1.0" standalone="yes"?>
<AMCData xmlns="http://tempuri.org/AMCData.xsd">
<cd_lpAMCData>
<ClaimRef>BAR1028828</ClaimRef>
<ClientName>Barlow Handling Ltd</ClientName>
<Cover>True</Cover>
<AccidentDate>2003-05-19T00:00:00.0000000+01:00</AccidentDate>
</cd_lpAMCData>
<cd_lpAMCData>
<ClaimRef>BAR1028828</ClaimRef>
<ClientName>Barlow Handling Ltd</ClientName>
<Cover>True</Cover>
<AccidentDate>2003-05-19T00:00:00.0000000+01:00</AccidentDate>
</cd_lpAMCData>
If I amend the file as follows :-
Remove xmlns="http://tempuri.org/AMCData.xsd">
Remove Last 10 digits 2003-05-19T00:00:00.000
It parses just fine. Can anyone explain why and how I can make my first file work?
<?xml version="1.0" standalone="yes"?>
<AMCData>
<cd_lpAMCData>
<ClaimRef>BAR1028828</ClaimRef>
<ClientName>Barlow Handling Ltd</ClientName>
<Cover>True</Cover>
<AccidentDate>2003-05-19T00:00:00.000</AccidentDate>
</cd_lpAMCData>
<cd_lpAMCData>
<ClaimRef>BAR1028828</ClaimRef>
<ClientName>Barlow Handling Ltd</ClientName>
<Cover>True</Cover>
<AccidentDate>2003-05-19T00:00:00.000</AccidentDate>
</cd_lpAMCData>
In my Stored Procedure I have the following commands:-
EXECUTE @ErrorsExist = sp_xml_preparedocument @iDoc OUTPUT, @XmlString
Select * FROM OPENXML(@iDoc, 'AMCData/cd_lpAMCData',2) With AmcClaimImport
EXECUTE @ErrorsExist = sp_xml_removedocument @iDoc
AmcClaimImport is a table in my Db with field names matching those in the XML File.
Thanks
Andy
May 26, 2003 at 8:00 am
This was removed by the editor as SPAM
June 6, 2003 at 9:16 am
I made two corrections to your xml fragment and was able to parse it.
1. the line you removed was not defined properly. the correct definition is
<AMCData xmlns:xsi="http://tempuri.org/AMCData.xsd">
2. The format of the date in your data is invalid. The correct SQL server format for dateitme is ">2003-05-19 00:00:00.000"
3. Lastly, <AMCData> was not closed , so I added </AMCData> at end .
Hope this will help.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply