XML::X...LibXML(3pm)

πŸ“¦
version 0.6.0 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ 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_namespace method.

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 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::LibXML
  • XML::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