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 🫢


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