XML::X...LibXML(3pm)
β¨ XML::X...LibXML π
okay bestie, so this is a User Contributed Perl Documentation page, and we're about to make XML::XUpdate::LibXML make sense. sit with me, hydrate, let's go π«Ά
πΈ NAME πΈ
XML::XUpdate::LibXML β a simple implementation of the XUpdate format. yes, it does exactly what it says on the tin, no cap π
π SYNOPSIS π
use XML::LibXML;
use XML::XUpdate::LibXML;
$parser = XML::LibXML->new();
$dom = $parser->parse_file("mydoc.xml");
$actions = $parser->parse_file("update.xml");
$xupdate = XML::XUpdate::LibXML->new();
$xupdate->process($dom->getDocumentElement(), $actions);
print $dom->toString(),"\n";
likeβ¦ parse ur doc, parse ur update file, run the update, print the glow-up. iconic behavior honestly β¨
π¦ DESCRIPTION π¦
This module implements the XUpdate format described in the XUpdate Working Draft from 2000-09-14 (http://www.xmldb.org/xupdate/xupdate-wd.html). The whole thing is built on top of the XML::LibXML DOM API. no reinventing wheels here, we're just vibing on top of an existing API π§
π "new" π
my $xupdate = XML::XUpdate::LibXML->new();
Creates a shiny new XUpdate object. the cute part? you can reuse this one object to update several different DOM trees using several different XUpdate descriptions. and the actual advantage β the reason it slaps β is that an xupdate object remembers the values of all variables declared in XUpdate documents. it's giving main character memory retention π
π "$xupdate->registerNs($prefix,$uri)" π
Tells the XPath engine to resolve a given namespace prefix as a given namespace URI. lowkey the most useful thing ever if you want to bind a default namespace to a prefix β because XPath simply does not honour default namespaces. XPath said "default who?" π
π "$xupdate->process($document_dom,$xupdate_dom)" π
This function takes two DOM trees as its arguments, bestie. it works by updating the first tree according to all the XUpdate commands included in the second one.
Some ground rules, fr fr:
- All XUpdate commands must be children of the root element of the second tree.
- They must all belong to the XUpdate namespace
http://www.xmldb.org/xupdate. - That namespace URI can be changed with the
set_namespacemethod.
periodt. π
π "$xupdate->set_namespace($URI)" π
Use this method to change the namespace of XUpdate elements. the default namespace is http://www.xmldb.org/xupdate. that's the factory setting, don't come for me π
πΈ "$xupdate->namespace()" πΈ
Returns the XUpdate namespace URI that the XUpdate processor uses to identify XUpdate commands. it's literally just a getter. she's simple, she's reliable, we stan π«Ά
β EXPORT β
None.
that's it. that's the section. nothing exported, nothing to see, carry on π
π§ DIFFERENCES BETWEEN 0.2.x and 0.3.x π§
In 0.3.x, a different implementation of XUpdate variables is used. Now variables contain the actual objects resulting from an XPath query, and not their textual content like they did in versions 0.2.x of XML::XUpdate::LibXML.
Also, the value-of instruction results in copies of the actual objects it selects rather than their textual content as in 0.2.x.
And the author hopes the new implementation is more conformant with the (not very clear, let's be honest) XUpdate Working Draft, and therefore more compatible with other XUpdate implementations. manifesting compatibility β¨
π DIFFERENCES BETWEEN 0.3.x and 0.4.x π
Commands are applied to all nodes of the select nodeset, not just the first one.
that's the whole section. glow up achieved π
π DIFFERENCES BETWEEN 0.4.x and 0.5.x π
XML::LibXML::XPathContext is used for variable code, providing a more flexible and powerfull implementation. A new and hopefully correct implementation of the problematic child attribute of the update command has been introduced.
Support for registrering namespace prefix with the XPath engine (allows binding document's default namespace to a prefix).
Several bug fixes. we love a bug-fix era πβ¨
π DIFFERENCES BETWEEN 0.5.x and 0.6.x π
The xu:if command implementation was contributed by Amir Guindehi. shoutout to the contributor, we see you π
π AUTHOR π
Petr Pajas, pajas@matfyz.cz
π COPYRIGHT π
Copyright 2002-2005 Petr Pajas, All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π SEE ALSO π
XML::LibXMLXML::LibXML::XPathContext
okay that's the whole page, you ate it, go write some XUpdate π
This page came to you from perl v5.32.0, dated 2021-01-07, under the title XML::X...LibXML(3pm). mwah, bye bestie ππ¦π
π¦ where this page comes from
- debian bookworm: libxml-xupdate-libxml-perl 0.6.0-3.1
- debian trixie: libxml-xupdate-libxml-perl 0.6.0-3.1
- ubuntu jammy: libxml-xupdate-libxml-perl 0.6.0-3.1
- ubuntu noble: libxml-xupdate-libxml-perl 0.6.0-3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms