| 608 | } |
| 609 | |
| 610 | private _resolveNamespace(fullName: string): { prefix: string; namespace: string; name: string } { |
| 611 | const result: { prefix: string; namespace: string; name: string } = { |
| 612 | prefix: undefined, |
| 613 | namespace: undefined, |
| 614 | name: undefined, |
| 615 | }; |
| 616 | result.prefix = ''; |
| 617 | if (fullName.indexOf(':') !== -1) { |
| 618 | const split = fullName.split(':'); |
| 619 | result.prefix = split[0]; |
| 620 | result.name = split[1]; |
| 621 | } else { |
| 622 | result.name = fullName; |
| 623 | } |
| 624 | |
| 625 | let stackEntry; |
| 626 | for (let i = this._namespaceStack.length - 1; i >= 0; i--) { |
| 627 | stackEntry = this._namespaceStack[i]; |
| 628 | |
| 629 | for (const key in stackEntry) { |
| 630 | if (!stackEntry.hasOwnProperty(key)) { |
| 631 | continue; |
| 632 | } |
| 633 | |
| 634 | if (result.prefix === key) { |
| 635 | result.namespace = stackEntry[key]; |
| 636 | |
| 637 | return result; |
| 638 | } |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | return result; |
| 643 | } |
| 644 | |
| 645 | private static _dereferenceEntities(s: string): string { |
| 646 | s = String(s); |