0

現在、フォームからデータを抽出する作業を行っています。rpm-typeと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()を使用していますが、nullを取得しています...ログから、属性とその値の多くを抽出できたことがわかりますが、childNodeの値を取得しようとすると、次のようになります。ヌル :

2012-06-12 14:17:49,028 [http-thread-pool-1234(2)] DEBUG [FormSrvcImpl:944]パス:[// form / / /rpm-type/。]2012-06-1214 : 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]

4

3 に答える 3

2

Javadocによると、getNodeValue()ある種のノードで呼び出された場合はnullを返します(前のリンクの先頭にある表を参照してください)。getTextContent()おそらく代わりに使用する必要があります。

于 2012-06-12T19:59:21.783 に答える
0

探している190の値を持つrpm-valueノードの代わりに、rpm-type(値がなく、子ノードのみ)でgetNodeValue()を使用しようとしているように見えます。

于 2012-06-12T16:12:54.973 に答える
0

何らかの理由で、node.getTextContent...に値が見つかりました。

于 2012-06-13T23:41:32.447 に答える