NAME
WAP::SAXDriver::wbxml - SAX parser for WBXML file
SYNOPSIS
use WAP::SAXDriver::wbxml;
$parser = WAP::SAXDriver::wbxml->new( [OPTIONS] );
$result = $parser->parse( [OPTIONS] );
DESCRIPTION
WAP::SAXDriver::wbxml
is a SAX2 driver, and it inherits of XML::SAX::Base. This man page summarizes the specific options, handlers, and properties supported by WAP::SAXDriver::wbxml
; please refer to the SAX 2.0 standard for general usage information.
A WBXML file is the binarized form of XML file according the specification :
WAP - Wireless Application Protocol /
Binary XML Content Format Specification /
Version 1.3 WBXML (15th May 2000 Approved)
This module could be parametrized by the file WAP::SAXDriver::wbrules.pl
what contains all specific values used by WAP applications.
This module needs IO::File, IO::String and I18N::Charset modules.
METHODS
- new
-
Creates a new parser object. Default options for parsing, described below, are passed as key-value pairs or as a single hash. Options may be changed directly in the parser object unless stated otherwise. Options passed to `
parse()
' override the default options in the parser object for the duration of the parse. - parse
-
Parses a document. Options, described below, are passed as key-value pairs or as a single hash. Options passed to `
parse()
' override default options in the parser object. - parse_file, parse_uri, parse_string
-
These are all convenience variations on parse(), and in fact simply set up the options before calling it.
- location (SAX1)
-
Returns the location as a hash:
BytePosition The current byte position of the parse. ColumnNumber The column number of the parse, equals to BytePosition. LineNumber The line number of the parse, always equals to 1. PublicId A string containing the public identifier, or undef if none is available.
OPTIONS
The following options are supported by WAP::SAXDriver::wbxml
:
Handler default handler to receive events
DocumentHandler handler to receive document events
DTDHandler handler to receive DTD events
ErrorHandler handler to receive error events
Source hash containing the input source for parsing
UseOnlyDefaultRules boolean, if true the file wap.wbrules2.pl is not loaded
RulesPath path of alternate rules (standard is WAP/SAXDriver/wap.wbrules2.pl)
If no handlers are provided then all events will be silently ignored, except for `fatal_error()
' which will cause a `die()
' to be called after calling `end_document()
'.
The `Source
' hash may contain the following parameters:
ByteStream The raw byte stream (file handle) containing the
document.
String A string containing the document.
Encoding A string describing the character encoding.
If more than one of `ByteStream
', or `String
', then preference is given first to `ByteStream
', then `String
'.
HANDLERS
The following handlers and properties are supported by WAP::SAXDriver::wbxml
:
Content Events
- start_document
-
Receive notification of the beginning of a document.
Version The XML version, always 1.0. Encoding The encoding string, if any. Standalone undefined. VersionWBXML The version used for the binarization.
- end_document
-
Receive notification of the end of a document.
No properties defined.
- start_element
-
Receive notification of the beginning of an element.
Name The element type name. Attributes A hash containing the attributes attached to the element, if any.
The `
Attributes
' hash contains only string values. - end_element
-
Receive notification of the end of an element.
Name The element type name.
- characters
-
Receive notification of character data.
Data The characters from the XML document.
- processing_instruction
-
Receive notification of a processing instruction.
Target The processing instruction target. Data The processing instruction data, if any.
Error Events
- warning
-
Receive notification of a warning event.
Message The detailed explanation. BytePosition The current byte position of the parse. ColumnNumber The column number of the parse, equals to BytePosition. LineNumber The line number of the parse, always equals to 1. PublicId A string containing the public identifier, or undef if none is available.
- error
-
Receive notification of an error event.
Message The detailed explanation. BytePosition The current byte position of the parse. ColumnNumber The column number of the parse, equals to BytePosition. LineNumber The line number of the parse, always equals to 1. PublicId A string containing the public identifier, or undef if none is available.
- fatal_error
-
Receive notification of a fatal error event.
BytePosition The current byte position of the parse. ColumnNumber The column number of the parse, equals to BytePosition. LineNumber The line number of the parse, always equals to 1. PublicId A string containing the public identifier, or undef if none is available.
Lexical Events
- start_dtd
-
Receive notification of the beginning of a DTD
Name The document type name PublicId The declared public identifier for the external DTD SystemId The declared system identifier for the external DTD (may be wrong)
- end_dtd
-
Receive notification of the end of a DTD.
No properties defined.
SAX1 methods
- xml_decl
-
Deprecated in favour of start_document.
Receive notification of a XML declaration event.
Version The XML version, always 1.0. Encoding The encoding string, if any. Standalone undefined. VersionWBXML The version used for the binarization.
COPYRIGHT
(c) 2002-2007 Francois PERRAD, France.
This program is distributed under the terms of the Artistic Licence.
The WAP Specifications are copyrighted by the Wireless Application Protocol Forum Ltd. See <http://www.wapforum.org/what/copyright.htm>.
AUTHOR
Francois PERRAD, francois.perrad@gadz.org
SEE ALSO
XML::SAX, XML::SAX::Base, WAP::wbxml
Extensible Markup Language (XML) http://www.w3c.org/XML/ Binary XML Content Format (WBXML) http://www.wapforum.org/ Simple API for XML (SAX) http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/perl-xml/libxml-perl/doc/sax-2.0.html?rev=HEAD&content-type=text/html