gpt4 book ai didi

sql - text/xmldecl 不在输入的开头

转载 作者:行者123 更新时间:2023-12-03 01:55:53 24 4
gpt4 key购买 nike

我试图在数据库中插入 xml 文件,但收到此错误 text/xmldecl not at the start of input。

这是查询:

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 声明

<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0"?>
<?xml version="1.0"?>

如果包含 XML 声明,则它必须位于 XML 文档中第一行的第一个位置

关于sql - text/xmldecl 不在输入的开头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16332464/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com