You are here

function XMLSchema::serializeTypeDef in Salesforce Suite 5

Same name in this branch
  1. 5 includes/nusoap.php \XMLSchema::serializeTypeDef()
  2. 5 includes/nusoap.orig.php \XMLSchema::serializeTypeDef()
Same name and namespace in other branches
  1. 5.2 includes/nusoap.php \XMLSchema::serializeTypeDef()
  2. 5.2 includes/nusoap.orig.php \XMLSchema::serializeTypeDef()

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

@access public

Parameters

string $type, name of type:

Return value

mixed

File

includes/nusoap.orig.php, line 1716

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 serializeTypeDef($type) {

  //print "in sTD() for type $type<br>";
  if ($typeDef = $this
    ->getTypeDef($type)) {
    $str .= '<' . $type;
    if (is_array($typeDef['attrs'])) {
      foreach ($attrs as $attName => $data) {
        $str .= " {$attName}=\"{type = " . $data['type'] . "}\"";
      }
    }
    $str .= " xmlns=\"" . $this->schema['targetNamespace'] . "\"";
    if (count($typeDef['elements']) > 0) {
      $str .= ">";
      foreach ($typeDef['elements'] as $element => $eData) {
        $str .= $this
          ->serializeTypeDef($element);
      }
      $str .= "</{$type}>";
    }
    elseif ($typeDef['typeClass'] == 'element') {
      $str .= "></{$type}>";
    }
    else {
      $str .= "/>";
    }
    return $str;
  }
  return false;
}