0
XPathNodeIterator nodes = nav.Select("//d:page/d:field/d:value", nsmgr);

...do stuff..

nodes.MoveNext();
nodes.Current.SetValue(i.ToString()); //<-HERE!
nodes.MoveNext();
nodes.Current.SetValue(numPages.ToString());

..do more stuff...

私はnodes.Current.SetValue()このプログラムで関数を何度も使用していますが、機能したくないのはこの 1 つのインスタンス (このノードのたびに) だけです。ブレークポイントを使用すると、そのノードの innerXML がi想定どおりに反映されることが示されます。その後、印刷してもうまくいきません。ナビストリームを保存する前に、特にそのノードを再選択しましたが、まだ何もありません。(実際には、何もないわけではありませ。スペースか、場合によっては改行のようです。この場合、なぜ機能しないのかわかりません。以下は、これら 2 つのノードに関連する XML です。

<field sid="PAGE">
      <itemlocation>
        <ae>
          <ae>absolute</ae>
          <ae>1051</ae>
          <ae>899</ae>
        </ae>
        <ae>
          <ae>extent</ae>
          <ae>47</ae>
          <ae>24</ae>
        </ae>
      </itemlocation>
      <value>
      </value>
      <borderwidth>0</borderwidth>
      <fontinfo>
        <ae>Times New Roman</ae>
        <ae>10</ae>
        <ae>plain</ae>
      </fontinfo>
      <justify>center</justify>
      <scrollhoriz>wordwrap</scrollhoriz>
      <scrollvert>fixed</scrollvert>
      <format>
        <ae>string</ae>
        <ae>optional</ae>
      </format>
      <next>OFPG</next>
      <previous>QTYFA_15</previous>
      <acclabel>asterisk.  when used as a.
hand receipt, enter hand receipt annex number.
hand receipt for quarters furniture, enter condition codes.
hand receipt annex or components receipt, enter accounting requirements code, ay r c.
enter page number.</acclabel>
    </field>
    <field sid="OFPG">
      <itemlocation>
        <ae>
          <ae>absolute</ae>
          <ae>1129</ae>
          <ae>899</ae>
        </ae>
        <ae>
          <ae>extent</ae>
          <ae>35</ae>
          <ae>24</ae>
        </ae>
      </itemlocation>
      <value>4</value>
      <borderwidth>0</borderwidth>
      <fontinfo>
        <ae>Times New Roman</ae>
        <ae>10</ae>
        <ae>plain</ae>
      </fontinfo>
      <justify>center</justify>
      <scrollhoriz>wordwrap</scrollhoriz>
      <scrollvert>fixed</scrollvert>
      <format>
        <ae>string</ae>
        <ae>optional</ae>
      </format>
      <previous>PAGE</previous>
      <next>NEXT_BUTTON</next>
      <acclabel>enter total number of pages.</acclabel>
    </field>

なぜこれが機能しないのかとても混乱しています...誰かアイデアはありますか?

編集: 詳細: 空白を保持するように XMLDocument を変更しました。これにより、スペースや改行の出力が修正されたようですが、値はまだ失われています。

4

1 に答える 1

0

投稿した両方のノードで機能していませんか、それとも 1 つだけですか? (もしそうなら、それはどちらのために働いていて、どれのために働いていないのですか?)

于 2011-04-19T17:55:47.620 に答える