Perl Tutorials - Herong's Tutorial Examples - v6.02, by Herong Yang
XML Parsing Options
This section describes commonly used options supported by the XML::Simple module that controls how to handle root element and empty elements. 'forcearray => 1' option is needed if you want to text elements to parsed as arrays.
XML::Simple options can be specified in the new() method call:
$xs = new XML::Simple(option1 => value, option2 => value, ...);
Commonly used options are:
1. keeproot => 1: Applies to both XMLin() and XMLout() to keep the root tag.
2. searchpath => list: Applies to XMLin() to specifies the directories to search for input XML files.
3. forcearray => 1: Applies to XMLin() to force the contents of all elements to be an array.
4. suppressempty => 1 or '': Applies to XMLin() to skip empty elements or to represent them as '' strings. The default behavior is to represent empty elements as references of empty hashes. The default behavior makes it hard to access empty elements in the parsed hash.
5. keyattr => list: Applies to XMLin() and XMLout() to name attributes, or sub-elements as keys to be used to promote the parent element from array to hash. Remember that there is a default list: "name", "key", and "id".
Table of Contents
Data Types: Values and Variables
Expressions, Operations and Simple Statements
Name Spaces and Perl Module Files
Hard References - Addresses of Memory Objects
Objects (or References) and Classes (or Packages)
Typeglob and Importing Identifiers from Other Packages
String Built-in Functions and Performance
File Handles and Data Input/Output
Open Directories and Read File Names
File System Functions and Operations
Socket Communication Over the Internet
►XML::Simple Module - XML Parser and Generator
"forcearray" - Forcing Element Contents as Arrays
"suppressempty" - Parsing Empty Elements
"keyattr" - Namings Attributes as Keys
XmlSimpleHash.pl - XML Hash Example
SOAP::Lite - SOAP Server-Client Communication Module
Perl Programs as IIS Server CGI Scripts
CGI (Common Gateway Interface)
XML-RPC - Remote Procedure Call with XML and HTTP
RPC::XML - Perl Implementation of XML-RPC
Integrating Perl with Apache Web Server
CGI.pm Module for Building Web Pages
LWP::UserAgent and Web Site Testing
Converting Perl Script to Executable Binary