草庐IT

sql - XML 解析 : well formed check: undeclared entity

coder 2024-06-25 原文

我正在使用 SSMS 2008,但出现以下错误。你知道这意味着什么吗?

Msg 9448, Level 16, State 1, Line 4
XML parsing: line 1, character 89, well formed check: undeclared entity

这是导致这个错误的代码:

DECLARE @t TABLE (j VARCHAR(MAX))
insert into @t
SELECT 
z.MyXml.value('.','NVARCHAR(MAX)') value
FROM  [evolv_cs].[dbo].[progress_note] 
CROSS APPLY (SELECT CAST([progress_note].[note_text] AS XML) [MyXml]) z

我也试过这个查询,但结果相同:

SELECT 
z.MyXml.value('.','NVARCHAR(MAX)') value
INTO #TEMP_PN
FROM  [evolv_cs].[dbo].[progress_note] 
CROSS APPLY (SELECT CAST([progress_note].[note_text] AS XML) [MyXml]) z

这是应用此 XML 语句之前的一些示例数据:

<DIV class=gc-message-sms-row><SPAN class=gc-message-sms-from>TLS: </SPAN><SPAN class=gc-message-sms-text>Hi Reggie... I'm on my way to Lynn.. see you soon</SPAN> <SPAN class=gc-message-sms-time>3:09 PM </SPAN></DIV>
<P>List the intervention targeted from the Intermediary Goal: </P> <P>1. To review on call procedure with family.</P> <P>Interventions attempted during the session to target PCP goal(s):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P> <P><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Counselor attempted to call mother; however received an automated message stating this number is temporarily out of service.</SPAN>&nbsp;&nbsp; </P> <P>Effectiveness of Intervention: </P> <P>Not applicable as family was not available for session.</P> <P>Describe safety plan/PCP crisis plan review (reminder - any modification requires new signatures and safety plans need to be reviewed at a minimum monthly)</P> <P>Not applicable as family was not available for session.</P> <P>Therapeutic Homework Assignment (assignment should relate to intervention and be agreed upon by counselor and family):</P> <P>Not applicable as family was not available for session.</P>
This specialist spoke with Kayla in an attempt to schedule a session for this week.&nbsp; Kayla agreed to meet with this specialist on Friday at 10:30am.&nbsp; This specialist asked Kayla about the upcoming meeting with DCF and Kayla stated that it is about her coming transition, but did not want to discuss it further.&nbsp; Kayla asked if this specialist would meet with her on Monday as well, to take her downtown to go to a meeting at a modeling agency.&nbsp; This specialist stated that this specialist could meet with Kayla prior to that appointment, and then drop Kaya off at the appointment.&nbsp;
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt">Purpose of Contact:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></B></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt">To coordinate with Structured Day Program Director and notify her that faxed has been sent to refer client to program for summer.<B><o:p></o:p></B></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt"><o:p>&nbsp;</o:p></SPAN></B></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt">Description of Contact:<o:p></o:p></SPAN></B></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt"><o:p>&nbsp;</o:p></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt">Counselor spoke with program director to verify she received referral form for client.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Director confirmed that she received clients referral form but reported that due to the waiting list being so long that client would more than likely not be able to attend program for the summer, but would keep client on waiting list and notify counselor if a slot becomes available.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><B><o:p></o:p></B></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt"><o:p>&nbsp;</o:p></SPAN></B></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><B><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt">Relationship between contact description and treatment goals:<o:p></o:p></SPAN></B></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt">An increase in communication between counselor and director will lead to a collaborative treatment approach and improvement in client's referral behaviors. </SPAN><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="BACKGROUND: white"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">List the intervention targeted from the Intermediary Goal: The mother will assess what is working well in her home to assist the client with decreasing her referral behaviors.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P> <P style="BACKGROUND: white"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">Interventions attempted during the session to target PCP goal(s):&nbsp;&nbsp;The counselor met with the&nbsp;mother and the client in the home for a face to face session. The counselor noted that the client and the mother were working together to complete household chores. The counselor asked the family to assess if the time frames to complete the chores id effective for the family. The mother and the client reported that the time&nbsp;frames to complete chores are effective. The counselor asked the mother to identify&nbsp;what is effective to assist the client with maintaining her decreased negative behaviors. The mother reported that by educating the client on her expectations and allowing her to make the choice to comply is effective. The counselor and family role played communicating the expectations. The counselor noted that the mother will give the client a directive and allow her a time frame to complete the directive. The client stated that now that her mother leaves her alone once she tells her what to do allow her time to process what her mother wants her to do. The client reported that she does not get upset anymore because she can complete the task&nbsp;within the time frame.<o:p></o:p></SPAN></P> <P style="BACKGROUND: white"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">The counselor and family reviewed personal safety and the court recommendations for the client's protective supervision. The client stated that she is&nbsp;aligned with the&nbsp;following through with the recommendations even while she is on her missions' trip.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></SPAN></P> <P style="BACKGROUND: white"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">Effectiveness of Intervention: The intervention appeared to be effective as evidenced by the family's willingness to identify barriers that may prevent them from follow through with identified contingences in the home.<o:p></o:p></SPAN></P> <P style="BACKGROUND: white"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">Describe safety plan/PCP crisis plan review (reminder - any modification requires new signatures and safety plans need to be reviewed at a minimum monthly) The&nbsp;family and counselor reviewed to client's safety plan. No barriers or breakdowns were identified at this time.&nbsp;<o:p></o:p></SPAN></P> <P style="BACKGROUND: white"><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">Therapeutic Homework Assignment (assignment should relate to intervention and be agreed upon by counselor and family): The mother was asked to review the safety plan with identified supports. The client as asked to follow through with obtaining contact numbers for her new peers from church.<o:p></o:p></SPAN></P> <P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>

