| 490 | } |
| 491 | |
| 492 | export class ComplexTypeElement extends Element { |
| 493 | public readonly allowedChildren = buildAllowedChildren(['all', 'annotation', 'choice', 'complexContent', 'sequence', 'simpleContent', 'attribute']); |
| 494 | public description(definitions: DefinitionsElement, xmlns: IXmlNs) { |
| 495 | let ret = {}; |
| 496 | let isFirstChild = false; |
| 497 | const $attributes = {}; |
| 498 | const children = this.children || []; |
| 499 | for (const child of children) { |
| 500 | if (child instanceof AttributeElement) { |
| 501 | $attributes[child.$name] = child.description(definitions); |
| 502 | continue; |
| 503 | } |
| 504 | |
| 505 | if (!isFirstChild && (child instanceof ChoiceElement || child instanceof SequenceElement || child instanceof AllElement || child instanceof SimpleContentElement || child instanceof ComplexContentElement)) { |
| 506 | isFirstChild = true; |
| 507 | ret = child.description(definitions, xmlns); |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | if (Object.keys($attributes).length > 0) { |
| 512 | ret[AttributeElement.Symbol] = $attributes; |
| 513 | } |
| 514 | |
| 515 | return ret; |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | export class ComplexContentElement extends Element { |
| 520 | public readonly allowedChildren = buildAllowedChildren(['extension', 'restriction']); |
nothing calls this directly
no test coverage detected