Fix Dumper. Each complext type is now wrapped inside container element tag

This commit is contained in:
Gianluigi 'cocciagialla' Mammarella 2019-04-10 07:28:07 +02:00
parent c4118855de
commit 7802a0d19f
1 changed files with 10 additions and 6 deletions

View File

@ -203,9 +203,9 @@ class Dumper
$partElement->setAttribute('name', $part->getName()); $partElement->setAttribute('name', $part->getName());
if ($type instanceof ComplexType) { if ($type instanceof ComplexType) {
$partElement->setAttribute('type', static::TYPES_NS.':'.$type->getXmlType()); $partElement->setAttribute('element', static::TYPES_NS.':'.$type->getXmlType());
} else { } else {
$partElement->setAttribute('type', $type); $partElement->setAttribute('element', $type);
} }
$messageElement->appendChild($partElement); $messageElement->appendChild($partElement);
@ -235,10 +235,14 @@ class Dumper
protected function addComplexType(ComplexType $type) protected function addComplexType(ComplexType $type)
{ {
$complexType = $this->document->createElement(static::XSD_NS.':complexType'); $rootElement = $this->document->createElement(static::XSD_NS.':element');
$complexType->setAttribute('name', $type->getXmlType()); $rootElement->setAttribute('name', $type->getName());
$all = $this->document->createElement(static::XSD_NS.':'.($type instanceof ArrayOfType ? 'sequence' : 'all')); $complexType = $this->document->createElement(static::XSD_NS.':complexType');
$rootElement->appendChild($complexType);
//$all = $this->document->createElement(static::XSD_NS.':'.($type instanceof ArrayOfType ? 'sequence' : 'all'));
$all = $this->document->createElement(static::XSD_NS.':'.'sequence');
$complexType->appendChild($all); $complexType->appendChild($all);
foreach ($type->all() as $child) { foreach ($type->all() as $child) {
@ -284,7 +288,7 @@ class Dumper
} }
} }
$this->domSchema->appendChild($complexType); $this->domSchema->appendChild($rootElement);
} }
protected function addPortType() protected function addPortType()