XML::N...Factory(3pm)
π XML::N...Factory β the manual, but make it cute π
okay so bestie, you're reading the manual page for XML::NamespaceFactory (that's the 3pm one, the Perl module one, the perldoc one). It's giving small module, huge convenience and honestly? iconic. β¨
π¦ NAME π¦
XML::NamespaceFactory β simple factory objects for SAX namespaced names. no cap, that's the whole job description π
πΈ VERSION πΈ
version 1.02 π
β¨ SYNOPSIS β¨
use XML::NamespaceFactory;
my $FOO = XML::NamespaceFactory->new('http://foo.org/ns/');
print $FOO->title; # {http://foo.org/ns/}title
print $FOO->{'bar.baz-toto'}; # {http://foo.org/ns/}bar.baz-toto
like. look at that. two lines of setup and you're printing JClark names like it's nothing. π«Ά
π DESCRIPTION π
So the vibe is: you make a brand new XML::NamespaceFactory object, and the namespace you wanna use goes in as its single parameter. That's it. That's the whole constructor.
Wanna use the empty namespace? Pass in an empty string. Literally ''. But bestie, listen β undef will not do. it's not the same thing, she will not accept it, don't even try π
Then, whenever you want a JClark name, you just call a method on that object, and the method name is the local name you want. It hands you back the JClark notation for that local name, living in your namespace. easy. slay.
π also there's the rub: some local names are legal in XML but not legal in Perl. tragic. rude. unfair.
to get around that whole situation, you can use the hash notation β you access a key on the object, and the key name is the local name you want. It works exactly the same as the method-call name but it accepts more characters π«
π careful though: hash notation does not check that the name you ask for is a valid XML name. It does not validate. So it's the more general form β but it's also slower.
If all of this is still kinda murky, hopefully the SYNOPSIS helps :) fr fr that's what it's there for π
π₯ ABSTRACT π₯
A number of accessors for namespaces in SAX use the JClark notation, {namespace}local-name. And likeβ¦ typing that repeatedly is painful, and as hash keys it's honestly somewhat error-prone π΅βπ«
This module makes life easier. periodt. π
π AUTHORS π
- Robin Berjon <robin@knowscape.com>
- Chris Prather <chris@prather.org>
two legends, one module, we love to see it π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2013 by Robin Berjon.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π
and that's the page, bestie!! this beauty lives in perl v5.40.1, dated 2025-08-14, under the name XML::N...Factory(3pm). go forth and build namespaces, you absolute main character ππΈπ
π¦ where this page comes from
- ubuntu resolute: libxml-namespacefactory-perl 1.02-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libxml-namespacefactory-perl 1.02-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms