DBIx-Class-LibXMLdoc
view release on metacpan or search on metacpan
lib/DBIx/Class/LibXMLdoc.pm view on Meta::CPAN
The returned item, C<$root> above, is the C<doc-E<gt>documentElement> of
a L<XML::LibXML::Document>. It returns the C<documentElement> instead
of the document object itself because the document object is less
frequently/directly useful and in the cases you might want it, e.g. to
modify the document with new nodes, you can still get it with
C<ownerDocument>. E.g.-
my $doc = $root->ownerDocument;
my $title = $doc->createElement("h1");
my $text = $doc->createTextNode($thingy->title);
$title->appendChild($text);
$root->insertBefore($title, $root->firstChild);
print $root->ownerDocument->toString, $/;
# NOW gives us (spacing added) ------
<?xml version="1.0" encoding="utf-8"?>
<doc table="thingy" column="body" version="0.05">
<h1>Gullah</h1>
<p>
Ain't no doubt Jesus see us<br/>
Acting foolishly on American Bandstand
</p>
</doc>
The encoding, as utf-8 above, is only set if the UTF8Columns component
is also being used on the column. I believe this means load order
matters. I.e. it should be-
__PACKAGE__->load_components(qw/ UTF8Columns LibXMLdoc Core /);
When you're using both.
=head1 METHODS
=head2 libXMLdoc_columns
Use C<libXMLdoc_columns> to set the columns you want available. If the columns contain anything which isn't valid XML, an exception will be thrown.
=head2 libXMLdoc_parser_settings
This is a hash ref of methods and their arguments which are passed to the L<XML::LibXML> parser when it is created.
The only pair passed by default is C<line_numbers> =E<gt> C<1>. Which is added to the parser like so-
$parser->line_numbers(1)
You can set any C<method> =E<gt> C<argument> pairs you like. See what is possible in the L<XML::LibXML::Parser> docs. Any mistaken method names or illegal arguments will cause an error. It is mostly included so you can do the following if you know yo...
__PACKAGE__->libXMLdoc_parser_settings({ recover => 1,
recover_silently => 1 });
=head1 TO DO
There are basically no live tests right now. This is very bad but L<Test::DBIC> was tough to get going and I haven't had time to fix it or roll something minimal like it. Since the code's been running in production without problems I've been slow off...
Allow a switch for parse_html...?
=head1 BUGS AND LIMITATIONS
This is no longer brand new and it's been used quite robustly in production since November of 2006. There are no known bugs. I love good feedback and bug reports.
Please report any bugs or feature requests to C<bug-dbix-class-libxmldoc@rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/Public/Dist/Display.html?Name=DBIx-Class-LibXMLdoc>.
=head1 SEE ALSO
L<XML::LibXML::Document>, L<XML::LibXML::Node>, L<XML::LibXML::Element>, L<XML::LibXML::Text>, and L<XML::LibXML::Attr>.
L<HTML::Entities> and L<DBIx::Class>.
=head1 AUTHOR
Ashley Pond V C<< <ashley@cpan.org> >>.
=head1 LICENSE AND COPYRIGHT
Copyright (c) 2008, Ashley Pond V C<< <ashley@cpan.org> >>.
This module is free software; you can redistribute it and modify it under the same terms as Perl itself. See L<perlartistic>.
=head1 DISCLAIMER OF WARRANTY
Because this software is licensed free of charge, there is no warranty for the software, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and other parties provide the software "as is" without w...
In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify or redistribute the software as permitted by the above license, be liable to you for damages, including any general, sp...
=cut
( run in 1.429 second using v1.01-cache-2.11-cpan-39bf76dae61 )