我目前正致力于从表单中提取数据。我能够提取rpm类型和属性,如ccoid_key,ccoid_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()但我得到一个null ... 从日志中,我可以看到我能够提取许多属性及其值, 但是当试图获取childNode的值时,我得到null:
2012-06-12 14:17:49,028 [http-thread-pool-1234(2)] DEBUG [FormSrvcImpl:944]路径:[// form / / / rpm-type /。] 2012-06-12 14:17:49,039 [http-thread-pool-1234(2)] DEBUG [FormSrvcImpl:1007]节点值找到:null 2012-06-12 14:17:49,040 [http-thread-pool-1234(2)] DEBUG [FormSrvcImpl:1054]临床单位添加:ClinicalUnit [idCcUnit =,idCc = 0,ccoidUnitKey = K000002,ccoidUnitVersion = 0] 2012-06-12 14:17:49,041 [http-thread-pool-1234(2)] DEBUG [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)] DEBUG [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,clinicalUnit = null]
答案 0 :(得分:2)
根据Javadoc getNodeValue()
返回null,如果它在某种节点上调用(参见上一个链接开头的表)。您应该使用getTextContent()
代替。
答案 1 :(得分:0)
我看起来好像你试图在rpm-type(没有值,只有一个子节点)上使用getNodeValue()而不是你正在寻找的具有190值的rpm-value节点。
答案 2 :(得分:0)
出于某种原因,我在node.getTextContent ...
中找到了值