我完成了 Ahmed 引用的教程,但我还没有找到如何将 HTML DTD 合并到我的 SQL 代码中。当然,我知道这在 HTML 文件中是如何工作的。

因此,我尝试通过 TSQL 将所有出现的“”替换为“”,但这给了我一个不同的错误:“XML 解析:第 2 行,字符 127,应为字符串文字”。不过,我仍然更愿意使用 HTML DTD。我如何使用上面的 tsql 代码做到这一点?

第 2 行指的是什么?如果它指的是这个示例代码,那么它对我来说没有意义。替换上面示例数据中的所有实例后,我查看了与此示例数据的第 2 行相同的第 2 行。字符 127 = "v"来自 "interventions"

最佳答案

我认为您的 XML 数据中的实体引用   不正确,因为系统找不到名为 nbsp 的实体。这通常来自 HTML,而不是纯 XML。因此你必须使用 HTML DTDs在您的 DTD 中或像在 HTML 中那样手动定义该实体,或者在对其进行 XML 处理之前简单地以文本方式过滤数据。

如果你使用 DTD,你可以简单地写在里面:

<!ENTITY nbsp "&#160;">

如果不使用它们,只需将所有实体引用   替换为字符引用  

关于sql - XML 解析 : well formed check: undeclared entity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7903920/

