[ Index ]
 

Code source de nusoap 0.7.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/ -> class.xmlschema.php (sommaire)

(pas de description)

Poids: 906 lignes (34 kb)
Inclus ou requis: 2 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

XMLSchema:: (15 méthodes):
  XMLSchema()
  parseFile()
  parseString()
  schemaStartElement()
  schemaEndElement()
  schemaCharacterData()
  serializeSchema()
  xdebug()
  getPHPType()
  getTypeDef()
  serializeTypeDef()
  typeToForm()
  addComplexType()
  addSimpleType()
  addElement()


Classe: XMLSchema  - X-Ref

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, and just have a couple of trusty
tutorials I refer to :)

XMLSchema($schema='',$xml='',$namespaces=array()   X-Ref
constructor

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

parseFile($xml,$type)   X-Ref
parse an XML file

param: string $xml, path/URL to XML file
param: string $type, (schema | xml)
return: boolean

parseString($xml,$type)   X-Ref
parse an XML string

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

schemaStartElement($parser, $name, $attrs)   X-Ref
start-element handler

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

schemaEndElement($parser, $name)   X-Ref
end-element handler

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

schemaCharacterData($parser, $data)   X-Ref
element content handler

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

serializeSchema()   X-Ref
serialize the schema


xdebug($string)   X-Ref
adds debug data to the clas level debug string

param: string $string debug data

getPHPType($type,$ns)   X-Ref
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'

param: string $type, name of defined type
param: string $ns, namespace of type
return: mixed

getTypeDef($type)   X-Ref
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.

param: string
return: mixed

serializeTypeDef($type)   X-Ref
returns a sample serialization of a given type, or false if no type by the given name

param: string $type, name of type
return: mixed

typeToForm($name,$type)   X-Ref
returns HTML form elements that allow a user
to enter values for creating an instance of the given type.

param: string $name, name for type instance
param: string $type, name of type
return: string

addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array()   X-Ref
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')
);

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

addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()   X-Ref
adds a simple type to the schema

param: string $name
param: string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
param: string $typeClass (should always be simpleType)
param: string $phpType (should always be scalar)
param: array $enumeration array of values

addElement($attrs)   X-Ref
adds an element to the schema

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



Généré le : Mon Sep 10 13:53:24 2007 par Balluche grâce à PHPXref 0.7