# Can REXML handle long XML

**URL:** <https://www.ruby-forum.com/t/can-rexml-handle-long-xml/77658>\
**Category:** Ruby\
**Created:** [March 7, 2006, 6:40am UTC](https://www.ruby-forum.com/t/can-rexml-handle-long-xml/77658 "2006-03-07T06:40:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lstrecv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e68b1a/32.png) [@lstrecv](https://www.ruby-forum.com/u/lstrecv)\
**Post date:** [March 7, 2006, 6:40am UTC](https://www.ruby-forum.com/t/can-rexml-handle-long-xml/77658/1 "2006-03-07T06:40:11Z")

</div>

I have a long chunk of XML - about 32k. REXML::Document.new(x) gives  
me an “”. Yet I double checked the xml in a validator (by  
File.write x into a file, and then loading it), and it validates fine.

Any ideas?

---

<div class="post-metadata">

**Author:** ![lstrecv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e68b1a/32.png) [@lstrecv](https://www.ruby-forum.com/u/lstrecv)\
**Post date:** [March 7, 2006, 7:04am UTC](https://www.ruby-forum.com/t/can-rexml-handle-long-xml/77658/2 "2006-03-07T07:04:22Z")

</div>

On Mar 7, 2006, at 6:38 AM, removed\_email\_address@domain.invalid wrote:

> I have a long chunk of XML - about 32k. REXML::Document.new(x) gives  
> me an “”. Yet I double checked the xml in a validator (by  
> File.write x into a file, and then loading it), and it validates fine.
> 
> Any ideas?

That’s just what a REXML::Document object returns when you call  
#inspect.

require ‘rexml/document’  
xml =\<\<EOS  
  
test  
blah  
  
EOS  
doc = REXML::Document.new(xml)  
p doc # -\> … \</\>  
puts doc # -\> the xml…  
puts REXML::XPath.match( doc, “//node/xml” ) # -\> test

– Daniel

---

<div class="post-metadata">

**Author:** ![lstrecv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e68b1a/32.png) [@lstrecv](https://www.ruby-forum.com/u/lstrecv)\
**Post date:** [March 7, 2006, 1:35pm UTC](https://www.ruby-forum.com/t/can-rexml-handle-long-xml/77658/3 "2006-03-07T13:35:31Z")

</div>

On 6 Mar 2006 21:34:09 -0800, removed\_email\_address@domain.invalid wrote:

> I have a long chunk of XML - about 32k. REXML::Document.new(x) gives  
> me an “”. Yet I double checked the xml in a validator (by  
> File.write x into a file, and then loading it), and it validates fine.
> 
> Any ideas?

Definitely not the length. I used REXML to load a 500K one-line (no  
CRs)  
MS Project export, with no problems.

Jay L.
