function XMLSchema::getTypeDef in Salesforce Suite 5
Same name in this branch
- 5 includes/nusoap.php \XMLSchema::getTypeDef()
- 5 includes/nusoap.orig.php \XMLSchema::getTypeDef()
Same name and namespace in other branches
- 5.2 includes/nusoap.php \XMLSchema::getTypeDef()
- 5.2 includes/nusoap.orig.php \XMLSchema::getTypeDef()
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.
@access public
Parameters
string:
Return value
mixed
See also
addComplexType
addSimpleType
addElement
4 calls to XMLSchema::getTypeDef()
- XMLSchema::serializeTypeDef in includes/
nusoap.php - returns a sample serialization of a given type, or false if no type by the given name
- XMLSchema::serializeTypeDef in includes/
nusoap.orig.php - returns a sample serialization of a given type, or false if no type by the given name
- XMLSchema::typeToForm in includes/
nusoap.php - returns HTML form elements that allow a user to enter values for creating an instance of the given type.
- XMLSchema::typeToForm in includes/
nusoap.orig.php - returns HTML form elements that allow a user to enter values for creating an instance of the given type.
File
- includes/
nusoap.orig.php, line 1647
Class
- XMLSchema
- 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,…
Code
function getTypeDef($type) {
//$this->debug("in getTypeDef for type $type");
if (isset($this->complexTypes[$type])) {
$this
->xdebug("in getTypeDef, found complexType {$type}");
return $this->complexTypes[$type];
}
elseif (isset($this->simpleTypes[$type])) {
$this
->xdebug("in getTypeDef, found simpleType {$type}");
if (!isset($this->simpleTypes[$type]['phpType'])) {
// get info for type to tack onto the simple type
// TODO: can this ever really apply (i.e. what is a simpleType really?)
$uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1);
$ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':'));
$etype = $this
->getTypeDef($uqType);
if ($etype) {
$this
->xdebug("in getTypeDef, found type for simpleType {$type}:");
$this
->xdebug($this
->varDump($etype));
if (isset($etype['phpType'])) {
$this->simpleTypes[$type]['phpType'] = $etype['phpType'];
}
if (isset($etype['elements'])) {
$this->simpleTypes[$type]['elements'] = $etype['elements'];
}
}
}
return $this->simpleTypes[$type];
}
elseif (isset($this->elements[$type])) {
$this
->xdebug("in getTypeDef, found element {$type}");
if (!isset($this->elements[$type]['phpType'])) {
// get info for type to tack onto the element
$uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1);
$ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':'));
$etype = $this
->getTypeDef($uqType);
if ($etype) {
$this
->xdebug("in getTypeDef, found type for element {$type}:");
$this
->xdebug($this
->varDump($etype));
if (isset($etype['phpType'])) {
$this->elements[$type]['phpType'] = $etype['phpType'];
}
if (isset($etype['elements'])) {
$this->elements[$type]['elements'] = $etype['elements'];
}
}
elseif ($ns == 'http://www.w3.org/2001/XMLSchema') {
$this
->xdebug("in getTypeDef, element {$type} is an XSD type");
$this->elements[$type]['phpType'] = 'scalar';
}
}
return $this->elements[$type];
}
elseif (isset($this->attributes[$type])) {
$this
->xdebug("in getTypeDef, found attribute {$type}");
return $this->attributes[$type];
}
elseif (ereg('_ContainedType$', $type)) {
$this
->xdebug("in getTypeDef, have an untyped element {$type}");
$typeDef['typeClass'] = 'simpleType';
$typeDef['phpType'] = 'scalar';
$typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string';
return $typeDef;
}
$this
->xdebug("in getTypeDef, did not find {$type}");
return false;
}