Class nusoap_xmlschema

Description

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

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

Located in /nusoap.php (line 1083)

nusoap_base
   |
   --nusoap_xmlschema
Direct descendents
Class Description
 class XMLSchema Backward compatibility
Variable Summary
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 1094)
mixed $complexTypes = array() (line 1095)
mixed $complexTypeStack = array() (line 1096)
mixed $currentComplexType = null (line 1097)
mixed $currentElement = null (line 1100)
mixed $currentSimpleType = null (line 1103)
mixed $defaultNamespace = array() (line 1112)
mixed $depth = 0 (line 1109)
mixed $depth_array = array() (line 1110)
mixed $elements = array() (line 1098)
mixed $elementStack = array() (line 1099)
mixed $enclosingNamespaces (line 1089)
mixed $imports = array() (line 1105)
mixed $message = array() (line 1111)
mixed $parser (line 1107)
mixed $position = 0 (line 1108)
mixed $schema = '' (line 1086)
mixed $schemaInfo = array() (line 1091)
mixed $schemaTargetNamespace = '' (line 1092)
mixed $simpleTypes = array() (line 1101)
mixed $simpleTypeStack = array() (line 1102)
mixed $xml = '' (line 1087)

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 1122)

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 1938)

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

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 1986)

adds an element to the schema

void addElement (array $attrs)
  • array $attrs: attributes that must include name and type
addSimpleType (line 1966)

adds a simple type to the schema

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 1228)

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 1722)

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 1755)

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.

mixed getTypeDef (string $type)
  • string $type
parseFile (line 1155)

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 1181)

parse an XML string

  • access: private
void parseString (string $xml, string $type)
  • string $xml: path or URL
  • string $type: (schema|xml)
schemaCharacterData (line 1578)

element content handler

  • access: private
void schemaCharacterData (string $parser, string $data)
  • string $parser: XML parser object
  • string $data: element content
schemaEndElement (line 1541)

end-element handler

  • access: private
void schemaEndElement (string $parser, string $name)
  • string $parser: XML parser object
  • string $name: element name
schemaStartElement (line 1244)

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 1588)

serialize the schema

  • access: public
void serializeSchema ()
serializeTypeDef (line 1831)

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 1867)

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 1706)

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 Tue, 06 Nov 2007 10:37:04 -0500 by phpDocumentor 1.3.0RC3