Öffentliche Methoden | |
nusoap_xmlschema ($schema='', $xml='', $namespaces=array()) | |
parseFile ($xml, $type) | |
parseString ($xml, $type) | |
CreateTypeName ($ename) | |
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) | |
nusoap_xmlschema ($schema='', $xml='', $namespaces=array()) | |
parseFile ($xml, $type) | |
parseString ($xml, $type) | |
CreateTypeName ($ename) | |
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) | |
Öffentliche Attribute | |
$schema = '' | |
$xml = '' | |
$enclosingNamespaces | |
$schemaInfo = array() | |
$schemaTargetNamespace = '' | |
$attributes = array() | |
$complexTypes = array() | |
$complexTypeStack = array() | |
$currentComplexType = null | |
$elements = array() | |
$elementStack = array() | |
$currentElement = null | |
$simpleTypes = array() | |
$simpleTypeStack = array() | |
$currentSimpleType = null | |
$imports = array() | |
$parser | |
$position = 0 | |
$depth = 0 | |
$depth_array = array() | |
$message = array() | |
$defaultNamespace = array() |
parses an XML Schema, allows access to it's data, other utility methods. imperfect, no validation... yet, but quite functional.
Definiert in Zeile 15 der Datei class.xmlschema.php.
nusoap_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') );
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 |
Definiert in Zeile 1975 der Datei nusoap.php.
01975 { 01976 $this->complexTypes[$name] = array( 01977 'name' => $name, 01978 'typeClass' => $typeClass, 01979 'phpType' => $phpType, 01980 'compositor'=> $compositor, 01981 'restrictionBase' => $restrictionBase, 01982 'elements' => $elements, 01983 'attrs' => $attrs, 01984 'arrayType' => $arrayType 01985 ); 01986 01987 $this->xdebug("addComplexType $name:"); 01988 $this->appendDebug($this->varDump($this->complexTypes[$name])); 01989 }
nusoap_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') );
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 |
Definiert in Zeile 897 der Datei class.xmlschema.php.
00897 { 00898 $this->complexTypes[$name] = array( 00899 'name' => $name, 00900 'typeClass' => $typeClass, 00901 'phpType' => $phpType, 00902 'compositor'=> $compositor, 00903 'restrictionBase' => $restrictionBase, 00904 'elements' => $elements, 00905 'attrs' => $attrs, 00906 'arrayType' => $arrayType 00907 ); 00908 00909 $this->xdebug("addComplexType $name:"); 00910 $this->appendDebug($this->varDump($this->complexTypes[$name])); 00911 }
nusoap_xmlschema::addElement | ( | $ | attrs | ) |
adds an element to the schema
array | $attrs attributes that must include name and type |
Definiert in Zeile 2023 der Datei nusoap.php.
02023 { 02024 if (! $this->getPrefix($attrs['type'])) { 02025 $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type']; 02026 } 02027 $this->elements[ $attrs['name'] ] = $attrs; 02028 $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; 02029 02030 $this->xdebug("addElement " . $attrs['name']); 02031 $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ])); 02032 }
nusoap_xmlschema::addElement | ( | $ | attrs | ) |
adds an element to the schema
array | $attrs attributes that must include name and type |
Definiert in Zeile 945 der Datei class.xmlschema.php.
00945 { 00946 if (! $this->getPrefix($attrs['type'])) { 00947 $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type']; 00948 } 00949 $this->elements[ $attrs['name'] ] = $attrs; 00950 $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; 00951 00952 $this->xdebug("addElement " . $attrs['name']); 00953 $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ])); 00954 }
nusoap_xmlschema::addSimpleType | ( | $ | name, | |
$ | restrictionBase = '' , |
|||
$ | typeClass = 'simpleType' , |
|||
$ | phpType = 'scalar' , |
|||
$ | enumeration = array() | |||
) |
adds a simple type to the schema
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 |
Definiert in Zeile 2003 der Datei nusoap.php.
02003 { 02004 $this->simpleTypes[$name] = array( 02005 'name' => $name, 02006 'typeClass' => $typeClass, 02007 'phpType' => $phpType, 02008 'type' => $restrictionBase, 02009 'enumeration' => $enumeration 02010 ); 02011 02012 $this->xdebug("addSimpleType $name:"); 02013 $this->appendDebug($this->varDump($this->simpleTypes[$name])); 02014 }
nusoap_xmlschema::addSimpleType | ( | $ | name, | |
$ | restrictionBase = '' , |
|||
$ | typeClass = 'simpleType' , |
|||
$ | phpType = 'scalar' , |
|||
$ | enumeration = array() | |||
) |
adds a simple type to the schema
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 |
Definiert in Zeile 925 der Datei class.xmlschema.php.
00925 { 00926 $this->simpleTypes[$name] = array( 00927 'name' => $name, 00928 'typeClass' => $typeClass, 00929 'phpType' => $phpType, 00930 'type' => $restrictionBase, 00931 'enumeration' => $enumeration 00932 ); 00933 00934 $this->xdebug("addSimpleType $name:"); 00935 $this->appendDebug($this->varDump($this->simpleTypes[$name])); 00936 }
nusoap_xmlschema::CreateTypeName | ( | $ | ename | ) |
gets a type name for an unnamed type
string | Element name |
Definiert in Zeile 1238 der Datei nusoap.php.
01238 { 01239 $scope = ''; 01240 for ($i = 0; $i < count($this->complexTypeStack); $i++) { 01241 $scope .= $this->complexTypeStack[$i] . '_'; 01242 } 01243 return $scope . $ename . '_ContainedType'; 01244 }
nusoap_xmlschema::CreateTypeName | ( | $ | ename | ) |
gets a type name for an unnamed type
string | Element name |
Definiert in Zeile 160 der Datei class.xmlschema.php.
00160 { 00161 $scope = ''; 00162 for ($i = 0; $i < count($this->complexTypeStack); $i++) { 00163 $scope .= $this->complexTypeStack[$i] . '_'; 00164 } 00165 return $scope . $ename . '_ContainedType'; 00166 }
nusoap_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'
string | $type name of defined type | |
string | $ns namespace of type |
Definiert in Zeile 1755 der Datei nusoap.php.
01755 { 01756 if(isset($this->typemap[$ns][$type])){ 01757 //print "found type '$type' and ns $ns in typemap<br>"; 01758 return $this->typemap[$ns][$type]; 01759 } elseif(isset($this->complexTypes[$type])){ 01760 //print "getting type '$type' and ns $ns from complexTypes array<br>"; 01761 return $this->complexTypes[$type]['phpType']; 01762 } 01763 return false; 01764 }
nusoap_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'
string | $type name of defined type | |
string | $ns namespace of type |
Definiert in Zeile 677 der Datei class.xmlschema.php.
00677 { 00678 if(isset($this->typemap[$ns][$type])){ 00679 //print "found type '$type' and ns $ns in typemap<br>"; 00680 return $this->typemap[$ns][$type]; 00681 } elseif(isset($this->complexTypes[$type])){ 00682 //print "getting type '$type' and ns $ns from complexTypes array<br>"; 00683 return $this->complexTypes[$type]['phpType']; 00684 } 00685 return false; 00686 }
nusoap_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.
string | $type |
Definiert in Zeile 1788 der Datei nusoap.php.
01788 { 01789 //$this->debug("in getTypeDef for type $type"); 01790 if (substr($type, -1) == '^') { 01791 $is_element = 1; 01792 $type = substr($type, 0, -1); 01793 } else { 01794 $is_element = 0; 01795 } 01796 01797 if((! $is_element) && isset($this->complexTypes[$type])){ 01798 $this->xdebug("in getTypeDef, found complexType $type"); 01799 return $this->complexTypes[$type]; 01800 } elseif((! $is_element) && isset($this->simpleTypes[$type])){ 01801 $this->xdebug("in getTypeDef, found simpleType $type"); 01802 if (!isset($this->simpleTypes[$type]['phpType'])) { 01803 // get info for type to tack onto the simple type 01804 // TODO: can this ever really apply (i.e. what is a simpleType really?) 01805 $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1); 01806 $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')); 01807 $etype = $this->getTypeDef($uqType); 01808 if ($etype) { 01809 $this->xdebug("in getTypeDef, found type for simpleType $type:"); 01810 $this->xdebug($this->varDump($etype)); 01811 if (isset($etype['phpType'])) { 01812 $this->simpleTypes[$type]['phpType'] = $etype['phpType']; 01813 } 01814 if (isset($etype['elements'])) { 01815 $this->simpleTypes[$type]['elements'] = $etype['elements']; 01816 } 01817 } 01818 } 01819 return $this->simpleTypes[$type]; 01820 } elseif(isset($this->elements[$type])){ 01821 $this->xdebug("in getTypeDef, found element $type"); 01822 if (!isset($this->elements[$type]['phpType'])) { 01823 // get info for type to tack onto the element 01824 $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1); 01825 $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':')); 01826 $etype = $this->getTypeDef($uqType); 01827 if ($etype) { 01828 $this->xdebug("in getTypeDef, found type for element $type:"); 01829 $this->xdebug($this->varDump($etype)); 01830 if (isset($etype['phpType'])) { 01831 $this->elements[$type]['phpType'] = $etype['phpType']; 01832 } 01833 if (isset($etype['elements'])) { 01834 $this->elements[$type]['elements'] = $etype['elements']; 01835 } 01836 if (isset($etype['extensionBase'])) { 01837 $this->elements[$type]['extensionBase'] = $etype['extensionBase']; 01838 } 01839 } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') { 01840 $this->xdebug("in getTypeDef, element $type is an XSD type"); 01841 $this->elements[$type]['phpType'] = 'scalar'; 01842 } 01843 } 01844 return $this->elements[$type]; 01845 } elseif(isset($this->attributes[$type])){ 01846 $this->xdebug("in getTypeDef, found attribute $type"); 01847 return $this->attributes[$type]; 01848 } elseif (ereg('_ContainedType$', $type)) { 01849 $this->xdebug("in getTypeDef, have an untyped element $type"); 01850 $typeDef['typeClass'] = 'simpleType'; 01851 $typeDef['phpType'] = 'scalar'; 01852 $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string'; 01853 return $typeDef; 01854 } 01855 $this->xdebug("in getTypeDef, did not find $type"); 01856 return false; 01857 }
nusoap_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.
string | $type |
Definiert in Zeile 710 der Datei class.xmlschema.php.
00710 { 00711 //$this->debug("in getTypeDef for type $type"); 00712 if (substr($type, -1) == '^') { 00713 $is_element = 1; 00714 $type = substr($type, 0, -1); 00715 } else { 00716 $is_element = 0; 00717 } 00718 00719 if((! $is_element) && isset($this->complexTypes[$type])){ 00720 $this->xdebug("in getTypeDef, found complexType $type"); 00721 return $this->complexTypes[$type]; 00722 } elseif((! $is_element) && isset($this->simpleTypes[$type])){ 00723 $this->xdebug("in getTypeDef, found simpleType $type"); 00724 if (!isset($this->simpleTypes[$type]['phpType'])) { 00725 // get info for type to tack onto the simple type 00726 // TODO: can this ever really apply (i.e. what is a simpleType really?) 00727 $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1); 00728 $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')); 00729 $etype = $this->getTypeDef($uqType); 00730 if ($etype) { 00731 $this->xdebug("in getTypeDef, found type for simpleType $type:"); 00732 $this->xdebug($this->varDump($etype)); 00733 if (isset($etype['phpType'])) { 00734 $this->simpleTypes[$type]['phpType'] = $etype['phpType']; 00735 } 00736 if (isset($etype['elements'])) { 00737 $this->simpleTypes[$type]['elements'] = $etype['elements']; 00738 } 00739 } 00740 } 00741 return $this->simpleTypes[$type]; 00742 } elseif(isset($this->elements[$type])){ 00743 $this->xdebug("in getTypeDef, found element $type"); 00744 if (!isset($this->elements[$type]['phpType'])) { 00745 // get info for type to tack onto the element 00746 $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1); 00747 $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':')); 00748 $etype = $this->getTypeDef($uqType); 00749 if ($etype) { 00750 $this->xdebug("in getTypeDef, found type for element $type:"); 00751 $this->xdebug($this->varDump($etype)); 00752 if (isset($etype['phpType'])) { 00753 $this->elements[$type]['phpType'] = $etype['phpType']; 00754 } 00755 if (isset($etype['elements'])) { 00756 $this->elements[$type]['elements'] = $etype['elements']; 00757 } 00758 if (isset($etype['extensionBase'])) { 00759 $this->elements[$type]['extensionBase'] = $etype['extensionBase']; 00760 } 00761 } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') { 00762 $this->xdebug("in getTypeDef, element $type is an XSD type"); 00763 $this->elements[$type]['phpType'] = 'scalar'; 00764 } 00765 } 00766 return $this->elements[$type]; 00767 } elseif(isset($this->attributes[$type])){ 00768 $this->xdebug("in getTypeDef, found attribute $type"); 00769 return $this->attributes[$type]; 00770 } elseif (ereg('_ContainedType$', $type)) { 00771 $this->xdebug("in getTypeDef, have an untyped element $type"); 00772 $typeDef['typeClass'] = 'simpleType'; 00773 $typeDef['phpType'] = 'scalar'; 00774 $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string'; 00775 return $typeDef; 00776 } 00777 $this->xdebug("in getTypeDef, did not find $type"); 00778 return false; 00779 }
nusoap_xmlschema::nusoap_xmlschema | ( | $ | schema = '' , |
|
$ | xml = '' , |
|||
$ | namespaces = array() | |||
) |
constructor
string | $schema schema document URI | |
string | $xml xml document URI | |
string | $namespaces namespaces defined in enclosing XML public |
Definiert in Zeile 1132 der Datei nusoap.php.
01132 { 01133 parent::nusoap_base(); 01134 $this->debug('nusoap_xmlschema class instantiated, inside constructor'); 01135 // files 01136 $this->schema = $schema; 01137 $this->xml = $xml; 01138 01139 // namespaces 01140 $this->enclosingNamespaces = $namespaces; 01141 $this->namespaces = array_merge($this->namespaces, $namespaces); 01142 01143 // parse schema file 01144 if($schema != ''){ 01145 $this->debug('initial schema file: '.$schema); 01146 $this->parseFile($schema, 'schema'); 01147 } 01148 01149 // parse xml file 01150 if($xml != ''){ 01151 $this->debug('initial xml file: '.$xml); 01152 $this->parseFile($xml, 'xml'); 01153 } 01154 01155 }
nusoap_xmlschema::nusoap_xmlschema | ( | $ | schema = '' , |
|
$ | xml = '' , |
|||
$ | namespaces = array() | |||
) |
constructor
string | $schema schema document URI | |
string | $xml xml document URI | |
string | $namespaces namespaces defined in enclosing XML public |
Definiert in Zeile 54 der Datei class.xmlschema.php.
00054 { 00055 parent::nusoap_base(); 00056 $this->debug('nusoap_xmlschema class instantiated, inside constructor'); 00057 // files 00058 $this->schema = $schema; 00059 $this->xml = $xml; 00060 00061 // namespaces 00062 $this->enclosingNamespaces = $namespaces; 00063 $this->namespaces = array_merge($this->namespaces, $namespaces); 00064 00065 // parse schema file 00066 if($schema != ''){ 00067 $this->debug('initial schema file: '.$schema); 00068 $this->parseFile($schema, 'schema'); 00069 } 00070 00071 // parse xml file 00072 if($xml != ''){ 00073 $this->debug('initial xml file: '.$xml); 00074 $this->parseFile($xml, 'xml'); 00075 } 00076 00077 }
nusoap_xmlschema::parseFile | ( | $ | xml, | |
$ | type | |||
) |
parse an XML file
string | $xml path/URL to XML file | |
string | $type (schema | xml) |
Definiert in Zeile 1165 der Datei nusoap.php.
01165 { 01166 // parse xml file 01167 if($xml != ""){ 01168 $xmlStr = @join("",@file($xml)); 01169 if($xmlStr == ""){ 01170 $msg = 'Error reading XML from '.$xml; 01171 $this->setError($msg); 01172 $this->debug($msg); 01173 return false; 01174 } else { 01175 $this->debug("parsing $xml"); 01176 $this->parseString($xmlStr,$type); 01177 $this->debug("done parsing $xml"); 01178 return true; 01179 } 01180 } 01181 return false; 01182 }
nusoap_xmlschema::parseFile | ( | $ | xml, | |
$ | type | |||
) |
parse an XML file
string | $xml path/URL to XML file | |
string | $type (schema | xml) |
Definiert in Zeile 87 der Datei class.xmlschema.php.
00087 { 00088 // parse xml file 00089 if($xml != ""){ 00090 $xmlStr = @join("",@file($xml)); 00091 if($xmlStr == ""){ 00092 $msg = 'Error reading XML from '.$xml; 00093 $this->setError($msg); 00094 $this->debug($msg); 00095 return false; 00096 } else { 00097 $this->debug("parsing $xml"); 00098 $this->parseString($xmlStr,$type); 00099 $this->debug("done parsing $xml"); 00100 return true; 00101 } 00102 } 00103 return false; 00104 }
nusoap_xmlschema::parseString | ( | $ | xml, | |
$ | type | |||
) |
parse an XML string
string | $xml path or URL | |
string | $type (schema|xml) private |
Definiert in Zeile 1191 der Datei nusoap.php.
01191 { 01192 // parse xml string 01193 if($xml != ""){ 01194 01195 // Create an XML parser. 01196 $this->parser = xml_parser_create(); 01197 // Set the options for parsing the XML data. 01198 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); 01199 01200 // Set the object for the parser. 01201 xml_set_object($this->parser, $this); 01202 01203 // Set the element handlers for the parser. 01204 if($type == "schema"){ 01205 xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement'); 01206 xml_set_character_data_handler($this->parser,'schemaCharacterData'); 01207 } elseif($type == "xml"){ 01208 xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement'); 01209 xml_set_character_data_handler($this->parser,'xmlCharacterData'); 01210 } 01211 01212 // Parse the XML file. 01213 if(!xml_parse($this->parser,$xml,true)){ 01214 // Display an error message. 01215 $errstr = sprintf('XML error parsing XML schema on line %d: %s', 01216 xml_get_current_line_number($this->parser), 01217 xml_error_string(xml_get_error_code($this->parser)) 01218 ); 01219 $this->debug($errstr); 01220 $this->debug("XML payload:\n" . $xml); 01221 $this->setError($errstr); 01222 } 01223 01224 xml_parser_free($this->parser); 01225 } else{ 01226 $this->debug('no xml passed to parseString()!!'); 01227 $this->setError('no xml passed to parseString()!!'); 01228 } 01229 }
nusoap_xmlschema::parseString | ( | $ | xml, | |
$ | type | |||
) |
parse an XML string
string | $xml path or URL | |
string | $type (schema|xml) private |
Definiert in Zeile 113 der Datei class.xmlschema.php.
00113 { 00114 // parse xml string 00115 if($xml != ""){ 00116 00117 // Create an XML parser. 00118 $this->parser = xml_parser_create(); 00119 // Set the options for parsing the XML data. 00120 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); 00121 00122 // Set the object for the parser. 00123 xml_set_object($this->parser, $this); 00124 00125 // Set the element handlers for the parser. 00126 if($type == "schema"){ 00127 xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement'); 00128 xml_set_character_data_handler($this->parser,'schemaCharacterData'); 00129 } elseif($type == "xml"){ 00130 xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement'); 00131 xml_set_character_data_handler($this->parser,'xmlCharacterData'); 00132 } 00133 00134 // Parse the XML file. 00135 if(!xml_parse($this->parser,$xml,true)){ 00136 // Display an error message. 00137 $errstr = sprintf('XML error parsing XML schema on line %d: %s', 00138 xml_get_current_line_number($this->parser), 00139 xml_error_string(xml_get_error_code($this->parser)) 00140 ); 00141 $this->debug($errstr); 00142 $this->debug("XML payload:\n" . $xml); 00143 $this->setError($errstr); 00144 } 00145 00146 xml_parser_free($this->parser); 00147 } else{ 00148 $this->debug('no xml passed to parseString()!!'); 00149 $this->setError('no xml passed to parseString()!!'); 00150 } 00151 }
nusoap_xmlschema::schemaCharacterData | ( | $ | parser, | |
$ | data | |||
) |
element content handler
string | $parser XML parser object | |
string | $data element content private |
Definiert in Zeile 1611 der Datei nusoap.php.
01611 { 01612 $pos = $this->depth_array[$this->depth - 1]; 01613 $this->message[$pos]['cdata'] .= $data; 01614 }
nusoap_xmlschema::schemaCharacterData | ( | $ | parser, | |
$ | data | |||
) |
element content handler
string | $parser XML parser object | |
string | $data element content private |
Definiert in Zeile 533 der Datei class.xmlschema.php.
00533 { 00534 $pos = $this->depth_array[$this->depth - 1]; 00535 $this->message[$pos]['cdata'] .= $data; 00536 }
nusoap_xmlschema::schemaEndElement | ( | $ | parser, | |
$ | name | |||
) |
end-element handler
string | $parser XML parser object | |
string | $name element name private |
Definiert in Zeile 1574 der Datei nusoap.php.
01574 { 01575 // bring depth down a notch 01576 $this->depth--; 01577 // position of current element is equal to the last value left in depth_array for my depth 01578 if(isset($this->depth_array[$this->depth])){ 01579 $pos = $this->depth_array[$this->depth]; 01580 } 01581 // get element prefix 01582 if ($prefix = $this->getPrefix($name)){ 01583 // get unqualified name 01584 $name = $this->getLocalPart($name); 01585 } else { 01586 $prefix = ''; 01587 } 01588 // move on... 01589 if($name == 'complexType'){ 01590 $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)')); 01591 $this->currentComplexType = array_pop($this->complexTypeStack); 01592 //$this->currentElement = false; 01593 } 01594 if($name == 'element'){ 01595 $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)')); 01596 $this->currentElement = array_pop($this->elementStack); 01597 } 01598 if($name == 'simpleType'){ 01599 $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)')); 01600 $this->currentSimpleType = array_pop($this->simpleTypeStack); 01601 } 01602 }
nusoap_xmlschema::schemaEndElement | ( | $ | parser, | |
$ | name | |||
) |
end-element handler
string | $parser XML parser object | |
string | $name element name private |
Definiert in Zeile 496 der Datei class.xmlschema.php.
00496 { 00497 // bring depth down a notch 00498 $this->depth--; 00499 // position of current element is equal to the last value left in depth_array for my depth 00500 if(isset($this->depth_array[$this->depth])){ 00501 $pos = $this->depth_array[$this->depth]; 00502 } 00503 // get element prefix 00504 if ($prefix = $this->getPrefix($name)){ 00505 // get unqualified name 00506 $name = $this->getLocalPart($name); 00507 } else { 00508 $prefix = ''; 00509 } 00510 // move on... 00511 if($name == 'complexType'){ 00512 $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)')); 00513 $this->currentComplexType = array_pop($this->complexTypeStack); 00514 //$this->currentElement = false; 00515 } 00516 if($name == 'element'){ 00517 $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)')); 00518 $this->currentElement = array_pop($this->elementStack); 00519 } 00520 if($name == 'simpleType'){ 00521 $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)')); 00522 $this->currentSimpleType = array_pop($this->simpleTypeStack); 00523 } 00524 }
nusoap_xmlschema::schemaStartElement | ( | $ | parser, | |
$ | name, | |||
$ | attrs | |||
) |
start-element handler
string | $parser XML parser object | |
string | $name element name | |
string | $attrs associative array of attributes private |
Definiert in Zeile 1254 der Datei nusoap.php.
01254 { 01255 01256 // position in the total number of elements, starting from 0 01257 $pos = $this->position++; 01258 $depth = $this->depth++; 01259 // set self as current value for this depth 01260 $this->depth_array[$depth] = $pos; 01261 $this->message[$pos] = array('cdata' => ''); 01262 if ($depth > 0) { 01263 $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]]; 01264 } else { 01265 $this->defaultNamespace[$pos] = false; 01266 } 01267 01268 // get element prefix 01269 if($prefix = $this->getPrefix($name)){ 01270 // get unqualified name 01271 $name = $this->getLocalPart($name); 01272 } else { 01273 $prefix = ''; 01274 } 01275 01276 // loop thru attributes, expanding, and registering namespace declarations 01277 if(count($attrs) > 0){ 01278 foreach($attrs as $k => $v){ 01279 // if ns declarations, add to class level array of valid namespaces 01280 if(ereg("^xmlns",$k)){ 01281 //$this->xdebug("$k: $v"); 01282 //$this->xdebug('ns_prefix: '.$this->getPrefix($k)); 01283 if($ns_prefix = substr(strrchr($k,':'),1)){ 01284 //$this->xdebug("Add namespace[$ns_prefix] = $v"); 01285 $this->namespaces[$ns_prefix] = $v; 01286 } else { 01287 $this->defaultNamespace[$pos] = $v; 01288 if (! $this->getPrefixFromNamespace($v)) { 01289 $this->namespaces['ns'.(count($this->namespaces)+1)] = $v; 01290 } 01291 } 01292 if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){ 01293 $this->XMLSchemaVersion = $v; 01294 $this->namespaces['xsi'] = $v.'-instance'; 01295 } 01296 } 01297 } 01298 foreach($attrs as $k => $v){ 01299 // expand each attribute 01300 $k = strpos($k,':') ? $this->expandQname($k) : $k; 01301 $v = strpos($v,':') ? $this->expandQname($v) : $v; 01302 $eAttrs[$k] = $v; 01303 } 01304 $attrs = $eAttrs; 01305 } else { 01306 $attrs = array(); 01307 } 01308 // find status, register data 01309 switch($name){ 01310 case 'all': // (optional) compositor content for a complexType 01311 case 'choice': 01312 case 'group': 01313 case 'sequence': 01314 //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement"); 01315 $this->complexTypes[$this->currentComplexType]['compositor'] = $name; 01316 //if($name == 'all' || $name == 'sequence'){ 01317 // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; 01318 //} 01319 break; 01320 case 'attribute': // complexType attribute 01321 //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']); 01322 $this->xdebug("parsing attribute:"); 01323 $this->appendDebug($this->varDump($attrs)); 01324 if (!isset($attrs['form'])) { 01325 // TODO: handle globals 01326 $attrs['form'] = $this->schemaInfo['attributeFormDefault']; 01327 } 01328 if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { 01329 $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; 01330 if (!strpos($v, ':')) { 01331 // no namespace in arrayType attribute value... 01332 if ($this->defaultNamespace[$pos]) { 01333 // ...so use the default 01334 $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; 01335 } 01336 } 01337 } 01338 if(isset($attrs['name'])){ 01339 $this->attributes[$attrs['name']] = $attrs; 01340 $aname = $attrs['name']; 01341 } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){ 01342 if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { 01343 $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; 01344 } else { 01345 $aname = ''; 01346 } 01347 } elseif(isset($attrs['ref'])){ 01348 $aname = $attrs['ref']; 01349 $this->attributes[$attrs['ref']] = $attrs; 01350 } 01351 01352 if($this->currentComplexType){ // This should *always* be 01353 $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs; 01354 } 01355 // arrayType attribute 01356 if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){ 01357 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; 01358 $prefix = $this->getPrefix($aname); 01359 if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){ 01360 $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; 01361 } else { 01362 $v = ''; 01363 } 01364 if(strpos($v,'[,]')){ 01365 $this->complexTypes[$this->currentComplexType]['multidimensional'] = true; 01366 } 01367 $v = substr($v,0,strpos($v,'[')); // clip the [] 01368 if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){ 01369 $v = $this->XMLSchemaVersion.':'.$v; 01370 } 01371 $this->complexTypes[$this->currentComplexType]['arrayType'] = $v; 01372 } 01373 break; 01374 case 'complexContent': // (optional) content for a complexType 01375 $this->xdebug("do nothing for element $name"); 01376 break; 01377 case 'complexType': 01378 array_push($this->complexTypeStack, $this->currentComplexType); 01379 if(isset($attrs['name'])){ 01380 // TODO: what is the scope of named complexTypes that appear 01381 // nested within other c complexTypes? 01382 $this->xdebug('processing named complexType '.$attrs['name']); 01383 //$this->currentElement = false; 01384 $this->currentComplexType = $attrs['name']; 01385 $this->complexTypes[$this->currentComplexType] = $attrs; 01386 $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; 01387 // This is for constructs like 01388 // <complexType name="ListOfString" base="soap:Array"> 01389 // <sequence> 01390 // <element name="string" type="xsd:string" 01391 // minOccurs="0" maxOccurs="unbounded" /> 01392 // </sequence> 01393 // </complexType> 01394 if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){ 01395 $this->xdebug('complexType is unusual array'); 01396 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; 01397 } else { 01398 $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; 01399 } 01400 } else { 01401 $name = $this->CreateTypeName($this->currentElement); 01402 $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name); 01403 $this->currentComplexType = $name; 01404 //$this->currentElement = false; 01405 $this->complexTypes[$this->currentComplexType] = $attrs; 01406 $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; 01407 // This is for constructs like 01408 // <complexType name="ListOfString" base="soap:Array"> 01409 // <sequence> 01410 // <element name="string" type="xsd:string" 01411 // minOccurs="0" maxOccurs="unbounded" /> 01412 // </sequence> 01413 // </complexType> 01414 if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){ 01415 $this->xdebug('complexType is unusual array'); 01416 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; 01417 } else { 01418 $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; 01419 } 01420 } 01421 break; 01422 case 'element': 01423 array_push($this->elementStack, $this->currentElement); 01424 if (!isset($attrs['form'])) { 01425 if ($this->currentComplexType) { 01426 $attrs['form'] = $this->schemaInfo['elementFormDefault']; 01427 } else { 01428 // global 01429 $attrs['form'] = 'qualified'; 01430 } 01431 } 01432 if(isset($attrs['type'])){ 01433 $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']); 01434 if (! $this->getPrefix($attrs['type'])) { 01435 if ($this->defaultNamespace[$pos]) { 01436 $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type']; 01437 $this->xdebug('used default namespace to make type ' . $attrs['type']); 01438 } 01439 } 01440 // This is for constructs like 01441 // <complexType name="ListOfString" base="soap:Array"> 01442 // <sequence> 01443 // <element name="string" type="xsd:string" 01444 // minOccurs="0" maxOccurs="unbounded" /> 01445 // </sequence> 01446 // </complexType> 01447 if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') { 01448 $this->xdebug('arrayType for unusual array is ' . $attrs['type']); 01449 $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type']; 01450 } 01451 $this->currentElement = $attrs['name']; 01452 $ename = $attrs['name']; 01453 } elseif(isset($attrs['ref'])){ 01454 $this->xdebug("processing element as ref to ".$attrs['ref']); 01455 $this->currentElement = "ref to ".$attrs['ref']; 01456 $ename = $this->getLocalPart($attrs['ref']); 01457 } else { 01458 $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']); 01459 $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type); 01460 $this->currentElement = $attrs['name']; 01461 $attrs['type'] = $this->schemaTargetNamespace . ':' . $type; 01462 $ename = $attrs['name']; 01463 } 01464 if (isset($ename) && $this->currentComplexType) { 01465 $this->xdebug("add element $ename to complexType $this->currentComplexType"); 01466 $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs; 01467 } elseif (!isset($attrs['ref'])) { 01468 $this->xdebug("add element $ename to elements array"); 01469 $this->elements[ $attrs['name'] ] = $attrs; 01470 $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; 01471 } 01472 break; 01473 case 'enumeration': // restriction value list member 01474 $this->xdebug('enumeration ' . $attrs['value']); 01475 if ($this->currentSimpleType) { 01476 $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value']; 01477 } elseif ($this->currentComplexType) { 01478 $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value']; 01479 } 01480 break; 01481 case 'extension': // simpleContent or complexContent type extension 01482 $this->xdebug('extension ' . $attrs['base']); 01483 if ($this->currentComplexType) { 01484 $ns = $this->getPrefix($attrs['base']); 01485 if ($ns == '') { 01486 $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base']; 01487 } elseif ($this->getNamespaceFromPrefix($ns)) { 01488 $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base']; 01489 } 01490 } 01491 break; 01492 case 'import': 01493 if (isset($attrs['schemaLocation'])) { 01494 $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']); 01495 $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); 01496 } else { 01497 $this->xdebug('import namespace ' . $attrs['namespace']); 01498 $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true); 01499 if (! $this->getPrefixFromNamespace($attrs['namespace'])) { 01500 $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; 01501 } 01502 } 01503 break; 01504 case 'include': 01505 if (isset($attrs['schemaLocation'])) { 01506 $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']); 01507 $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); 01508 } else { 01509 $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute'); 01510 } 01511 break; 01512 case 'list': // simpleType value list 01513 $this->xdebug("do nothing for element $name"); 01514 break; 01515 case 'restriction': // simpleType, simpleContent or complexContent value restriction 01516 $this->xdebug('restriction ' . $attrs['base']); 01517 if($this->currentSimpleType){ 01518 $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base']; 01519 } elseif($this->currentComplexType){ 01520 $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base']; 01521 if(strstr($attrs['base'],':') == ':Array'){ 01522 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; 01523 } 01524 } 01525 break; 01526 case 'schema': 01527 $this->schemaInfo = $attrs; 01528 $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix); 01529 if (isset($attrs['targetNamespace'])) { 01530 $this->schemaTargetNamespace = $attrs['targetNamespace']; 01531 } 01532 if (!isset($attrs['elementFormDefault'])) { 01533 $this->schemaInfo['elementFormDefault'] = 'unqualified'; 01534 } 01535 if (!isset($attrs['attributeFormDefault'])) { 01536 $this->schemaInfo['attributeFormDefault'] = 'unqualified'; 01537 } 01538 break; 01539 case 'simpleContent': // (optional) content for a complexType 01540 $this->xdebug("do nothing for element $name"); 01541 break; 01542 case 'simpleType': 01543 array_push($this->simpleTypeStack, $this->currentSimpleType); 01544 if(isset($attrs['name'])){ 01545 $this->xdebug("processing simpleType for name " . $attrs['name']); 01546 $this->currentSimpleType = $attrs['name']; 01547 $this->simpleTypes[ $attrs['name'] ] = $attrs; 01548 $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType'; 01549 $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar'; 01550 } else { 01551 $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement); 01552 $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name); 01553 $this->currentSimpleType = $name; 01554 //$this->currentElement = false; 01555 $this->simpleTypes[$this->currentSimpleType] = $attrs; 01556 $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar'; 01557 } 01558 break; 01559 case 'union': // simpleType type list 01560 $this->xdebug("do nothing for element $name"); 01561 break; 01562 default: 01563 $this->xdebug("do not have any logic to process element $name"); 01564 } 01565 }
nusoap_xmlschema::schemaStartElement | ( | $ | parser, | |
$ | name, | |||
$ | attrs | |||
) |
start-element handler
string | $parser XML parser object | |
string | $name element name | |
string | $attrs associative array of attributes private |
Definiert in Zeile 176 der Datei class.xmlschema.php.
00176 { 00177 00178 // position in the total number of elements, starting from 0 00179 $pos = $this->position++; 00180 $depth = $this->depth++; 00181 // set self as current value for this depth 00182 $this->depth_array[$depth] = $pos; 00183 $this->message[$pos] = array('cdata' => ''); 00184 if ($depth > 0) { 00185 $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]]; 00186 } else { 00187 $this->defaultNamespace[$pos] = false; 00188 } 00189 00190 // get element prefix 00191 if($prefix = $this->getPrefix($name)){ 00192 // get unqualified name 00193 $name = $this->getLocalPart($name); 00194 } else { 00195 $prefix = ''; 00196 } 00197 00198 // loop thru attributes, expanding, and registering namespace declarations 00199 if(count($attrs) > 0){ 00200 foreach($attrs as $k => $v){ 00201 // if ns declarations, add to class level array of valid namespaces 00202 if(ereg("^xmlns",$k)){ 00203 //$this->xdebug("$k: $v"); 00204 //$this->xdebug('ns_prefix: '.$this->getPrefix($k)); 00205 if($ns_prefix = substr(strrchr($k,':'),1)){ 00206 //$this->xdebug("Add namespace[$ns_prefix] = $v"); 00207 $this->namespaces[$ns_prefix] = $v; 00208 } else { 00209 $this->defaultNamespace[$pos] = $v; 00210 if (! $this->getPrefixFromNamespace($v)) { 00211 $this->namespaces['ns'.(count($this->namespaces)+1)] = $v; 00212 } 00213 } 00214 if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){ 00215 $this->XMLSchemaVersion = $v; 00216 $this->namespaces['xsi'] = $v.'-instance'; 00217 } 00218 } 00219 } 00220 foreach($attrs as $k => $v){ 00221 // expand each attribute 00222 $k = strpos($k,':') ? $this->expandQname($k) : $k; 00223 $v = strpos($v,':') ? $this->expandQname($v) : $v; 00224 $eAttrs[$k] = $v; 00225 } 00226 $attrs = $eAttrs; 00227 } else { 00228 $attrs = array(); 00229 } 00230 // find status, register data 00231 switch($name){ 00232 case 'all': // (optional) compositor content for a complexType 00233 case 'choice': 00234 case 'group': 00235 case 'sequence': 00236 //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement"); 00237 $this->complexTypes[$this->currentComplexType]['compositor'] = $name; 00238 //if($name == 'all' || $name == 'sequence'){ 00239 // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; 00240 //} 00241 break; 00242 case 'attribute': // complexType attribute 00243 //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']); 00244 $this->xdebug("parsing attribute:"); 00245 $this->appendDebug($this->varDump($attrs)); 00246 if (!isset($attrs['form'])) { 00247 // TODO: handle globals 00248 $attrs['form'] = $this->schemaInfo['attributeFormDefault']; 00249 } 00250 if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { 00251 $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; 00252 if (!strpos($v, ':')) { 00253 // no namespace in arrayType attribute value... 00254 if ($this->defaultNamespace[$pos]) { 00255 // ...so use the default 00256 $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; 00257 } 00258 } 00259 } 00260 if(isset($attrs['name'])){ 00261 $this->attributes[$attrs['name']] = $attrs; 00262 $aname = $attrs['name']; 00263 } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){ 00264 if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { 00265 $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; 00266 } else { 00267 $aname = ''; 00268 } 00269 } elseif(isset($attrs['ref'])){ 00270 $aname = $attrs['ref']; 00271 $this->attributes[$attrs['ref']] = $attrs; 00272 } 00273 00274 if($this->currentComplexType){ // This should *always* be 00275 $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs; 00276 } 00277 // arrayType attribute 00278 if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){ 00279 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; 00280 $prefix = $this->getPrefix($aname); 00281 if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){ 00282 $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; 00283 } else { 00284 $v = ''; 00285 } 00286 if(strpos($v,'[,]')){ 00287 $this->complexTypes[$this->currentComplexType]['multidimensional'] = true; 00288 } 00289 $v = substr($v,0,strpos($v,'[')); // clip the [] 00290 if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){ 00291 $v = $this->XMLSchemaVersion.':'.$v; 00292 } 00293 $this->complexTypes[$this->currentComplexType]['arrayType'] = $v; 00294 } 00295 break; 00296 case 'complexContent': // (optional) content for a complexType 00297 $this->xdebug("do nothing for element $name"); 00298 break; 00299 case 'complexType': 00300 array_push($this->complexTypeStack, $this->currentComplexType); 00301 if(isset($attrs['name'])){ 00302 // TODO: what is the scope of named complexTypes that appear 00303 // nested within other c complexTypes? 00304 $this->xdebug('processing named complexType '.$attrs['name']); 00305 //$this->currentElement = false; 00306 $this->currentComplexType = $attrs['name']; 00307 $this->complexTypes[$this->currentComplexType] = $attrs; 00308 $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; 00309 // This is for constructs like 00310 // <complexType name="ListOfString" base="soap:Array"> 00311 // <sequence> 00312 // <element name="string" type="xsd:string" 00313 // minOccurs="0" maxOccurs="unbounded" /> 00314 // </sequence> 00315 // </complexType> 00316 if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){ 00317 $this->xdebug('complexType is unusual array'); 00318 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; 00319 } else { 00320 $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; 00321 } 00322 } else { 00323 $name = $this->CreateTypeName($this->currentElement); 00324 $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name); 00325 $this->currentComplexType = $name; 00326 //$this->currentElement = false; 00327 $this->complexTypes[$this->currentComplexType] = $attrs; 00328 $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; 00329 // This is for constructs like 00330 // <complexType name="ListOfString" base="soap:Array"> 00331 // <sequence> 00332 // <element name="string" type="xsd:string" 00333 // minOccurs="0" maxOccurs="unbounded" /> 00334 // </sequence> 00335 // </complexType> 00336 if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){ 00337 $this->xdebug('complexType is unusual array'); 00338 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; 00339 } else { 00340 $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; 00341 } 00342 } 00343 break; 00344 case 'element': 00345 array_push($this->elementStack, $this->currentElement); 00346 if (!isset($attrs['form'])) { 00347 if ($this->currentComplexType) { 00348 $attrs['form'] = $this->schemaInfo['elementFormDefault']; 00349 } else { 00350 // global 00351 $attrs['form'] = 'qualified'; 00352 } 00353 } 00354 if(isset($attrs['type'])){ 00355 $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']); 00356 if (! $this->getPrefix($attrs['type'])) { 00357 if ($this->defaultNamespace[$pos]) { 00358 $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type']; 00359 $this->xdebug('used default namespace to make type ' . $attrs['type']); 00360 } 00361 } 00362 // This is for constructs like 00363 // <complexType name="ListOfString" base="soap:Array"> 00364 // <sequence> 00365 // <element name="string" type="xsd:string" 00366 // minOccurs="0" maxOccurs="unbounded" /> 00367 // </sequence> 00368 // </complexType> 00369 if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') { 00370 $this->xdebug('arrayType for unusual array is ' . $attrs['type']); 00371 $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type']; 00372 } 00373 $this->currentElement = $attrs['name']; 00374 $ename = $attrs['name']; 00375 } elseif(isset($attrs['ref'])){ 00376 $this->xdebug("processing element as ref to ".$attrs['ref']); 00377 $this->currentElement = "ref to ".$attrs['ref']; 00378 $ename = $this->getLocalPart($attrs['ref']); 00379 } else { 00380 $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']); 00381 $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type); 00382 $this->currentElement = $attrs['name']; 00383 $attrs['type'] = $this->schemaTargetNamespace . ':' . $type; 00384 $ename = $attrs['name']; 00385 } 00386 if (isset($ename) && $this->currentComplexType) { 00387 $this->xdebug("add element $ename to complexType $this->currentComplexType"); 00388 $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs; 00389 } elseif (!isset($attrs['ref'])) { 00390 $this->xdebug("add element $ename to elements array"); 00391 $this->elements[ $attrs['name'] ] = $attrs; 00392 $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; 00393 } 00394 break; 00395 case 'enumeration': // restriction value list member 00396 $this->xdebug('enumeration ' . $attrs['value']); 00397 if ($this->currentSimpleType) { 00398 $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value']; 00399 } elseif ($this->currentComplexType) { 00400 $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value']; 00401 } 00402 break; 00403 case 'extension': // simpleContent or complexContent type extension 00404 $this->xdebug('extension ' . $attrs['base']); 00405 if ($this->currentComplexType) { 00406 $ns = $this->getPrefix($attrs['base']); 00407 if ($ns == '') { 00408 $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base']; 00409 } elseif ($this->getNamespaceFromPrefix($ns)) { 00410 $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base']; 00411 } 00412 } 00413 break; 00414 case 'import': 00415 if (isset($attrs['schemaLocation'])) { 00416 $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']); 00417 $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); 00418 } else { 00419 $this->xdebug('import namespace ' . $attrs['namespace']); 00420 $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true); 00421 if (! $this->getPrefixFromNamespace($attrs['namespace'])) { 00422 $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; 00423 } 00424 } 00425 break; 00426 case 'include': 00427 if (isset($attrs['schemaLocation'])) { 00428 $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']); 00429 $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); 00430 } else { 00431 $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute'); 00432 } 00433 break; 00434 case 'list': // simpleType value list 00435 $this->xdebug("do nothing for element $name"); 00436 break; 00437 case 'restriction': // simpleType, simpleContent or complexContent value restriction 00438 $this->xdebug('restriction ' . $attrs['base']); 00439 if($this->currentSimpleType){ 00440 $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base']; 00441 } elseif($this->currentComplexType){ 00442 $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base']; 00443 if(strstr($attrs['base'],':') == ':Array'){ 00444 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; 00445 } 00446 } 00447 break; 00448 case 'schema': 00449 $this->schemaInfo = $attrs; 00450 $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix); 00451 if (isset($attrs['targetNamespace'])) { 00452 $this->schemaTargetNamespace = $attrs['targetNamespace']; 00453 } 00454 if (!isset($attrs['elementFormDefault'])) { 00455 $this->schemaInfo['elementFormDefault'] = 'unqualified'; 00456 } 00457 if (!isset($attrs['attributeFormDefault'])) { 00458 $this->schemaInfo['attributeFormDefault'] = 'unqualified'; 00459 } 00460 break; 00461 case 'simpleContent': // (optional) content for a complexType 00462 $this->xdebug("do nothing for element $name"); 00463 break; 00464 case 'simpleType': 00465 array_push($this->simpleTypeStack, $this->currentSimpleType); 00466 if(isset($attrs['name'])){ 00467 $this->xdebug("processing simpleType for name " . $attrs['name']); 00468 $this->currentSimpleType = $attrs['name']; 00469 $this->simpleTypes[ $attrs['name'] ] = $attrs; 00470 $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType'; 00471 $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar'; 00472 } else { 00473 $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement); 00474 $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name); 00475 $this->currentSimpleType = $name; 00476 //$this->currentElement = false; 00477 $this->simpleTypes[$this->currentSimpleType] = $attrs; 00478 $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar'; 00479 } 00480 break; 00481 case 'union': // simpleType type list 00482 $this->xdebug("do nothing for element $name"); 00483 break; 00484 default: 00485 $this->xdebug("do not have any logic to process element $name"); 00486 } 00487 }
nusoap_xmlschema::serializeSchema | ( | ) |
serialize the schema
public
Definiert in Zeile 1621 der Datei nusoap.php.
01621 { 01622 01623 $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion); 01624 $xml = ''; 01625 // imports 01626 if (sizeof($this->imports) > 0) { 01627 foreach($this->imports as $ns => $list) { 01628 foreach ($list as $ii) { 01629 if ($ii['location'] != '') { 01630 $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n"; 01631 } else { 01632 $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n"; 01633 } 01634 } 01635 } 01636 } 01637 // complex types 01638 foreach($this->complexTypes as $typeName => $attrs){ 01639 $contentStr = ''; 01640 // serialize child elements 01641 if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){ 01642 foreach($attrs['elements'] as $element => $eParts){ 01643 if(isset($eParts['ref'])){ 01644 $contentStr .= " <$schemaPrefix:element ref=\"$element\"/>\n"; 01645 } else { 01646 $contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\""; 01647 foreach ($eParts as $aName => $aValue) { 01648 // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable 01649 if ($aName != 'name' && $aName != 'type') { 01650 $contentStr .= " $aName=\"$aValue\""; 01651 } 01652 } 01653 $contentStr .= "/>\n"; 01654 } 01655 } 01656 // compositor wraps elements 01657 if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) { 01658 $contentStr = " <$schemaPrefix:$attrs[compositor]>\n".$contentStr." </$schemaPrefix:$attrs[compositor]>\n"; 01659 } 01660 } 01661 // attributes 01662 if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){ 01663 foreach($attrs['attrs'] as $attr => $aParts){ 01664 $contentStr .= " <$schemaPrefix:attribute"; 01665 foreach ($aParts as $a => $v) { 01666 if ($a == 'ref' || $a == 'type') { 01667 $contentStr .= " $a=\"".$this->contractQName($v).'"'; 01668 } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') { 01669 $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl']; 01670 $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"'; 01671 } else { 01672 $contentStr .= " $a=\"$v\""; 01673 } 01674 } 01675 $contentStr .= "/>\n"; 01676 } 01677 } 01678 // if restriction 01679 if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){ 01680 $contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr." </$schemaPrefix:restriction>\n"; 01681 // complex or simple content 01682 if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){ 01683 $contentStr = " <$schemaPrefix:complexContent>\n".$contentStr." </$schemaPrefix:complexContent>\n"; 01684 } 01685 } 01686 // finalize complex type 01687 if($contentStr != ''){ 01688 $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." </$schemaPrefix:complexType>\n"; 01689 } else { 01690 $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n"; 01691 } 01692 $xml .= $contentStr; 01693 } 01694 // simple types 01695 if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){ 01696 foreach($this->simpleTypes as $typeName => $eParts){ 01697 $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n"; 01698 if (isset($eParts['enumeration'])) { 01699 foreach ($eParts['enumeration'] as $e) { 01700 $xml .= " <$schemaPrefix:enumeration value=\"$e\"/>\n"; 01701 } 01702 } 01703 $xml .= " </$schemaPrefix:restriction>\n </$schemaPrefix:simpleType>"; 01704 } 01705 } 01706 // elements 01707 if(isset($this->elements) && count($this->elements) > 0){ 01708 foreach($this->elements as $element => $eParts){ 01709 $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n"; 01710 } 01711 } 01712 // attributes 01713 if(isset($this->attributes) && count($this->attributes) > 0){ 01714 foreach($this->attributes as $attr => $aParts){ 01715 $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>"; 01716 } 01717 } 01718 // finish 'er up 01719 $attr = ''; 01720 foreach ($this->schemaInfo as $k => $v) { 01721 if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') { 01722 $attr .= " $k=\"$v\""; 01723 } 01724 } 01725 $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n"; 01726 foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) { 01727 $el .= " xmlns:$nsp=\"$ns\""; 01728 } 01729 $xml = $el . ">\n".$xml."</$schemaPrefix:schema>\n"; 01730 return $xml; 01731 }
nusoap_xmlschema::serializeSchema | ( | ) |
serialize the schema
public
Definiert in Zeile 543 der Datei class.xmlschema.php.
00543 { 00544 00545 $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion); 00546 $xml = ''; 00547 // imports 00548 if (sizeof($this->imports) > 0) { 00549 foreach($this->imports as $ns => $list) { 00550 foreach ($list as $ii) { 00551 if ($ii['location'] != '') { 00552 $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n"; 00553 } else { 00554 $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n"; 00555 } 00556 } 00557 } 00558 } 00559 // complex types 00560 foreach($this->complexTypes as $typeName => $attrs){ 00561 $contentStr = ''; 00562 // serialize child elements 00563 if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){ 00564 foreach($attrs['elements'] as $element => $eParts){ 00565 if(isset($eParts['ref'])){ 00566 $contentStr .= " <$schemaPrefix:element ref=\"$element\"/>\n"; 00567 } else { 00568 $contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\""; 00569 foreach ($eParts as $aName => $aValue) { 00570 // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable 00571 if ($aName != 'name' && $aName != 'type') { 00572 $contentStr .= " $aName=\"$aValue\""; 00573 } 00574 } 00575 $contentStr .= "/>\n"; 00576 } 00577 } 00578 // compositor wraps elements 00579 if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) { 00580 $contentStr = " <$schemaPrefix:$attrs[compositor]>\n".$contentStr." </$schemaPrefix:$attrs[compositor]>\n"; 00581 } 00582 } 00583 // attributes 00584 if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){ 00585 foreach($attrs['attrs'] as $attr => $aParts){ 00586 $contentStr .= " <$schemaPrefix:attribute"; 00587 foreach ($aParts as $a => $v) { 00588 if ($a == 'ref' || $a == 'type') { 00589 $contentStr .= " $a=\"".$this->contractQName($v).'"'; 00590 } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') { 00591 $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl']; 00592 $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"'; 00593 } else { 00594 $contentStr .= " $a=\"$v\""; 00595 } 00596 } 00597 $contentStr .= "/>\n"; 00598 } 00599 } 00600 // if restriction 00601 if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){ 00602 $contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr." </$schemaPrefix:restriction>\n"; 00603 // complex or simple content 00604 if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){ 00605 $contentStr = " <$schemaPrefix:complexContent>\n".$contentStr." </$schemaPrefix:complexContent>\n"; 00606 } 00607 } 00608 // finalize complex type 00609 if($contentStr != ''){ 00610 $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." </$schemaPrefix:complexType>\n"; 00611 } else { 00612 $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n"; 00613 } 00614 $xml .= $contentStr; 00615 } 00616 // simple types 00617 if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){ 00618 foreach($this->simpleTypes as $typeName => $eParts){ 00619 $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n"; 00620 if (isset($eParts['enumeration'])) { 00621 foreach ($eParts['enumeration'] as $e) { 00622 $xml .= " <$schemaPrefix:enumeration value=\"$e\"/>\n"; 00623 } 00624 } 00625 $xml .= " </$schemaPrefix:restriction>\n </$schemaPrefix:simpleType>"; 00626 } 00627 } 00628 // elements 00629 if(isset($this->elements) && count($this->elements) > 0){ 00630 foreach($this->elements as $element => $eParts){ 00631 $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n"; 00632 } 00633 } 00634 // attributes 00635 if(isset($this->attributes) && count($this->attributes) > 0){ 00636 foreach($this->attributes as $attr => $aParts){ 00637 $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>"; 00638 } 00639 } 00640 // finish 'er up 00641 $attr = ''; 00642 foreach ($this->schemaInfo as $k => $v) { 00643 if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') { 00644 $attr .= " $k=\"$v\""; 00645 } 00646 } 00647 $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n"; 00648 foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) { 00649 $el .= " xmlns:$nsp=\"$ns\""; 00650 } 00651 $xml = $el . ">\n".$xml."</$schemaPrefix:schema>\n"; 00652 return $xml; 00653 }
nusoap_xmlschema::serializeTypeDef | ( | $ | type | ) |
returns a sample serialization of a given type, or false if no type by the given name
string | $type name of type |
Definiert in Zeile 1867 der Datei nusoap.php.
01867 { 01868 //print "in sTD() for type $type<br>"; 01869 if($typeDef = $this->getTypeDef($type)){ 01870 $str .= '<'.$type; 01871 if(is_array($typeDef['attrs'])){ 01872 foreach($typeDef['attrs'] as $attName => $data){ 01873 $str .= " $attName=\"{type = ".$data['type']."}\""; 01874 } 01875 } 01876 $str .= " xmlns=\"".$this->schema['targetNamespace']."\""; 01877 if(count($typeDef['elements']) > 0){ 01878 $str .= ">"; 01879 foreach($typeDef['elements'] as $element => $eData){ 01880 $str .= $this->serializeTypeDef($element); 01881 } 01882 $str .= "</$type>"; 01883 } elseif($typeDef['typeClass'] == 'element') { 01884 $str .= "></$type>"; 01885 } else { 01886 $str .= "/>"; 01887 } 01888 return $str; 01889 } 01890 return false; 01891 }
nusoap_xmlschema::serializeTypeDef | ( | $ | type | ) |
returns a sample serialization of a given type, or false if no type by the given name
string | $type name of type |
Definiert in Zeile 789 der Datei class.xmlschema.php.
00789 { 00790 //print "in sTD() for type $type<br>"; 00791 if($typeDef = $this->getTypeDef($type)){ 00792 $str .= '<'.$type; 00793 if(is_array($typeDef['attrs'])){ 00794 foreach($typeDef['attrs'] as $attName => $data){ 00795 $str .= " $attName=\"{type = ".$data['type']."}\""; 00796 } 00797 } 00798 $str .= " xmlns=\"".$this->schema['targetNamespace']."\""; 00799 if(count($typeDef['elements']) > 0){ 00800 $str .= ">"; 00801 foreach($typeDef['elements'] as $element => $eData){ 00802 $str .= $this->serializeTypeDef($element); 00803 } 00804 $str .= "</$type>"; 00805 } elseif($typeDef['typeClass'] == 'element') { 00806 $str .= "></$type>"; 00807 } else { 00808 $str .= "/>"; 00809 } 00810 return $str; 00811 } 00812 return false; 00813 }
nusoap_xmlschema::typeToForm | ( | $ | name, | |
$ | type | |||
) |
returns HTML form elements that allow a user to enter values for creating an instance of the given type.
string | $name name for type instance | |
string | $type name of type |
Definiert in Zeile 1903 der Datei nusoap.php.
01903 { 01904 // get typedef 01905 if($typeDef = $this->getTypeDef($type)){ 01906 // if struct 01907 if($typeDef['phpType'] == 'struct'){ 01908 $buffer .= '<table>'; 01909 foreach($typeDef['elements'] as $child => $childDef){ 01910 $buffer .= " 01911 <tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td> 01912 <td><input type='text' name='parameters[".$name."][$childDef[name]]'></td></tr>"; 01913 } 01914 $buffer .= '</table>'; 01915 // if array 01916 } elseif($typeDef['phpType'] == 'array'){ 01917 $buffer .= '<table>'; 01918 for($i=0;$i < 3; $i++){ 01919 $buffer .= " 01920 <tr><td align='right'>array item (type: $typeDef[arrayType]):</td> 01921 <td><input type='text' name='parameters[".$name."][]'></td></tr>"; 01922 } 01923 $buffer .= '</table>'; 01924 // if scalar 01925 } else { 01926 $buffer .= "<input type='text' name='parameters[$name]'>"; 01927 } 01928 } else { 01929 $buffer .= "<input type='text' name='parameters[$name]'>"; 01930 } 01931 return $buffer; 01932 }
nusoap_xmlschema::typeToForm | ( | $ | name, | |
$ | type | |||
) |
returns HTML form elements that allow a user to enter values for creating an instance of the given type.
string | $name name for type instance | |
string | $type name of type |
Definiert in Zeile 825 der Datei class.xmlschema.php.
00825 { 00826 // get typedef 00827 if($typeDef = $this->getTypeDef($type)){ 00828 // if struct 00829 if($typeDef['phpType'] == 'struct'){ 00830 $buffer .= '<table>'; 00831 foreach($typeDef['elements'] as $child => $childDef){ 00832 $buffer .= " 00833 <tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td> 00834 <td><input type='text' name='parameters[".$name."][$childDef[name]]'></td></tr>"; 00835 } 00836 $buffer .= '</table>'; 00837 // if array 00838 } elseif($typeDef['phpType'] == 'array'){ 00839 $buffer .= '<table>'; 00840 for($i=0;$i < 3; $i++){ 00841 $buffer .= " 00842 <tr><td align='right'>array item (type: $typeDef[arrayType]):</td> 00843 <td><input type='text' name='parameters[".$name."][]'></td></tr>"; 00844 } 00845 $buffer .= '</table>'; 00846 // if scalar 00847 } else { 00848 $buffer .= "<input type='text' name='parameters[$name]'>"; 00849 } 00850 } else { 00851 $buffer .= "<input type='text' name='parameters[$name]'>"; 00852 } 00853 return $buffer; 00854 }
nusoap_xmlschema::xdebug | ( | $ | string | ) |
adds debug data to the clas level debug string
string | $string debug data private |
Definiert in Zeile 1739 der Datei nusoap.php.
01739 { 01740 $this->debug('<' . $this->schemaTargetNamespace . '> '.$string); 01741 }
nusoap_xmlschema::xdebug | ( | $ | string | ) |
adds debug data to the clas level debug string
string | $string debug data private |
Definiert in Zeile 661 der Datei class.xmlschema.php.
00661 { 00662 $this->debug('<' . $this->schemaTargetNamespace . '> '.$string); 00663 }
nusoap_xmlschema::$attributes = array() |
Definiert in Zeile 26 der Datei class.xmlschema.php.
nusoap_xmlschema::$complexTypes = array() |
Definiert in Zeile 27 der Datei class.xmlschema.php.
nusoap_xmlschema::$complexTypeStack = array() |
Definiert in Zeile 28 der Datei class.xmlschema.php.
nusoap_xmlschema::$currentComplexType = null |
Definiert in Zeile 29 der Datei class.xmlschema.php.
nusoap_xmlschema::$currentElement = null |
Definiert in Zeile 32 der Datei class.xmlschema.php.
nusoap_xmlschema::$currentSimpleType = null |
Definiert in Zeile 35 der Datei class.xmlschema.php.
nusoap_xmlschema::$defaultNamespace = array() |
Definiert in Zeile 44 der Datei class.xmlschema.php.
nusoap_xmlschema::$depth = 0 |
Definiert in Zeile 41 der Datei class.xmlschema.php.
nusoap_xmlschema::$depth_array = array() |
Definiert in Zeile 42 der Datei class.xmlschema.php.
nusoap_xmlschema::$elements = array() |
Definiert in Zeile 30 der Datei class.xmlschema.php.
nusoap_xmlschema::$elementStack = array() |
Definiert in Zeile 31 der Datei class.xmlschema.php.
nusoap_xmlschema::$enclosingNamespaces |
Definiert in Zeile 21 der Datei class.xmlschema.php.
nusoap_xmlschema::$imports = array() |
Definiert in Zeile 37 der Datei class.xmlschema.php.
nusoap_xmlschema::$message = array() |
Definiert in Zeile 43 der Datei class.xmlschema.php.
nusoap_xmlschema::$parser |
Definiert in Zeile 39 der Datei class.xmlschema.php.
nusoap_xmlschema::$position = 0 |
Definiert in Zeile 40 der Datei class.xmlschema.php.
nusoap_xmlschema::$schema = '' |
Definiert in Zeile 18 der Datei class.xmlschema.php.
nusoap_xmlschema::$schemaInfo = array() |
Definiert in Zeile 23 der Datei class.xmlschema.php.
nusoap_xmlschema::$schemaTargetNamespace = '' |
Definiert in Zeile 24 der Datei class.xmlschema.php.
nusoap_xmlschema::$simpleTypes = array() |
Definiert in Zeile 33 der Datei class.xmlschema.php.
nusoap_xmlschema::$simpleTypeStack = array() |
Definiert in Zeile 34 der Datei class.xmlschema.php.
nusoap_xmlschema::$xml = '' |
Definiert in Zeile 19 der Datei class.xmlschema.php.
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved. MyOOS [Shopsystem] is Free Software released under the GNU/GPL License. Webmaster: info@r23.de (Impressum) |
|