XML::NewsML_G2::Writer - base class for XML DOM tree creation conforming to NewsML-G2 News Items, Package Items and News Messages
my $w = XML::NewsML_G2::Writer::News_Item->new (news_item => $ni, scheme_manager => $sm, g2_version => 2.18); my $p = $w->create_element('p', class => 'main', _text => 'blah'); my $dom = $w->create_dom();
This module acts as a NewsML-G2 version-independent base class for all writer classes. Depending on whether you want to create output for a News Item, Package Item or News Message, use one of the subclasses XML::NewsML_G2::Writer::News_Item, XML::NewsML_G2::Writer::Package_Item or XML::NewsML_G2::Writer::News_Message instead.
XML::NewsML_G2::News_Item instance used to create the output document
Encoding used to create the output document, defaults to utf-8
XML::NewsML_G2::Scheme_Manager instance used to create qcodes
XML::LibXML::Document instance used to create the output document
XML Namespace of NewsML-G2
XML Namespace of XHTML
Use this attribute to specify the NewsML-G2 version to be created. Defaults to 2.18, other valid options are: 2.9, 2.12 and 2.15. Be aware that only the later versions offer all features.
Specified by subclass.
URL of the G2 catalog, specified by subclass.
Reference to a hash of schemes that are covered by the G2 catalog. If the value is undefined, it defaults to the name of the scheme.
Version of the generating software, as written to the output. Defaults to the version of XML::NewsML_G2, but can be overwritten here (mainly to ease automated testing).
Helper method that creates XML elements, e.g. to be used in the
paragraphselement of the XML::NewsML_G2::News_Item.
Returns the XML::LibXML::Document element containing the requested output. Be careful not to use
$dom->serialize(2)for formatting, as this creates invalid NewsML-G2 files because it adds whitespace where none is allowed (e.g. in xs:dateTime elements).
Copyright (c) 2013-2014, APA-IT. All rights reserved.
See XML::NewsML_G2 for the license.