2

私は次のXMLを持っています:

<XMLResults><ConfMess><RCode>0</RCode><MId>0</MId></ConfMess><COURSE_DATA><THEHEADING>Review Engagements: Inquiry and Analytical Review Procedures and Reporting</THEHEADING><ABSTRACT><!--this file has been generated by v.3.2.1 8/9/2012 8:50:14 AM by JHancock (and called from 'A G&Q Database')--><html><head><title>Course Abstract</title><link rel='stylesheet' href='https://www.thelearningcenter.org/cserver/case1/css/theabstract.css' type='text/css'></head><body><div style='text-align: center;' class=h2banner>Course Abstract</div><div id="tableContainer" class="tableContainer"><table class="abstract"><tbody class="scrollContent"><tr class="abstract"><td class="abstractCaptions">Main Title</td><td class="abstract" id=courseAbstractTitle>Initial Review: Find Out About Additional Reporting Procedures</td></tr><tr class="abstract"><td class="abstractCaptions">Writer(s)</td><td class="abstract" id=authorsAbstract>Karl Booker<br>Harriet Johnson</td></tr><tr class="abstract"><td class="abstractCaptions">Current Field(s) of Study<sup>1</sup></td><td class="abstract" id=fosAbstract>4.0 study hours in 'History'</td></tr><tr class="abstract"><td class="abstractCaptions">Area Of Study</td><td class="abstract" id=courseLevelAbstract>Medium</td></tr><tr class="abstract"><td class="abstractCaptions">Value (30 min.sec.)<sup>1</sup></td><td class="abstract" id=creditHoursAbstract>3.5</td></tr><tr class="abstract"><td class="abstractCaptions">Must Haves</td><td class="abstract" id=prerequisitesAbstract>None</td></tr><tr class="abstract"><td class="abstractCaptions">Description</td><td class="abstract" id=descriptionAbstract>This topic revolves around discussing important topics in the history field and how they relate to our current situation.</td></tr><tr class="abstract"><td class="abstractCaptions">TheObjective</td><td class="abstract" id=objectivesAbstract><ul><li>Learn more about history and how our modern times have been shaped by it.<li>Plan for the future<li>Help mankind to learn from the past<li>Provide valuable input to others<li>Be greatful for what we have<li>Gain credit for all the hard work we put in<li>Pass this course and move on with our lives.<li>Get a good job and raise a family.<li>Get a vacation home and relax on the beach<li>Soak up the sun and get a tan</ul></td></tr><tr class="abstract" id=idExpirationRow><td class="abstractCaptions">Expires</td><td class="abstract" id=expirationAbstract>This topic is reviewed monthly for value and modified where needed.</td></tr><tr class="abstract"><td class="abstractCaptions">Item ID</td><td class="abstract" id=courseIDabstract>odt</td></tr></tbody></table></div><div id=footnote1ID class="sylFNote"><sup>1</sup>Consult your instructor for infornation on this particular topic</div><div id="idCopyright" class="copyright">© 2004 THIS SCHOOL BOARD</div></body></html></ABSTRACT></COURSE_DATA><STUDY_AREA><SUBJECT>AuditField</SUBJECT><NUMBER_HOURS>3.0</NUMBER_HOURS></FIELD_OF_STUDY></XMLResults>

<ABSTRACT>stuff</ABSTRACT>XMLのセクションにある「もの」を解析するルーチンが見つからないようです。特殊文字などのせいかもしれません。誰かがこれに取り組み、失敗しないルーチンを手伝ってくれますか?

4

2 に答える 2

2

これはXMLではありません。これは、山かっこが付いた一連のテキストです。

<ABSTRACT>要素内に問題があるだけでなく、もあります<STUDY_AREA></FIELD_OF_STUDY>

どのように回避しますか?あなたはそうしない。このゴミ箱を送った人は誰でも、有効なXMLを送ってもらうことができます。XMLエディターがあまりないわけではありません。そのようなツールを使用して、「XML」を作成および/または検証する必要があります。

于 2012-09-12T19:33:57.030 に答える
0

<!-- -->XMLのコメントが原因と思われます。それ自体は失敗ではありません。

Comments in XML

The syntax for writing comments in XML is similar to that of HTML.

<!-- This is a comment -->

ここに参照リンクがあります。

それをどのように回避するかは、使用しているライブラリによって異なります。一部のライブラリは、その要素の生のテキストの取得をサポートしている場合があります。コメント要素を返す場合もあります。

おそらく、のプレーンテキストをgrepするだけです<ABSTRACT>(.*)</ABSTRACT>。ドキュメントごとに複数のレコードがある場合は問題が発生する可能性があるため、最初に各ドキュメントに分離する必要があります。

于 2012-09-12T18:55:24.850 に答える