mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 11:07:32 +08:00
Merge pull request #25829 from ts2do/master
xmldoc: Corrected, expanded, and refined typings
This commit is contained in:
35
types/xmldoc/index.d.ts
vendored
35
types/xmldoc/index.d.ts
vendored
@@ -6,31 +6,35 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped): // TypeScript Version: 2.1
|
||||
|
||||
export class XmlDocument extends XmlElement {
|
||||
constructor(xmlString: string);
|
||||
constructor(xml: string);
|
||||
|
||||
doctype: string;
|
||||
}
|
||||
|
||||
export class XmlElement {
|
||||
constructor(tag: XmlElement);
|
||||
export type XmlNode = XmlElement | XmlTextNode | XmlCDataNode | XmlCommentNode;
|
||||
|
||||
export class XmlElement {
|
||||
constructor(tag: XmlTag);
|
||||
|
||||
type: 'element';
|
||||
name: string;
|
||||
attr: XmlAttributes;
|
||||
val: string;
|
||||
children: XmlElement[];
|
||||
firstChild: XmlElement;
|
||||
lastChild: XmlElement;
|
||||
children: XmlNode[];
|
||||
firstChild: XmlNode | null;
|
||||
lastChild: XmlNode | null;
|
||||
line: number;
|
||||
column: number;
|
||||
position: number;
|
||||
startTagPosition: number;
|
||||
|
||||
eachChild(func: (child: XmlElement, index?: number, array?: XmlElement[]) => void): void;
|
||||
childNamed(name: string): XmlElement;
|
||||
eachChild(iterator: (child: XmlElement, index: number, array: XmlNode[]) => void): void;
|
||||
eachChild<T>(iterator: (this: T, child: XmlElement, index: number, array: XmlNode[]) => void, context: T): void;
|
||||
childNamed(name: string): XmlElement | undefined;
|
||||
childrenNamed(name: string): XmlElement[];
|
||||
childWithAttribute(name: string, value?: string): XmlElement;
|
||||
descendantWithPath(path: string): XmlElement;
|
||||
valueWithPath(path: string): string;
|
||||
childWithAttribute(name: string, value?: string | null): XmlElement | undefined;
|
||||
descendantWithPath(path: string): XmlElement | undefined;
|
||||
valueWithPath(path: string): string | undefined;
|
||||
toString(opts?: XmlOptions): string;
|
||||
toStringWithIndent(indent: string, opts?: XmlOptions): string;
|
||||
}
|
||||
@@ -38,6 +42,9 @@ export class XmlElement {
|
||||
export class XmlTextNode {
|
||||
constructor(text: string);
|
||||
|
||||
type: 'text';
|
||||
text: string;
|
||||
|
||||
toString(opts?: XmlOptions): string;
|
||||
toStringWithIndent(indent: string, opts?: XmlOptions): string;
|
||||
}
|
||||
@@ -45,6 +52,9 @@ export class XmlTextNode {
|
||||
export class XmlCDataNode {
|
||||
constructor(cdata: string);
|
||||
|
||||
type: 'cdata';
|
||||
cdata: string;
|
||||
|
||||
toString(opts?: XmlOptions): string;
|
||||
toStringWithIndent(indent: string, opts?: XmlOptions): string;
|
||||
}
|
||||
@@ -52,6 +62,9 @@ export class XmlCDataNode {
|
||||
export class XmlCommentNode {
|
||||
constructor(comment: string);
|
||||
|
||||
type: 'comment';
|
||||
comment: string;
|
||||
|
||||
toString(opts?: XmlOptions): string;
|
||||
toStringWithIndent(indent: string, opts?: XmlOptions): string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user