## nusoap_xmlschema

Description

parses an XML Schema, allows access to it's data, other utility methods.

imperfect, no validation... yet, but quite functional.

- access: public
- version: $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
- author: Dietrich Ayala <dietrich@ganx4.com>
- author: Scott Nichol <snichol@users.sourceforge.net>

Located in /nusoap.php (line 1095)

    nusoap_base
       |
       --nusoap_xmlschema

Direct descendents

Class | Description
--- | ---
XMLSchema | Backward compatibility

Variable Summary
mixed $attributes
mixed $complexTypes
mixed $complexTypeStack
mixed $currentComplexType
mixed $currentElement
mixed $currentSimpleType
mixed $defaultNamespace
mixed $depth
mixed $depth_array
mixed $elements
mixed $elementStack
mixed $enclosingNamespaces
mixed $imports
mixed $message
mixed $parser
mixed $position
mixed $schema
mixed $schemaInfo
mixed $schemaTargetNamespace
mixed $simpleTypes
mixed $simpleTypeStack
mixed $xml
Method Summary
nusoap_xmlschema nusoap_xmlschema ([string $schema = ''], [string $xml = ''], [string $namespaces = array()])
void addComplexType (name $name, [typeClass $typeClass = 'complexType'], [phpType: $phpType = 'array'], [compositor $compositor = ''], [restrictionBase $restrictionBase = ''], [elements $elements = array()], [attrs $attrs = array()], [arrayType: $arrayType = ''])
void addElement (array $attrs)
void addSimpleType (string $name, [string $restrictionBase = ''], [string $typeClass = 'simpleType'], [string $phpType = 'scalar'], [array $enumeration = array()])
string CreateTypeName (string $ename)
mixed getPHPType (string $type, string $ns)
mixed getTypeDef (string $type)
boolean parseFile (string $xml, string $type)
void parseString (string $xml, string $type)
void schemaCharacterData (string $parser, string $data)
void schemaEndElement (string $parser, string $name)
void schemaStartElement (string $parser, string $name, string $attrs)
void serializeSchema ()
mixed serializeTypeDef (string $type)
string typeToForm (string $name, string $type)
void xdebug (string $string)
Variables
mixed $attributes = array() (line 1106)
mixed $complexTypes = array() (line 1107)
mixed $complexTypeStack = array() (line 1108)
mixed $currentComplexType = null (line 1109)
mixed $currentElement = null (line 1112)
mixed $currentSimpleType = null (line 1115)
mixed $defaultNamespace = array() (line 1124)
mixed $depth = 0 (line 1121)
mixed $depth_array = array() (line 1122)
mixed $elements = array() (line 1110)
mixed $elementStack = array() (line 1111)
mixed $enclosingNamespaces (line 1101)
mixed $imports = array() (line 1117)
mixed $message = array() (line 1123)
mixed $parser (line 1119)
mixed $position = 0 (line 1120)
mixed $schema = '' (line 1098)
mixed $schemaInfo = array() (line 1103)
mixed $schemaTargetNamespace = '' (line 1104)
mixed $simpleTypes = array() (line 1113)
mixed $simpleTypeStack = array() (line 1114)
mixed $xml = '' (line 1099)

#### Inherited Variables

Inherited from nusoap_base

> nusoap_base::$charencoding
> nusoap_base::$debugLevel
> nusoap_base::$debug_str
> nusoap_base::$error_str
> nusoap_base::$namespaces
> nusoap_base::$revision
> nusoap_base::$soap_defencoding
> nusoap_base::$title
> nusoap_base::$typemap
> nusoap_base::$usedNamespaces
> nusoap_base::$version
> nusoap_base::$xmlEntities
> nusoap_base::$XMLSchemaVersion

Methods
Constructor nusoap_xmlschema (line 1134)

constructor

- access: public

nusoap_xmlschema nusoap_xmlschema ([string $schema = ''], [string $xml = ''], [string $namespaces = array()])

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

addComplexType (line 1985)

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') );

