Main > Programming > Libraries >

XML::Compile::Schema::XmlReader 0.18

XML::Compile::Schema::XmlReader 0.18

Sponsored Links

XML::Compile::Schema::XmlReader 0.18 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.12 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 840
Date added: 2007-07-16
Publisher: Mark Overmeer

XML::Compile::Schema::XmlReader 0.18 description

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.

XML::Compile::Schema::XmlReader 0.18 Screenshot

Advertisements

XML::Compile::Schema::XmlReader 0.18 Keywords

Bookmark XML::Compile::Schema::XmlReader 0.18

Hyperlink code:
Link for forum:

XML::Compile::Schema::XmlReader 0.18 Copyright

WareSeeker periodically updates pricing and software information of XML::Compile::Schema::XmlReader 0.18 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of XML::Compile::Schema::XmlReader 0.18 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
XML::Compile::Schema is a Perl module to compile a schema. Free Download
XML::Compile::Schema::Translate is a Perl module to create an XML data parser. Free Download
XML::LibXML::Reader is a Perl interface to libxml2 pull parser. Free Download
XML::CompareML is a Perl module for managing multi-system and multi-item comparisons. Free Download
XML::Mini::Element::Header Perl module is used internally to represent < ? xml blah="hohoho" ? > type headers. Free Download
DTD to XML Schema translator allows you to translate a Document Type Definition (DTD) into an XML Schema. Free Download
XML::SAX2Perl is a Perl module to translate Perl SAX methods to Java/CORBA style methods. Free Download
XML::LibXML::Enhanced is a Perl module that adds convenience methods to XML::LibXML and LibXSLT. Free Download