Changeset 12822
- Timestamp:
- 11/09/08 13:04:25 (5 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/ckWebServicePlugin/branches/ckWsdlGenerator/xsd/ckXsdArrayType.class.php
r12818 r12822 17 17 * @author Christian Kerl <christian-kerl@web.de> 18 18 */ 19 class ckXsdArrayType extends ckXsd Type19 class ckXsdArrayType extends ckXsdComplexType 20 20 { 21 /**22 * The name of the root node of the xml representation.23 */24 const ELEMENT_NAME = 'complexType';25 26 21 /** 27 22 * The suffix of a type name, which identifies it as array type. … … 32 27 * The prefix every array type name starts with. 33 28 */ 34 const NAME_ PREFIX = 'ArrayOf';29 const NAME_SUFFIX = 'Array'; 35 30 36 31 /** … … 50 45 if(!is_null($elementType)) 51 46 { 52 return new ckXsdArrayType( self::NAME_PREFIX.ckString::ucfirst($elementTypeName), ckXsdNamespace::get('tns'), $elementType);47 return new ckXsdArrayType(ckString::ucfirst($elementTypeName).self::NAME_SUFFIX, ckXsdNamespace::get('tns'), $elementType); 53 48 } 54 49 } … … 97 92 98 93 /** 99 * @see ck DOMSerializable::getNodeName()94 * @see ckXsdComplexType::getElements() 100 95 */ 101 public function get NodeName()96 public function getElements() 102 97 { 103 return self::ELEMENT_NAME; 98 return array(new ckXsdComplexTypeElement('item', $this->getElementType(), '0', 'unbound')); 99 } 100 101 /** 102 * Hides ckXsdComplexType::addElement(), does nothing. 103 * 104 * @see ckXsdComplexType::addElement() 105 */ 106 public function addElement(ckXsdComplexTypeElement $element) 107 { 104 108 } 105 109 … … 117 121 $this->setElementType($elementType); 118 122 } 119 120 /**121 * @see ckDOMSerializable::serialize()122 */123 public function serialize(DOMDocument $document)124 {125 $xsd = ckXsdNamespace::get('xsd');126 127 $node = $document->createElementNS($xsd->getUrl(), $xsd->qualify($this->getNodeName()));128 $node->setAttribute('name', $this->getName());129 130 $attr = $document->createElementNS($xsd->getUrl(), $xsd->qualify('attribute'));131 $attr->setAttribute('ref', 'soapenc:arrayType');132 $attr->setAttribute('wsdl:arrayType', $this->getElementType()->getQualifiedName().self::ARRAY_SUFFIX);133 134 $restriction = $document->createElementNS($xsd->getUrl(), $xsd->qualify('restriction'));135 $restriction->setAttribute('base', 'soapenc:Array');136 $restriction->appendChild($attr);137 138 $complexContent = $document->createElementNS($xsd->getUrl(), $xsd->qualify('complexContent'));139 $complexContent->appendChild($restriction);140 141 $node->appendChild($complexContent);142 143 return $node;144 }145 123 } plugins/ckWebServicePlugin/branches/ckWsdlGenerator/xsd/ckXsdComplexTypeElement.class.php
r12155 r12822 37 37 */ 38 38 protected $type; 39 40 /** 41 * The minimum occurs of the element. 42 * 43 * @var string 44 */ 45 protected $minOccurs; 46 47 /** 48 * The maximum occurs of the element. 49 * 50 * @var string 51 */ 52 protected $maxOccurs; 39 53 40 54 /** … … 79 93 80 94 /** 95 * Gets the minimum occurs of the element. 96 * 97 * @return string The minimum occurs of the element 98 */ 99 public function getMinOccurs() 100 { 101 return $this->minOccurs; 102 } 103 104 /** 105 * Sets the minimum occurs of the element. 106 * 107 * @param string $value The minimum occurs of the element 108 */ 109 public function setMinOccurs($value) 110 { 111 $this->minOccurs = $value; 112 } 113 114 /** 115 * Gets the maximum occurs of the element. 116 * 117 * @return string The maximum occurs of the element 118 */ 119 public function getMaxOccurs() 120 { 121 return $this->maxOccurs; 122 } 123 124 /** 125 * Sets the maximum occurs of the element. 126 * 127 * @param string $value The maximum occurs of the element 128 */ 129 public function setMaxOccurs($value) 130 { 131 $this->maxOccurs = $value; 132 } 133 134 /** 81 135 * @see ckDOMSerializable::getNodeName() 82 136 */ … … 89 143 * Constructor initializing the element with a given name and a given type. 90 144 * 91 * @param string $name The name of the element 92 * @param ckXsdType $type The type of the element 145 * @param string $name The name of the element 146 * @param ckXsdType $type The type of the element 147 * @param string $minOccurs The minimum occurs of the element 148 * @param string $maxOccurs The maximum occurs of the element 93 149 */ 94 public function __construct($name, ckXsdType $type )150 public function __construct($name, ckXsdType $type, $minOccurs = null, $maxOccur = null) 95 151 { 96 152 $this->setName($name); 97 153 $this->setType($type); 154 $this->setMinOccurs($minOccurs); 155 $this->setMaxOccurs($maxOccur); 98 156 } 99 157 … … 109 167 $node->setAttribute('type', $this->getType()->getQualifiedName()); 110 168 169 if(!is_null($this->getMinOccurs())) 170 { 171 $node->setAttribute('minOccurs', $this->getMinOccurs()); 172 } 173 174 if(!is_null($this->getMaxOccurs())) 175 { 176 $node->setAttribute('maxOccurs', $this->getMaxOccurs()); 177 } 178 111 179 return $node; 112 180 }