- see: nusoap_xmlschema::getTypeDef()
- access: public

void addComplexType (name $name, [typeClass $typeClass = 'complexType'], [phpType: $phpType = 'array'], [compositor $compositor = ''], [restrictionBase $restrictionBase = ''], [elements $elements = array()], [attrs $attrs = array()], [arrayType: $arrayType = ''])

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

addElement (line 2033)

adds an element to the schema

- access: public
- see: nusoap_xmlschema

void addElement (array $attrs)

- array $attrs: attributes that must include name and type

addSimpleType (line 2013)

adds a simple type to the schema

- see: nusoap_xmlschema::getTypeDef()
- see: nusoap_xmlschema
- access: public

void addSimpleType (string $name, [string $restrictionBase = ''], [string $typeClass = 'simpleType'], [string $phpType = 'scalar'], [array $enumeration = array()])

- 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

CreateTypeName (line 1240)

gets a type name for an unnamed type

- return: A type name for an unnamed type
- access: private

string CreateTypeName (string $ename)

- string $ename: Element name

getPHPType (line 1766)

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'

- deprecated:
- access: public

mixed getPHPType (string $type, string $ns)

- string $type: name of defined type
- string $ns: namespace of type

getTypeDef (line 1799)

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.

- see: nusoap_xmlschema::addElement()
- see: nusoap_xmlschema::addSimpleType()
- see: nusoap_xmlschema::addComplexType()
- access: public

mixed getTypeDef (string $type)

- string $type

parseFile (line 1167)

parse an XML file

- access: public

boolean parseFile (string $xml, string $type)

- string $xml: path/URL to XML file
- string $type: (schema | xml)

parseString (line 1193)

parse an XML string

- access: private

void parseString (string $xml, string $type)

- string $xml: path or URL
- string $type: (schema|xml)

schemaCharacterData (line 1622)

element content handler

- access: private

void schemaCharacterData (string $parser, string $data)

- string $parser: XML parser object
- string $data: element content

schemaEndElement (line 1583)

end-element handler

- access: private

void schemaEndElement (string $parser, string $name)

- string $parser: XML parser object
- string $name: element name

schemaStartElement (line 1256)

start-element handler

- access: private

void schemaStartElement (string $parser, string $name, string $attrs)

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

serializeSchema (line 1632)

serialize the schema

- access: public

void serializeSchema ()
serializeTypeDef (line 1878)

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

- deprecated:
- access: public

mixed serializeTypeDef (string $type)

- string $type: name of type

typeToForm (line 1914)

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

- deprecated:
- access: public

string typeToForm (string $name, string $type)

- string $name: name for type instance
- string $type: name of type

xdebug (line 1750)

adds debug data to the clas level debug string

- access: private

void xdebug (string $string)

- string $string: debug data

#### Inherited Methods

Inherited From nusoap_base

> nusoap_base::nusoap_base()
> nusoap_base::appendDebug()
> nusoap_base::clearDebug()
> nusoap_base::contractQname()
> nusoap_base::debug()
> nusoap_base::expandEntities()
> nusoap_base::expandQname()
> nusoap_base::formatDump()
> nusoap_base::getDebug()
> nusoap_base::getDebugAsXMLComment()
> nusoap_base::getDebugLevel()
> nusoap_base::getError()
> nusoap_base::getGlobalDebugLevel()
> nusoap_base::getLocalPart()
> nusoap_base::getmicrotime()
> nusoap_base::getNamespaceFromPrefix()
> nusoap_base::getPrefix()
> nusoap_base::getPrefixFromNamespace()
> nusoap_base::isArraySimpleOrStruct()
> nusoap_base::serializeEnvelope()
> nusoap_base::serialize_val()
> nusoap_base::setDebugLevel()
> nusoap_base::setError()
> nusoap_base::setGlobalDebugLevel()
> nusoap_base::varDump()
> nusoap_base::__toString()

Documentation generated on Mon, 26 Apr 2010 16:17:04 -0400 by phpDocumentor 1.3.0RC3