Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Unless you have a huge XML document consider instead something like this:</p> <pre class="lang-ruby prettyprint-override"><code>require "xml" doc = XML::Document.file('infile1.xml') doc.find('/SECTION').each do |s| puts "[#{s}]" end </code></pre> <p>This outputs:</p> <pre class="lang-xml prettyprint-override"><code>&lt;SECTION&gt; &lt;SECTNO&gt;§ 0.735-1&lt;/SECTNO&gt; &lt;SUBJECT&gt;Agency ethics officials.&lt;/SUBJECT&gt; &lt;P&gt;(a) &lt;E T="03"&gt;Designated Agency Ethics Official (DAEO).&lt;/E&gt; The Assistant General Counsel (023) is the designated agency ethics official (DAEO) for the Department of Veterans Affairs. The Deputy Assistant General Counsel (023C) is the alternate DAEO, who is designated to act in the DAEO's absence. The DAEO has primary responsibility for the administration, coordination, and management of the VA ethics program, pursuant to 5 CFR 2638.201-204.&lt;/P&gt; &lt;P&gt;(b) &lt;E T="03"&gt;Deputy ethics officials.&lt;/E&gt; (1) The Regional Counsel are deputy ethics officials. They have been delegated the authority to act for the DAEO within their jurisdiction, under the DAEO's supervision, pursuant to 5 CFR 2638.204.&lt;/P&gt; &lt;P&gt;(2) The alternate DAEO, the DAEO's staff, and staff in the Offices of Regional Counsel, may also act as deputy ethics officials pursuant to delegations of one or more of the DAEO's duties from the DAEO or the Regional Counsel.&lt;/P&gt; &lt;CITA&gt;[58 FR 61813, Nov. 23, 1993. Redesignated at 61 FR 11309, Mar. 20, 1996]&lt;/CITA&gt; &lt;/SECTION&gt; </code></pre> <p>This doesn't answer the question, instead it's a workaround.</p> <p>I'm not sure what the actual issue with using a reader is, but I suspect it has something to do with it being cursor-ish. For example, the following works, delta there's still an additional empty section for the first XML document:</p> <pre class="lang-ruby prettyprint-override"><code>if node.name == "SECTION" puts "#{reader.read_outer_xml}" end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload