XMLSchema Class Reference

Inherits nusoap_base, and nusoap_base.

Inheritance diagram for XMLSchema:

[legend]
Collaboration diagram for XMLSchema:
[legend]
List of all members.

Public Member Functions

 XMLSchema ($schema='', $xml='', $namespaces=array())
 parseFile ($xml, $type)
 parseString ($xml, $type)
 schemaStartElement ($parser, $name, $attrs)
 schemaEndElement ($parser, $name)
 schemaCharacterData ($parser, $data)
 serializeSchema ()
 xdebug ($string)
 getPHPType ($type, $ns)
 getTypeDef ($type)
 serializeTypeDef ($type)
 typeToForm ($name, $type)
 addComplexType ($name, $typeClass='complexType', $phpType='array', $compositor='', $restrictionBase='', $elements=array(), $attrs=array(), $arrayType='')
 addSimpleType ($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array())
 addElement ($attrs)
 XMLSchema ($schema='', $xml='', $namespaces=array())
 parseFile ($xml, $type)
 parseString ($xml, $type)
 schemaStartElement ($parser, $name, $attrs)
 schemaEndElement ($parser, $name)
 schemaCharacterData ($parser, $data)
 serializeSchema ()
 xdebug ($string)
 getPHPType ($type, $ns)
 getTypeDef ($type)
 serializeTypeDef ($type)
 typeToForm ($name, $type)
 addComplexType ($name, $typeClass='complexType', $phpType='array', $compositor='', $restrictionBase='', $elements=array(), $attrs=array(), $arrayType='')
 addSimpleType ($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array())
 addElement ($attrs)

Detailed Description

parses an XML Schema, allows access to it's data, other utility methods no validation... yet. very experimental and limited. As is discussed on XML-DEV, I'm one of the people that just doesn't have time to read the spec(s) thoroughly, and just have a couple of trusty tutorials I refer to :)

Author:
Dietrich Ayala <dietrich@ganx4.com>
Version:
$Id$ public


Member Function Documentation

XMLSchema::XMLSchema ( schema = '',
xml = '',
namespaces = array() 
)

constructor

Parameters:
string $schema schema document URI
string $xml xml document URI
string $namespaces namespaces defined in enclosing XML public

XMLSchema::parseFile ( xml,
type 
)

parse an XML file

Parameters:
string $xml, path/URL to XML file
string $type, (schema | xml)
Returns:
boolean public

XMLSchema::parseString ( xml,
type 
)

parse an XML string

Parameters:
string $xml path or URL
string $type, (schema|xml) private

XMLSchema::schemaStartElement ( parser,
name,
attrs 
)

start-element handler

Parameters:
string $parser XML parser object
string $name element name
string $attrs associative array of attributes private

XMLSchema::schemaEndElement ( parser,
name 
)

end-element handler

Parameters:
string $parser XML parser object
string $name element name private

XMLSchema::schemaCharacterData ( parser,
data 
)

element content handler

Parameters:
string $parser XML parser object
string $data element content private

XMLSchema::serializeSchema (  ) 

serialize the schema

public

XMLSchema::xdebug ( string  ) 

adds debug data to the clas level debug string

Parameters:
string $string debug data private

XMLSchema::getPHPType ( type,
ns 
)

get the PHP type of a user defined type in the schema PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays returns false if no type exists, or not w/ the given namespace else returns a string that is either a native php type, or 'struct'

Parameters:
string $type, name of defined type
string $ns, namespace of type
Returns:
mixed public
Deprecated:

XMLSchema::getTypeDef ( type  ) 

returns an associative array of information about a given type returns false if no type exists by the given name

For a complexType typeDef = array( 'restrictionBase' => '', 'phpType' => '', 'compositor' => '(sequence|all)', 'elements' => array(), // refs to elements array 'attrs' => array() // refs to attributes array ... and so on (see addComplexType) )

For simpleType or element, the array has different keys.

Parameters:
string 
Returns:
mixed public
See also:
addComplexType

addSimpleType

addElement

XMLSchema::serializeTypeDef ( type  ) 

returns a sample serialization of a given type, or false if no type by the given name

Parameters:
string $type, name of type
Returns:
mixed public
Deprecated:

XMLSchema::typeToForm ( name,
type 
)

returns HTML form elements that allow a user to enter values for creating an instance of the given type.

Parameters:
string $name, name for type instance
string $type, name of type
Returns:
string public
Deprecated:

XMLSchema::addComplexType ( name,
typeClass = 'complexType',
phpType = 'array',
compositor = '',
restrictionBase = '',
elements = array(),
attrs = array(),
arrayType = '' 
)

adds a complex type to the schema

example: array

addType( 'ArrayOfstring', 'complexType', 'array', '', 'SOAP-ENC:Array', array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), 'xsd:string' );

example: PHP associative array ( SOAP Struct )

addType( 'SOAPStruct', 'complexType', 'struct', 'all', array('myVar'=> array('name'=>'myVar','type'=>'string') );

Parameters:
name 
typeClass (complexType|simpleType|attribute)
phpType,: currently supported are array and struct (php assoc array)
compositor (all|sequence|choice)
restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
elements = array ( name = array(name=>'',type=>'') )
attrs = array( array( 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" ) )
arrayType,: namespace:name (http://www.w3.org/2001/XMLSchema:string) public
See also:
getTypeDef

XMLSchema::addSimpleType ( name,
restrictionBase = '',
typeClass = 'simpleType',
phpType = 'scalar',
enumeration = array() 
)

adds a simple type to the schema

Parameters:
string $name
string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
string $typeClass (should always be simpleType)
string $phpType (should always be scalar)
array $enumeration array of values public
See also:
xmlschema

getTypeDef

XMLSchema::addElement ( attrs  ) 

adds an element to the schema

Parameters:
array $attrs attributes that must include name and type
See also:
xmlschema public

XMLSchema::XMLSchema ( schema = '',
xml = '',
namespaces = array() 
)

constructor

Parameters:
string $schema schema document URI
string $xml xml document URI
string $namespaces namespaces defined in enclosing XML public

XMLSchema::parseFile ( xml,
type 
)

parse an XML file

Parameters:
string $xml, path/URL to XML file
string $type, (schema | xml)
Returns:
boolean public

XMLSchema::parseString ( xml,
type 
)

parse an XML string

Parameters:
string $xml path or URL
string $type, (schema|xml) private

XMLSchema::schemaStartElement ( parser,
name,
attrs 
)

start-element handler

Parameters:
string $parser XML parser object
string $name element name
string $attrs associative array of attributes private

XMLSchema::schemaEndElement ( parser,
name 
)

end-element handler

Parameters:
string $parser XML parser object
string $name element name private

XMLSchema::schemaCharacterData ( parser,
data 
)

element content handler

Parameters:
string $parser XML parser object
string $data element content private

XMLSchema::serializeSchema (  ) 

serialize the schema

public

XMLSchema::xdebug ( string  ) 

adds debug data to the clas level debug string

Parameters:
string $string debug data private

XMLSchema::getPHPType ( type,
ns 
)

get the PHP type of a user defined type in the schema PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays returns false if no type exists, or not w/ the given namespace else returns a string that is either a native php type, or 'struct'

Parameters:
string $type, name of defined type
string $ns, namespace of type
Returns:
mixed public
Deprecated:

XMLSchema::getTypeDef ( type  ) 

returns an associative array of information about a given type returns false if no type exists by the given name

For a complexType typeDef = array( 'restrictionBase' => '', 'phpType' => '', 'compositor' => '(sequence|all)', 'elements' => array(), // refs to elements array 'attrs' => array() // refs to attributes array ... and so on (see addComplexType) )

For simpleType or element, the array has different keys.

Parameters:
string 
Returns:
mixed public
See also:
addComplexType

addSimpleType

addElement

XMLSchema::serializeTypeDef ( type  ) 

returns a sample serialization of a given type, or false if no type by the given name

Parameters:
string $type, name of type
Returns:
mixed public
Deprecated:

XMLSchema::typeToForm ( name,
type 
)

returns HTML form elements that allow a user to enter values for creating an instance of the given type.

Parameters:
string $name, name for type instance
string $type, name of type
Returns:
string public
Deprecated:

XMLSchema::addComplexType ( name,
typeClass = 'complexType',
phpType = 'array',
compositor = '',
restrictionBase = '',
elements = array(),
attrs = array(),
arrayType = '' 
)

adds a complex type to the schema

example: array

addType( 'ArrayOfstring', 'complexType', 'array', '', 'SOAP-ENC:Array', array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), 'xsd:string' );

example: PHP associative array ( SOAP Struct )

addType( 'SOAPStruct', 'complexType', 'struct', 'all', array('myVar'=> array('name'=>'myVar','type'=>'string') );

Parameters:
name 
typeClass (complexType|simpleType|attribute)
phpType,: currently supported are array and struct (php assoc array)
compositor (all|sequence|choice)
restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
elements = array ( name = array(name=>'',type=>'') )
attrs = array( array( 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" ) )
arrayType,: namespace:name (http://www.w3.org/2001/XMLSchema:string) public
See also:
getTypeDef

XMLSchema::addSimpleType ( name,
restrictionBase = '',
typeClass = 'simpleType',
phpType = 'scalar',
enumeration = array() 
)

adds a simple type to the schema

Parameters:
string $name
string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
string $typeClass (should always be simpleType)
string $phpType (should always be scalar)
array $enumeration array of values public
See also:
xmlschema

getTypeDef

XMLSchema::addElement ( attrs  ) 

adds an element to the schema

Parameters:
array $attrs attributes that must include name and type
See also:
xmlschema public


The documentation for this class was generated from the following files:
Generated on Thu Nov 2 00:27:25 2006 for XOOPS Cube Legacy by  doxygen 1.5.1