Posted on 2006-07-25 18:20:30-07 by dab
cannot open 'styles' member
opening a document with
my $doc = ooDocument ( file => $filename );
I get no error, but I find that all named styles are invisible (methods like getNamedStyleRoot() simply return no result at all). After much debugging, it occurred to me that the 'styles' member is not visible. Attempting to explicitly open
my $styledoc = ooDocument(file => $filename, member => 'styles');
the script dies, saying
Can't call method "att" on an undefined value at /Library/Perl/5.8.1/OpenOffice/OODoc/XPath.pm line + 295.
What may be the meaning of this? Is it a bug in XPath.pm?
-- dab
Direct Responses: 2701 | 2724 | Write a response
Posted on 2006-07-25 18:46:48-07 by dab in response to 2699
Re: cannot open 'styles' member
checking XPath.pm, I find that the error occurs in
sub isOpenDocument
, looking at
att('xmlns:office')
. Examining the styles.xml file of my document, I find that a
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
tag is present. What is going on?
-- dab
Direct Responses: 2703 | Write a response
Posted on 2006-07-26 08:52:14-07 by jmgdoc in response to 2701
Re: cannot open 'styles' member
Looks strange...
Could you post the full script, and your O::O version ?
Direct Responses: 2704 | Write a response
Posted on 2006-07-26 12:25:13-07 by dab in response to 2703
Re: cannot open 'styles' member
I managed to isolate the error, the following reproduces it:
#! /usr/bin/perl use OpenOffice::OODoc; my $filename="test.odt"; my $target=$filename; $target=~s/(.+)\./$1.usc./; my $oofile = ooFile($filename) or die "could not open $filename\n"; my $styledoc = ooDocument(file => $oofile, member => 'styles');

note that the ~s operation on $target is needed to reproduce it. It appears to depend on it containing the $1, since replacing it with
$target=~s/.+\./$&usc./;
does not give the error. Realizing this makes it of course easy to avoid the problem, but it is of course a nasty one to pin down. So to my uninformed eye it looks like ooDocument has a problem when called with $1 initiated (or something similar), which is of course a bug. My version is current (OpenOffice-OODoc-2.026). thank you
-- dab
Direct Responses: Write a response
Posted on 2006-07-27 14:33:03-07 by ran in response to 2699
Re: cannot open 'styles' member
Hi, I have a really interesting opportunity for configuration managers who have experience with configuration tools in a high tech company. If you are interested, or know any one who might be - contact me: Ran Peled, 972-54-2270760 ran@mishoo.co.il Good Luck!
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.