Skip to content

Commit a94483b

Browse files
committed
fix: XmlDocument can never be a child of XmlDocument
1 parent 606b67a commit a94483b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

model/xmlDocument.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { XmlNode } from './xmlNode';
2-
import { XmlElement } from './xmlElement';
2+
import { XmlChildNode, XmlElement } from './xmlElement';
3+
import { XmlDoctype } from './xmlDoctype';
34

45
/// The document node is simply a container for a sequence of XML nodes.
56
export class XmlDocument extends XmlNode {
6-
constructor(public children: XmlNode[]) {
7+
constructor(public children: (XmlChildNode | XmlDoctype)[]) {
78
super();
89
}
910

xmlParser.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// -------------------------
44

55
// Text node.
6-
import { XmlNode } from './model/xmlNode';
76
import { XmlText } from './model/xmlText';
87
import { XmlComment } from './model/xmlComment';
98
import { XmlProcessing } from './model/xmlProcessing';
@@ -25,7 +24,7 @@ export class XmlParser {
2524

2625
static parse(xml: string): XmlDocument {
2726
const parser = new XmlParser(xml);
28-
const children: XmlNode[] = [];
27+
const children: (XmlChildNode | XmlDoctype)[] = [];
2928
while (parser.pos < parser.input.length) {
3029
const node = parser.parseNode();
3130
if (node) {

0 commit comments

Comments
 (0)