Re: [gdome]doctype.entities problem



On Wed, 14 Nov 2001, Uwe Fechner wrote:

> Hello,
>
> the method doctype.entites doesn't work for me:
>
> I wrote the following test-program:

I translated it to ruby:

require "gdome"
filename='../data/test-dtd.xml';
domimpl=Dom::implementation
doc=domimpl.validateFile(filename)
if doc
  puts('Parsed file ok!');
end
doctype=doc.doctype
if doctype
  puts('Found doctype!');
end
entities=(doctype.entities);
if entities
  puts('Found entities!');
end
puts("entities.length: #{entities.length}")


Output is as expected on both, linux and windows:
Parsed file ok!
Found doctype!
Found entities!
entities.length: 5

Then I noticed you used backslashes in filename. With backslashes, it
gives:
..\data\test-dtd.xml:2: error: failed to load external entity
"test-dtd.dtd"
<!DOCTYPE TEST-DTD SYSTEM "test-dtd.dtd">
                                        ^
..\data\test-dtd.xml:3: validity error: Validation failed: no DTD found !
<TEST-DTD>
         ^
..\data\test-dtd.xml:4: error: Entity 'FOO1' not defined
&FOO1;
     ^
Parsed file ok!
Found doctype!
Found entities!
entities.length: 0

Seems you discarded stderr, and that libxml does not handle backslashes in
filenames as windows users might expect.

On unix, file names may contain backslashes.

Bye, Tobias




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]