default

# Class: Xsd2Php Source Location: /mikebevz/xsd2php/Xsd2Php.php
### Class Overview
    Common
       |
       --Xsd2Php
Generate PHP classes based on XSD schema #### Author(s): Mike Bevz <myb@mikebevz.com> #### Version: 0.0.1 | ### Variables $debug $importHeadNS $loadedImportFiles $nspace $shortNamespaces $targetNamespace $xmlForPhp $xmlSource $xpath $xsdFile $xsdNs | ### Methods __construct expandNS getNamespaces getPHP getTargetNS getXML getXmlForPhp getXmlSource loadImports loadIncludes namespaceToPath namespaceToPhp saveClasses savePhpFiles setXmlForPhp setXmlSource
### Inherited Variables #### Class: Common Common::$basicTypes Common::$dom Common::$lastNsKey Common::$namespaces Common::$phpTypes Common::$reservedWords | ### Inherited Methods #### Class: Common Common::getDocNamespaces() Common::getNsCode() Common::isQName() Common::normalizeType() Convert XMLSchema data type to PHP data type Common::parseDocComments() Parse Doc comments Common::parseParamDocs() Common::parseQName() Common::parseReturnDocs() Common::phpTypeToSoap() Common::resolveNamespace() Resolve short namespace to long, or return the same code if not found Common::urnToPhpName()
### Class Details [line 30] Generate PHP classes based on XSD schema #### Tags:
author: | Mike Bevz <myb@mikebevz.com>
version: | 0.0.1
[ Top ] ### Class Variables #### $debug = false [line 62] Show debug info #### Tags:
access: | public
Type: | boolean
Overrides: | Array
[ Top ] #### $importHeadNS = array() [line 88] #### Tags:
access: | private
Type: | mixed
[ Top ] #### $loadedImportFiles = array() [line 86] Already processed imports #### Tags:
access: | private
Type: | array
[ Top ] #### $nspace = [line 50] Namespaces in the current xsd schema #### Tags:
access: | private
Type: | array
[ Top ] #### $shortNamespaces = [line 70] Namespaces = array (className => namespace ), used in dirs/files generation #### Tags:
access: | private
Type: | array
[ Top ] #### $targetNamespace = [line 74] #### Tags:
access: | private
Type: | mixed
[ Top ] #### $xmlForPhp = [line 56] XML file suitable for PHP code generation #### Tags:
access: | private
Type: | string
[ Top ] #### $xmlSource = [line 72] #### Tags:
access: | private
Type: | mixed
[ Top ] #### $xpath = [line 44] #### Tags:
access: | private
Type: | DOMXPath
[ Top ] #### $xsdFile = [line 36] XSD schema to convert from #### Tags:
access: | private
Type: | String
[ Top ] #### $xsdNs = [line 80] XSD root namespace alias (fx, xsd = http://www.w3.org/2001/XMLSchema) #### Tags:
access: | private
Type: | string
[ Top ] ### Class Methods ### constructor __construct [line 115]
`void __construct( string $xsdFile, [ $debug = false])`
#### Tags:
access: | public
#### Parameters:
string | $xsdFile | Xsd file to convert
| $debug |
[ Top ] ### method expandNS [line 577]
`string expandNS( string $ns)`
Resolve short namespace #### Tags:
access: | private
#### Parameters:
string | $ns | Short namespace
[ Top ] ### method getNamespaces [line 163]
`array getNamespaces( DOMXPath $xpath)`
Return array of namespaces of the docuemtn #### Tags:
access: | public
#### Parameters:
DOMXPath | $xpath |
[ Top ] ### method getPHP [line 430]
`string getPHP( )`
Return generated PHP source code #### Tags:
access: | private
[ Top ] ### method getTargetNS [line 146]
`void getTargetNS( $xpath)`
#### Tags:
access: | private
#### Parameters:
| $xpath |
[ Top ] ### method getXML [line 367]
`string getXML( )`
Convert XSD to XML suitable for further processing #### Tags:
return: | XML string
access: | public
[ Top ] ### method getXmlForPhp [line 347]
`string getXmlForPhp( )`
Convert XSD to XML suitable for PHP code generation #### Tags:
access: | public
[ Top ] ### method getXmlSource [line 95]
`string getXmlSource( )`
XSD schema converted to XML #### Tags:
access: | public
[ Top ] ### method loadImports [line 208]
`void loadImports( DOMDocument $dom, [string $xsdFile = ''])`
#### Tags:
access: | public
#### Parameters:
DOMDocument | $dom | DOM model of the schema
string | $xsdFile | Full path to first XSD Schema
[ Top ] ### method loadIncludes [line 284]
`void loadIncludes( $dom, [ $filepath = ''], [ $namespace = ''])`
#### Tags:
access: | public
#### Parameters:
| $dom |
| $filepath |
| $namespace |
[ Top ] ### method namespaceToPath [line 637]
`string namespaceToPath( string $xmlNS)`
Convert XML URI to Path #### Tags:
access: | private
#### Parameters:
string | $xmlNS | XML URI
[ Top ] ### method namespaceToPhp [line 597]
`string namespaceToPhp( string $xmlNS)`
Convert XML URI to PHP complient namespace #### Tags:
access: | private
#### Parameters:
string | $xmlNS | XML URI
[ Top ] ### method saveClasses [line 195]
`void saveClasses( string $dir, boolean $createDirectory)`
Save generated classes to directory #### Tags:
access: | public
#### Parameters:
string | $dir | Directory to save classes to
boolean | $createDirectory | Create directory, false by default
[ Top ] ### method savePhpFiles [line 401]
`void savePhpFiles( string $dir, [ $createDirectory = false])`
Save PHP files to directory structure #### Tags:
throws: | RuntimeException if given directory does not exist
access: | private
#### Parameters:
string | $dir | Directory to save files to
| $createDirectory |
[ Top ] ### method setXmlForPhp [line 357]
`void setXmlForPhp( string $xmlForPhp)`
#### Tags:
access: | public
#### Parameters:
string | $xmlForPhp | XML
[ Top ] ### method setXmlSource [line 104]
`void setXmlSource( string $xmlSource)`
#### Tags:
access: | public
#### Parameters:
string | $xmlSource | XML Source
[ Top ] Documentation generated on Tue, 01 Feb 2011 22:29:30 +0100 by phpDocumentor 1.4.3