3
我想在數據庫中插入xml文件,但是我在輸入的開頭找不到這個錯誤文本/ xmldecl。text/xmldecl不在輸入的開頭
下面是該查詢:
INSERT [EMR].[tblTemplateForm]
(FormXML)
VALUES (CAST('<?xml version="1.0" encoding="UTF-8"?><EMR>
<CustomTextBox xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Text>0.0</Text>
<Type>TextBox</Type>
<Width>300</Width>
<id>txt1</id>
<Label>POG(LMP)</Label>
<LabelWidth>200</LabelWidth>
<labelFontStyle>normal</labelFontStyle>
<labelFontWeight>normal</labelFontWeight>
<labelFontColor>Black</labelFontColor>
<CaptionOrientation>Horizontal</CaptionOrientation>
<NewControl>false</NewControl>
<NumericText>0</NumericText>
<TextMode>Singleline</TextMode>
<rows>0</rows>
<columns>0</columns>
</CustomTextBox><?xml version="1.0"?>
<CustomNumericTextBox xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Type>NumericTxtBox</Type>
<Width>500</Width>
<id>numTxt1</id>
<Label>numTxt1</Label>
<LabelWidth>200</LabelWidth>
<labelFontStyle>normal</labelFontStyle>
<labelFontWeight>normal</labelFontWeight>
<labelFontColor>Black</labelFontColor>
<CaptionOrientation>Horizontal</CaptionOrientation>
<NewControl>false</NewControl>
<NumericText>3</NumericText>
</CustomNumericTextBox><?xml version="1.0"?>
<AllControlsCount xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Width>0</Width>
<id>ControlsID</id>
<LabelWidth>0</LabelWidth>
<NewControl>false</NewControl>
<NumericText>0</NumericText>
<lblCount>0</lblCount>
<txtCount>12</txtCount>
<numTxtCount>1</numTxtCount>
<ddlCount>0</ddlCount>
<rbCount>0</rbCount>
<cbCount>0</cbCount>
</AllControlsCount>
</EMR>' as XML))
GO
錯誤消息:
Msg 9438, Level 16, State 1, Line 1
XML parsing: line 19, character 24, text/xmldecl not at the beginning of input
表結構:
TABLE [EMR].[tblTemplateForm](
[FormID] [int] IDENTITY(1,1) NOT NULL,
[FormName] [varchar](100) NULL,
[FormDesc] [varchar](255) NULL,
[FormXML] [xml] NULL,
[Published] [bit] NULL,
[FormType] [int] NULL,
[CreatedID] [int] NULL,
[CreatedDate] [datetime] NULL,
[ModifiedID] [int] NULL,
[ModifiedDate] [datetime] NULL,
看起來像它說在第一位置,你的xml的第19行有一個xml開始標記。似乎你的XML解析器不喜歡這樣,所以我想你將需要去除額外的嵌入式XML打開和關閉標籤。 – 2013-05-02 07:28:45
@ Al。 :傻我!謝謝.. – Sharun 2013-05-02 08:55:52