有关sql - XML 解析 : well formed check: undeclared entity的更多相关文章

  1. Ruby 解析字符串 - 2

    我有一个字符串input="maybe(thisis|thatwas)some((nice|ugly)(day|night)|(strange(weather|time)))"Ruby中解析该字符串的最佳方法是什么?我的意思是脚本应该能够像这样构建句子:maybethisissomeuglynightmaybethatwassomenicenightmaybethiswassomestrangetime等等,你明白了......我应该一个字符一个字符地读取字符串并构建一个带有堆栈的状态机来存储括号值以供以后计算,还是有更好的方法?也许为此目的准备了一个开箱即用的库?

  2. ruby - 解析 RDFa、微数据等的最佳方式是什么,使用统一的模式/词汇(例如 schema.org)存储和显示信息 - 2

    我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i

  3. ruby - 用逗号、双引号和编码解析 csv - 2

    我正在使用ruby​​1.9解析以下带有MacRoman字符的csv文件#encoding:ISO-8859-1#csv_parse.csvName,main-dialogue"Marceu","Giveittohimóhe,hiswife."我做了以下解析。require'csv'input_string=File.read("../csv_parse.rb").force_encoding("ISO-8859-1").encode("UTF-8")#=>"Name,main-dialogue\r\n\"Marceu\",\"Giveittohim\x97he,hiswife.\"\

  4. ruby-on-rails - 如何从 format.xml 中删除 <hash></hash> - 2

    我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为

  5. ruby-on-rails - 我更新了 ruby​​ gems,现在到处都收到解析树错误和弃用警告! - 2

    简而言之错误:NOTE:Gem::SourceIndex#add_specisdeprecated,useSpecification.add_spec.Itwillberemovedonorafter2011-11-01.Gem::SourceIndex#add_speccalledfrom/opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91./opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:275:in`==':und

  6. Hive SQL 五大经典面试题 - 2

    目录第1题连续问题分析:解法:第2题分组问题分析:解法:第3题间隔连续问题分析:解法:第4题打折日期交叉问题分析:解法:第5题同时在线问题分析:解法:第1题连续问题如下数据为蚂蚁森林中用户领取的减少碳排放量iddtlowcarbon10012021-12-1212310022021-12-124510012021-12-134310012021-12-134510012021-12-132310022021-12-144510012021-12-1423010022021-12-154510012021-12-1523.......找出连续3天及以上减少碳排放量在100以上的用户分析:遇到这类

  7. sql - 查询忽略时间戳日期的时间范围 - 2

    我正在尝试查询我的Rails数据库(Postgres)中的购买表,我想查询时间范围。例如,我想知道在所有日期的下午2点到3点之间进行了多少次购买。此表中有一个created_at列,但我不知道如何在不搜索特定日期的情况下完成此操作。我试过:Purchases.where("created_atBETWEEN?and?",Time.now-1.hour,Time.now)但这最终只会搜索今天与那些时间的日期。 最佳答案 您需要使用PostgreSQL'sdate_part/extractfunction从created_at中提取小时

  8. ruby - 用 YAML.load 解析 json 安全吗? - 2

    我正在使用ruby2.1.0我有一个json文件。例如:test.json{"item":[{"apple":1},{"banana":2}]}用YAML.load加载这个文件安全吗?YAML.load(File.read('test.json'))我正在尝试加载一个json或yaml格式的文件。 最佳答案 YAML可以加载JSONYAML.load('{"something":"test","other":4}')=>{"something"=>"test","other"=>4}JSON将无法加载YAML。JSON.load("

  9. ruby - 如何使用 Nokogiri 解析纯 HTML 表格? - 2

    我想用Nokogiri解析HTML页面。页面的一部分有一个表,它没有使用任何特定的ID。是否可以提取如下内容:Today,3,455,34Today,1,1300,3664Today,10,100000,3444,Yesterday,3454,5656,3Yesterday,3545,1000,10Yesterday,3411,36223,15来自这个HTML:TodayYesterdayQntySizeLengthLengthSizeQnty345534345456563113003664354510001010100000344434113622315

  10. python - 帮我找到合适的 ruby​​/python 解析器生成器 - 2

    我使用的第一个解析器生成器是Parse::RecDescent,它的指南/教程很棒,但它最有用的功能是它的调试工具,特别是tracing功能(通过将$RD_TRACE设置为1来激活)。我正在寻找可以帮助您调试其规则的解析器生成器。问题是,它必须用python或ruby​​编写,并且具有详细模式/跟踪模式或非常有用的调试技术。有人知道这样的解析器生成器吗?编辑:当我说调试时,我并不是指调试python或ruby​​。我指的是调试解析器生成器,查看它在每一步都在做什么,查看它正在读取的每个字符,它试图匹配的规则。希望你明白这一点。赏金编辑:要赢得赏金,请展示一个解析器生成器框架,并说明它的

随机推荐