Re: help with XML::Xerces::LocalInputSource()
[email protected] (Jason E. Stewart)
| Newsgroups | gmane.text.xml.xerces-p.devel |
|---|---|
| Message-ID | <[email protected]> |
Anshuman Singh Rawat <[email protected]> writes: > I am trying to use LocalInputSource() to parse an xml document > contained in a variable 'body' ($parser->parse > (XML::Xerces::LocalInputSource($body));) . > > I am not sure if I am calling it correctly (I couldn;t find any > example on how to use it). That is because there is no such method ;-) > I get the following errom messages - > > Use of inherited AUTOLOAD for non-method XML::Xerces::LocalInputSource() is deprecated at ./parse.pl line 349. > Error in eval: Can't locate auto/XML/Xerces/LocalInputS.al That message means that Perl's object oriented method lookup mechanism exhausted all of it's possible means of locating a method by that name and failed (with the painfully useless message of the last method it attempted to find and couldn't). There are two types of input sources you are likely to use: 1) LocalFileInputSource - from a disk file 2) MemBufInputSource - from a variable Given what you are trying to do, I would use a MemBufInputSource: my $text = 'some piece of xml here'; my $parser = XML::Xerces::XercesDOMParser->new(); eval {$parser->parse(XML::Xerces::MemBufInputSource->new($test))}; XML::Xerces::error($@) if $@; You can always look in the samples/ and t/ directories for more examples. Cheers, jas.