簡體   English   中英

XML解析:格式良好的檢查:未聲明的實體

[英]XML Parsing: well formed check: undeclared entity

我正在使用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”

我認為實體參考&nbsp; 在你的XML數據不好,因為系統找不到名為nbsp的實體。 這通常來自HTML,而不是裸XML。 因此,您必須在DTD中使用HTML DTD或手動定義該實體,就像在HTML中完成一樣,或者只是在對數據執行XML處理之前以文本方式過濾數據。

如果您使用DTD,您只需寫入:

<!ENTITY nbsp "&#160;">

如果您不使用它們,只需替換所有實體引用&nbsp; 按字符引用&#160;

XML只有五個字符實體引用: &lt; &gt; &apos; &quot; &amp; &lt; &gt; &apos; &quot; &amp; 你正在使用的那個, &nbsp; ,是一個HTML - 但不是XML - 字符實體引用。 你可以寫&#160; (十進制)或&#xA0; (十六進制),但。

:-)不用擔心..好的問題是(如下面Ikuty所指出的)XML不理解實體...命名實體就像嵌套替換(將它們視為C中的#defines)DTD(文檔類型)實際上會將命名實體映射到目標字符集中的特定字符......這樣,如果更改字符集,則可以更改DTD中的實體定義,並且文檔仍然可以。 所以.....nbsp映射到UTF-8中的非破壞空間字符#160 ...這里有一個很好的關於這個主題的入門: 讓NBSP與XML一起工作 ......你可以找到一步一步的XML W3School 教程 希望這有助於作為一個起點:-)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM