1XML::NamespaceFactory(3U)ser Contributed Perl DocumentatiXoMnL::NamespaceFactory(3)
2
3
4
6 XML::NamespaceFactory - Simple factory objects for SAX namespaced
7 names.
8
10 version 1.02
11
13 use XML::NamespaceFactory;
14 my $FOO = XML::NamespaceFactory->new('http://foo.org/ns/');
15
16 print $FOO->title; # {http://foo.org/ns/}title
17 print $FOO->{'bar.baz-toto'}; # {http://foo.org/ns/}bar.baz-toto
18
20 Simply create a new XML::NamespaceFactory object with the namespace you
21 wish to use as its single parameter. If you wish to use the empty
22 namespace, simply pass in an empty string (but undef will not do).
23
24 Then, when you want to get a JClark name, call a method on that object
25 the name of which is the local name you wish to have. It'll return the
26 JClark notation for that local name in your namespace.
27
28 Unfortunately, some local names legal in XML are not legal in Perl. To
29 circumvent this, you can use the hash notation in which you access a
30 key on the object the name of which is the local name you wish to have.
31 This will work just as the method call name but will accept more
32 characters. Note that it does not check that the name you ask for is a
33 valid XML name. This form is more general but slower.
34
35 If this is not clear, hopefully the SYNOPSIS should help :)
36
38 A number of accessors for namespaces in SAX use the JClark notation,
39 {namespace}local-name. Those are a bit painful to type repeatedly, and
40 somewhat error-prone as hash keys. This module makes life easier.
41
43 · Robin Berjon <robin@knowscape.com>
44
45 · Chris Prather <chris@prather.org>
46
48 This software is copyright (c) 2013 by Robin Berjon.
49
50 This is free software; you can redistribute it and/or modify it under
51 the same terms as the Perl 5 programming language system itself.
52
53
54
55perl v5.28.1 2014-07-03 XML::NamespaceFactory(3)