GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  XML::PASTOR::SCHEMA::PARSER (3)

.ds Aq ’

NAME

XML::Pastor::Schema::Parser - Module for parsing a W3C XSD schema into an internal schema model.

CONTENTS

WARNING

This module is used internally by XML::Pastor. You do not normally know much about this module to actually use XML::Pastor. It is documented here for completeness and for XML::Pastor developers. Do not count on the interface of this module. It may change in any of the subsequent releases. You have been warned.

ISA

This class descends from Class::Accessor.

DESCRIPTION

<B>XML::Pastor::Schema::ParseB> is used internally by XML::Pastor for parsing a W3C schema into an internal schema model (XML::Pastor::Schema::Model).

The parsing is done with the parse() method. The schema is not parsed directly. Instead, XML::LibXML is used to first parse the schema into a DOM tree (since the W3C schema is itself represented in XML). Then, the DOM tree hence obtained is traversed recursively in order to construct the <B>schema modelB> which is somewhat like a parse-tree.

For more information on the <B>schema modelB> produced, please refer to XML::Pastor::Schema::Model.

METHODS

    CONSTRUCTORS

new()



  XML::Pastor::Schema::Parser->new(%fields)



<B>CONSTRUCTORB>.

The new() constructor method instantiates a new object. It is inheritable.

Any -named- fields that are passed as parameters are initialized to those values within the newly created object.

The <B>B>new()<B>B> method will create a model and a contextStack if it is not passed values for those fields.

.

    ACCESSORS

contextStack()

A stack (of type XML::Pastor::Stack) that keeps track of the current context. Every time a new schema is opened for parsing (as a result of include or redefine statements), a new context is pushed on the stack.

Each context is of type XML::Pastor::Schema::Context. Basically, the context keeps track of the DOM nodes that are being processed before they are inserted into the model.

counter()

A simple integer counter that keeps track of the count that is attributed to implicit nodes (typically simple types) that need to be named. Whenever such a node needs to be named, the counter is used to generate a unique name before being incremented.

model()

The schema model (of type XML::Pastor::Schema::Model) that is currently being constructed. The model is the result of the parsing operation and it is the internal reprsentation (information set) of a series of schemas that are related to each other (via includes or similar means).

    OTHER METHODS

parse()



  $model = $parser->parse(%options);



<B>OBJECT METHODB>.

This method accomplishes the major role of this module. Namely, it parses a W3C XSD schema into an internal structure called a <B>schema modelB>.

Example:



  my $parser = XML::Pastor::Schema::Parser->new();
  my $model  = $parser->parse(schema=>/tmp/schemas/country.xsd);



The W3C schema, which is in XML itself, is not parsed directly. Instead, it is parsed first into a DOM tree with the help of XML::LibXML. Then, a recursive algorithm is used for constructing a <B>schema modelB> which is an internal structure.

For more information on the <B>schema modelB> produced, please refer to XML::Pastor::Schema::Model.

OPTIONS
schema This is the file name or the URL to the <B>W3C XSD schemaB> file to be processed. Experimentally, it can also be a string containing schema XSD.

Be careful about the paths that are mentioned for any included schemas though. If these are relative, they will be taken realtive to the current schema being processed. In the case of a schema string, the resolution of relative paths for the included schemas is undefined.

Currently, it is also possible to pass an array reference to this parameter, in which case the schemas will be processed in order and merged to the same model for code generation. Just make sure you don’t have name collisions in the schemas though.

.

BUGS & CAVEATS

There no known bugs at this time, but this doesn’t mean there are aren’t any. Note that, although some testing was done prior to releasing the module, this should still be considered alpha code. So use it at your own risk.

Note that there may be other bugs or limitations that the author is not aware of.

AUTHOR

Ayhan Ulusoy <dev(at)ulusoy(dot)name>

COPYRIGHT



  Copyright (C) 2006-2007 Ayhan Ulusoy. All Rights Reserved.



This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

See also XML::Pastor, XML::Pastor::ComplexType, XML::Pastor::SimpleType

And if you are curious about the implementation, see XML::Pastor::Schema::Model, XML::Pastor:Generator

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 XML::PASTOR::SCHEMA::PARSER (3) 2012-12-01

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.