0

我目前正在从表单中提取数据。我能够提取 rpm 类型和属性,如 ccoid_key、c​​coid_version,但我无法提取“190”。我正在使用以下语法“//form/// rpm -type/。” 并在http://www.xpathtester.com/test上对其进行了测试,这似乎返回了我想要的...

<form xmlns:ev="http://www.w3.org/2001/xml-events"     xmlns:exforms="http://www.exforms.org/exf/1-0" xmlns:fr="http://orbeon.org/oxf/xml/form-    runner" xmlns:ns2="http://db.rpm" xmlns:ns3="http://wscommon.rpm"    xmlns:ns4="http://form.rpm" xmlns:ns5="http://form.rpm" xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" xmlns:saxon="http://saxon.sf.net/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<section-data>
<date>2012-06-12Z</date>
<author-name>admin admin</author-name>
<note>note</note>
</section-data>
<section-2>
<control-4>
<rpm-type ccoid_key="K000001" ccoid_version="1" type="rpm-weight">
   <rpm-value ccoid_key="K000002" type="rpm-weight-kg">190</rpm-value>
</rpm-type> 
</control-4>
<control-5>
<rpm-type ccoid_key="K000001" ccoid_version="1" type="rpm-weight">
    <rpm-value ccoid_key="K000002" type="rpm-weight-lbs">222</rpm-value>
    <rpm-value ccoid_key="K000003" type="rpm-weight-oz">21</rpm-value>
</rpm-type>
</control-5>
</section-2>
</form>

我正在使用 node.getNodeValue() 但我得到一个空值......从日志中,我可以看到我能够提取许多属性及其值,但是当试图获取 childNode 的值时,我得到了无效的 :

2012-06-12 14:17:49,028 [http-thread-pool-1234(2)] 调试 [FormSrvcImpl:944] 路径:[//form/ / /rpm-type/.] 2012-06-12 14: 17:49,039 [http-thread-pool-1234(2)] 调试 [FormSrvcImpl:1007] 找到节点值:null 2012-06-12 14:17:49,040 [http-thread-pool-1234(2)] 调试 [FormSrvcImpl:1054] 要添加的临床单元:ClinicalUnit [idCcUnit=, idCc=0, ccoidUnitKey=K000002, ccoidUnitVersion=0] 2012-06-12 14:17:49,041 [http-thread-pool-1234(2)] 调试 [FormSrvcImpl:1055] 要添加的临床类型:ClinicalType [idCcClinicalType=, idCc=0, ccoidClinicalTypeKey=rpm-weight, ccoidClinicalTypeVersion= 1,valueType=null,units=null] 2012-06-12 14:17:49,041 [http-thread-pool-1234(2)] 调试 [FormSrvcImpl:1056] 要添加的临床值:ClinicalValue [id_clinical_value=0,clinicalType =ClinicalType [idCcClinicalType=,idCc=0,ccoidClinicalTypeKey=rpm-weight,ccoidClinicalTypeVersion=1,valueType=null,units=null],clinicalValue=null,valueDate=null,status=ACTIVE,sourceType=ORBEON_FORM,idSource=18585,idPatient =219,临床单位=空]

4

3 回答 3

2

根据 Javadoc,getNodeValue()如果在某种节点上调用,则返回 null(请参阅上一个链接开头的表格)。您可能应该getTextContent()改用。

于 2012-06-12T19:59:21.783 回答
0

在我看来,好像您正在尝试在 rpm 类型(没有值,只有一个子节点)上使用 getNodeValue() 而不是您正在寻找的具有 190 值的 rpm-value 节点。

于 2012-06-12T16:12:54.973 回答
0

出于某种原因,我在 node.getTextContent 中找到了值...

于 2012-06-13T23:41:32.447 回答