mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
Update libxmljs for v0.14.2
This commit is contained in:
@@ -10,7 +10,7 @@ var xml = '<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<sibling>with content!</sibling>' +
|
||||
'</root>';
|
||||
|
||||
var xmlDoc = libxmljs.parseXmlString(xml);
|
||||
var xmlDoc = libxmljs.parseXml(xml);
|
||||
|
||||
// xpath queries
|
||||
var gchild = xmlDoc.get('//grandchild');
|
||||
|
||||
51
libxmljs/libxmljs.d.ts
vendored
51
libxmljs/libxmljs.d.ts
vendored
@@ -1,9 +1,16 @@
|
||||
// Type definitions for Libxmljs
|
||||
// Type definitions for Libxmljs v0.14.2
|
||||
// Project: https://github.com/polotek/libxmljs
|
||||
// Definitions by: François de Campredon <https://github.com/fdecampredon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "libxmljs" {
|
||||
|
||||
import events = require('events');
|
||||
|
||||
export function parseXml(source:string):XMLDocument;
|
||||
export function parseHtml(source:string):HTMLDocument;
|
||||
export function parseXmlString(source:string):XMLDocument;
|
||||
export function parseHtmlString(source:string):HTMLDocument;
|
||||
|
||||
@@ -20,6 +27,8 @@ declare module "libxmljs" {
|
||||
node(name:string, content:string):Element;
|
||||
root():Element;
|
||||
toString():string;
|
||||
validate(xsdDoc:XMLDocument): boolean;
|
||||
validationErrors: XmlError[];
|
||||
version():Number;
|
||||
}
|
||||
|
||||
@@ -34,25 +43,25 @@ declare module "libxmljs" {
|
||||
name(newName:string):void;
|
||||
text():string;
|
||||
attr(name:string):string;
|
||||
attr(attr:Attribute);
|
||||
attr(attr:Attribute):void;
|
||||
attr(attrObject:{[key:string]:string;}):void;
|
||||
attrs():Attribute[];
|
||||
parent():Element;
|
||||
doc():XMLDocument;
|
||||
child(idx:number):Element;
|
||||
childNodes():Element[];
|
||||
addChild(child:Element);
|
||||
addChild(child:Element):Element;
|
||||
nextSibling():Element;
|
||||
nextElement():Element;
|
||||
addNextSibling(siblingNode:Element):Element;
|
||||
prevSibling():Element;
|
||||
prevElement():Element;
|
||||
addPrevSibling(siblingNode:Element);
|
||||
addPrevSibling(siblingNode:Element):Element;
|
||||
find(xpath:string):Element[];
|
||||
find(xpath:string, ns_uri:string):Element[];
|
||||
get(xpath:string, ns_uri:string):Element;
|
||||
find(xpath:string, namespaces:{[key:string]:string;}):Element[];
|
||||
get(xpath, ns_uri:{[key:string]:string;}):Element;
|
||||
get(xpath:string, ns_uri:{[key:string]:string;}):Element;
|
||||
defineNamespace(href:string):Namespace;
|
||||
defineNamespace(prefix:string, href:string):Namespace;
|
||||
namespace():Namespace;
|
||||
@@ -84,28 +93,22 @@ declare module "libxmljs" {
|
||||
prefix():string;
|
||||
}
|
||||
|
||||
export class SaxParser {
|
||||
export class SaxParser extends events.EventEmitter {
|
||||
parseString(source:string):boolean;
|
||||
addListener(event: string, listener: Function);
|
||||
on(event: string, listener: Function): any;
|
||||
once(event: string, listener: Function): void;
|
||||
removeListener(event: string, listener: Function): void;
|
||||
removeAllListener(event: string): void;
|
||||
setMaxListeners(n: number): void;
|
||||
listeners(event: string): { Function; }[];
|
||||
emit(event: string, arg1?: any, arg2?: any): void;
|
||||
}
|
||||
|
||||
|
||||
export class SaxPushParser {
|
||||
export class SaxPushParser extends events.EventEmitter {
|
||||
push(source:string):boolean;
|
||||
addListener(event: string, listener: Function);
|
||||
on(event: string, listener: Function): any;
|
||||
once(event: string, listener: Function): void;
|
||||
removeListener(event: string, listener: Function): void;
|
||||
removeAllListener(event: string): void;
|
||||
setMaxListeners(n: number): void;
|
||||
listeners(event: string): { Function; }[];
|
||||
emit(event: string, arg1?: any, arg2?: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
export interface XmlError {
|
||||
domain: number;
|
||||
code: number;
|
||||
message: string;
|
||||
level: number;
|
||||
file?: string;
|
||||
column: number;
|
||||
line: number;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user