Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.257.793 Times

XML::Compile::Schema::XmlReader 0.18

  Date Added: February 25, 2010  |  Visits: 965

XML::Compile::Schema::XmlReader

Report Broken Link
Printer Friendly Version


Product Homepage
Download (95 downloads)



XML::Compile::Schema::XmlReader Perl module contains bricks to translate XML to HASH. SYNOPSIS my $schema = XML::Compile::Schema- >new(...); my $code = $schema- >compile(READER = > ...); The translator understands schemas, but does not encode that into actions. This module implements those actions to translate from XML into a (nested) Perl HASH structure. DETAILS Processing Wildcards If you want to collect information from the XML structure, which is permitted by any and anyAttribute specifications in the schema, you have to implement that yourself. The problem is XML::Compile has less knowledge than you about the possible data. anyAttribute By default, the anyAttribute specification is ignored. When TAKE_ALL is given, all attributes which are fulfilling the name-space requirement added to the returned data-structure. As key, the absolute element name will be used, with as value the related unparsed XML element. In the current implementation, if an explicit attribute is also covered by the name-spaces permitted by the anyAttribute definition, then it will also appear in that list (and hence the handler will be called as well). Use XML::Compile::Schema::compile(anyAttribute) to write your own handler, to influence the behavior. The handler will be called for each attribute, and you must return list of pairs of derived information. When the returned is empty, the attribute data is lost. The value may be a complex structure. Example: anyAttribute in XmlReader Say your schema looks like this: < schema targetNamespace="http://mine" xmlns:me="http://mine" ... > < element name="el" > < complexType > < attribute name="a" type="xs:int" / > < anyAttribute namespace="##targetNamespace" processContents="lax" > < / complexType > < / element > < simpleType name="non-empty" > < restriction base="xs:NCName" / > < / simpleType > < / schema > Then, in an application, you write: my $r = $schema- >compile(READER = > {http://mine}el , anyAttribute = > ALL ); my $h = $r- >( < < __XML ); < el xmlns:me="http://mine" > < a >42< /a > < b type="me:non-empty" > everything < / b > < / el > __XML use Data::Dumper Dumper; print Dumper $h; __XML__ The output is something like $VAR1 = { a = > 42 , {http://mine}a = > ... # XML::LibXML::Node with < a >42< /a > , {http://mine}b = > ... # XML::LibXML::Node with < b >everything< /b > }; You can improve the reader with a callback. When you know that the extra attribute is always of type non-empty, then you can do my $read = $schema- >compile ( READER = > {http://mine}el , anyAttribute = > &filter ); my $anyAttRead = $schema- >compile ( READER = > {http://mine}non-empty ); sub filter($$$$) { my ($fqn, $xml, $path, $translator) = @_; return () if $fqn ne {http://mine}b; (b = > $anyAttRead- >($xml)); } my $h = $r- >( see above ); print Dumper $h; Which will result in $VAR1 = { a = > 42 , b = > everything }; The filter will be called twice, but return nothing in the first case. You can implement any kind of complex processing in the filter..

Requirements: No special requirements
Platforms: Linux
Keyword: Hash Libraries Module Perl Perl Module Reader Schema Translate Translate Xml Will Be Xmlcompileschemaxmlreader Xmlreader Xmlreader Perl
Users rating: 0/10

License: Freeware Size: 122.88 KB
USER REVIEWS
More Reviews or Write Review


XML::COMPILE::SCHEMA::XMLREADER RELATED
Libraries  -  Class::Method::hash 2.08
Class::Method::hash is a Perl module that helps you create methods for handling a hash value. SYNOPSIS use Class::MethodMaker [ hash => [qw/ x /] ]; $instance->x; # empty $instance->x(a => 1, b => 2, c => 3); $instance->x_count == 3; #...
89.09 KB  
Libraries  -  Module::AutoINC 0.02
SYNOPSIS perl -MModule::AutoINC ABSTRACT When Module::AutoINC is loaded, it will add itself to @INC and catch any requests for missing resources. If a Perl module is requested that has not been installed, then this will attempt to...
5.12 KB  
Libraries  -  Set::Hash 0.01
Set::Hash is a Perl module with hashes as objects with lots of handy methods (including set comparisons) and support for method chaining. SYNOPSIS use Set::Hash; my $sh1 = Set::Hash->new(name=>"dan",age=>33); my $sh2 =...
7.17 KB  
Libraries  -  Tie::Proxy::Hash 1.01
Tie::Proxy::Hash is a Perl module created to efficiently merge & translate hashes. SYNOPSIS my (%hash, $ref); $ref = tie %hash, Tie::Proxy::Hash, (bart => +{a => 1, b => 2}, maggie => +{a => 5, c => 6, e => 10}, ); $hash{a} == 1; # true...
19.46 KB  
Libraries  -  Module::Versions 0.02
Module::Versions is a Perl module to handle versions of loaded modules with flexible result interface. SYNOPSIS use Module::Versions; # Simple Interface list Module::Versions; # prints formatted results to STDOUT Module::Versions->list; #...
21.5 KB  
Libraries  -  Perl::Critic::Config 1.061
Perl::Critic::Config is a Perl module to find and load Perl::Critic user-preferences. Perl::Critic::Config takes care of finding and processing user-preferences for Perl::Critic. The Config object defines which Policy modules will be loaded into...
245.76 KB  
Libraries  -  sqlt-diff 0.08
sqlt-diff is a Perl module that can find the differences b/w two schemas. SYNOPSIS For help: sqlt-diff -h|--help For a list of all valid parsers: sqlt -l|--list To diff two schemas: sqlt-diff [options] file_name1=parser...
532.48 KB  
Libraries  -  Geo::Lookup::ByTime 0.0.2
Geo::Lookup::ByTime is a Perl module to lookup location by time. SYNOPSIS use Geo::Lookup::ByTime; $lookup = Geo::Lookup::ByTime->new( @points ); my $pt = $lookup->nearest( $tm ); Given a set of timestamped locations guess the location at...
15.36 KB  
Libraries  -  MMDS::Properties 1.902
MMDS::Properties Perl module contains flexible properties handling for MMDS. use MMDS::Properties; my $cfg = new MMDS::Properties; # Preset a property. $cfg->set_property("config.version", "1.23"); # Parse a properties file....
409.6 KB  
Libraries  -  Test::Chimps::Howto 0.07
Test::Chimps::Howto is a Perl module with a howto about Test::Chimps. SYNOPSIS This document briefly describes how to set up a Chimps server and a Chimps smoker to smoke a project. THE SERVER We will be setting up a smoke server for an...
27.65 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB  
Libraries  -  wolfSSL 4.0.0
The wolfSSL embedded SSL/TLS library is a lightweight SSL library written in ANSI standard C and targeted for embedded and RTOS environments - primarily because of its small size, speed, and feature set. It is commonly used in standard operating...
3.88 MB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB