R:包含所有记录中都不存在的XML元素


猫南北
2025-03-11 03:16:36 (22天前)
  1. GT;
  2. lt; Titlegt;美国医学信息学杂志


协会
</跨度>
:JAMIA&lt; / Title&gt;
&lt; ISOAbbreviation&gt; J Am Med Inform Assoc&lt; / ISOAbbreviation&gt;
&lt; /Journal 使用多种定量测量。&lt; / AbstractText&gt;
&lt; AbstractText Label =“MATERIALS AND METHODS”NlmCategory =“METHODS”&gt; The

分析
</跨度>
包括在registered注册的所有165?988项试验

2 条回复
  1. 0# 咿呀哟 | 2019-08-31 10-32



    评论太久了。 [如果人们认为这太难以回答(我倾向于认为它可能……),我会删除它。



    所以问题是一个错字(见评论)。这只是编程实践的一个注释。排除赋值语句(尽可能多),所以这个:




    1. ArticleTitle <- xpathSApply(myxml,”///MedlineCitation”,padXML,xstr=’./Article[1]/ArticleTitle[1]/text()’)
      DateCreated <- xpathSApply(myxml,”//
      /MedlineCitation”,padXML,xstr=’./DateCreated/Year/text()’)
      Keyword1 < - xpathSApply(myxml,”///MedlineCitation”,padXML,xstr=’./KeywordList[1]/Keyword[1]/text()’)
      Keyword2 < - xpathSApply(myxml,”//
      /MedlineCitation”,padXML,xstr=’./KeywordList[1]/Keyword[2]/text()’)
      Keyword3 < - xpathSApply(myxml,”//*/MedlineCitation”,padXML,xstr=’./KeywordList[1]/Keyword[3]/text()’)

    2. </code>


    而不是这个:




    1. ArticleTitle <- xpathSApply(myxml,”///MedlineCitation”,padXML,xstr=’./Article[1]/ArticleTitle[1]/text()’)
      DateCreated <- xpathSApply(myxml,”//
      /MedlineCitation”,padXML,xstr=’./DateCreated/Year/text()’)
      Keyword1 < - xpathSApply(myxml,”///MedlineCitation”,padXML,xstr=’./KeywordList[1]/Keyword[1]/text()’)
      Keyword2 < - xpathSApply(myxml,”//
      /MedlineCitation”,padXML,xstr=’./KeywordList[1]/Keyword[2]/text()’)
      Keyword3 < - xpathSApply(myxml,”//*/MedlineCitation”,padXML,xstr=’./KeywordList[1]/Keyword[3]/text()’)

    2. </code>


    使这种类型的错误真正流行。


登录 后才能参与评论