Name : perl-DBIx-Class-LibXMLdoc
| |
Version : 0.05
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp156.10.1
| Date : 2024-07-03 19:04:02
|
Group : Development/Libraries/Perl
| Source RPM : perl-DBIx-Class-LibXMLdoc-0.05-lp156.10.1.src.rpm
|
Size : 0.01 MB
| |
Packager : https://www_suse_com/
| |
Summary : Create an adjunct \"[column]Doc\" accessor of a column\'s data which is aut[cut]
|
Description :
This DBIx::Class component does not alter your data in any way. It takes column names to get the value from the column, parse it into XML with LibXML and make the documentElement object available via an autogenerated accessor named by affixing the column with \"Doc.\"
The XML parsing is on demand so it doesn\'t waste time doing it to data you don\'t use or by doing it more than once to data that is unchanged.
A wrapper XML tag for the mini-document is auto-generated from the table + column name. So-
my $xhmlt = < < \"; < p> Ain\'t no doubt Jesus see us< br/> Acting foolishly on American Bandstand < /p>
my $thingy = $schema->resultset(\"thingy\") ->create({ title => \"Gullah\", body => $xhtml });
my $root = $thingy->bodyDoc;
print $root->toString, $/;
< thingybody>< p> Ain\'t no doubt Jesus see us< br/> Acting foolishly on American Bandstand < /p>< /thingybody>
The returned item, \'$root\' above, is the \'doc->documentElement\' of a XML::LibXML::Document. It returns the \'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 \'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, $/;
< ?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.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-D/15.6/noarch |