NAME
XML::IETF - an interface to the IETF XML Registry.
VERSION
version 0.01
SYNOPSIS
$xmlns = XML::IETF->xmlns('netconf'); # returns a URI::Namespace object
$url = XML::IETF->schemaLocation($xmlns); # returns a URI object
$xsd = XML::IETF->xsd($xmlns); # returns an XML::LibXML::Schema object
$xsd = XML::IETF->xsd(@uris); # returns a synthesised XML::LibXML::Schema object
DESCRIPTION
XML::IETF
provides a simple interface to the IETF XML Registry, specified in RFC 3688.
This permits for example, dynamically retrieval and loading of XML schema files using only their target namespace or mnemonic name. This is quite useful for schema-heavy protocols such as EPP.
This module uses Data::Mirror to retrieve remote resources from the IANA.
PACKAGE METHODS
xmlns($value)
This method returns a URI::Namespace object for the XML namespace URI that is associated with $value
, or undef
if the record cannot be found.
name($xmlns)
This method is the reverse of xmlns()
: given an XML namespace, it returns the mnemonic name that the namespace is registered with. $xmlns
may be a string or a URI::Namespace object.
schemaLocation($xmlns)
This method returns a URI object which locates the XSD file that is associated with the XML namespace URI in $xmlns
, which may be a string or a URI::Namespace object, or undef
if the record cannot be found.
xsd($uri|@uris)
This method has two forms:
If a single argument (
$uri
) is provided, it returns a XML::LibXML::Schema object containg the XML schema that is associated with the XML namespace URI in$uri
, which may be a string or a URI::Namespace object, orundef
if the record cannot be found.If an array of URIs (
@uris
) is provided, it will synthesise a schema that imports the XML schema of each XML namespace URI that is provided. If any of the provided URIs cannot be resolved to an XML schema, it will throw an exception.
EXAMPLE
The following code will generate an XSD that can be used to validate all EPP command and response frames described by the base EPP protocol (STD 69):
$xsd = XML::IETF->xsd(map { XML::IETF->xmlns($_) } qw(
eppcom-1.0
epp-1.0
domain-1.0
host-1.0
));
Adding support for EPP extensions is simply a matter of extending the array of mnemonics, for example:
$xsd = XML::IETF->xsd(map { XML::IETF->xmlns($_) } qw(
eppcom-1.0
epp-1.0
domain-1.0
host-1.0
secDNS-1.0
rgp-1.0
launch-1.0 mark-1.0 signedMark-1.0
));
AUTHOR
Gavin Brown <gavin.brown@icann.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2025 by Internet Corporation for Assigned Names and Number (ICANN).
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.