@awayfl/avm2
Version:
Virtual machine for executing AS3 code
319 lines • 11.4 kB
TypeScript
import { Namespace } from '../abc/lazy/Namespace';
import { Multiname } from '../abc/lazy/Multiname';
import { ASObject } from '../nat/ASObject';
import { Bytecode } from '../abc/ops';
import { AXSecurityDomain } from '../run/AXSecurityDomain';
export declare function isXMLType(val: any, sec: AXSecurityDomain): boolean;
export declare function isXMLCollection(sec: AXSecurityDomain, val: any): boolean;
export declare function escapeElementValue(sec: AXSecurityDomain, s: any): string;
export declare function escapeAttributeValue(s: string): string;
export declare function isXMLName(v: any, sec: AXSecurityDomain): boolean;
export declare const enum XMLParserErrorCode {
NoError = 0,
EndOfDocument = -1,
UnterminatedCdat = -2,
UnterminatedXmlDeclaration = -3,
UnterminatedDoctypeDeclaration = -4,
UnterminatedComment = -5,
MalformedElement = -6,
OutOfMemory = -7,
UnterminatedAttributeValue = -8,
UnterminatedElement = -9,
ElementNeverBegun = -10
}
export declare class XMLParserBase {
constructor();
private resolveEntities;
private parseContent;
private parseProcessingInstruction;
parseXml(s: string): void;
onPi(_name: string, _value: string): void;
onComment(_text: string): void;
onCdata(_text: string): void;
onDoctype(_doctypeContent: string): void;
onText(_text: string): void;
onBeginElement(_name: string, _attributes: {
name: string;
value: string;
}[], _isEmpty: boolean): void;
onEndElement(_name: string): void;
onError(_code: XMLParserErrorCode): void;
}
export declare class XMLParser extends XMLParserBase {
sec: AXSecurityDomain;
private currentElement;
private elementsStack;
private scopes;
constructor(sec: AXSecurityDomain);
private isWhitespacePreserved;
private lookupDefaultNs;
private lookupNs;
private getName;
onError(code: XMLParserErrorCode): void;
onPi(name: string, value: string): void;
onComment(text: string): void;
onCdata(text: string): void;
onDoctype(doctypeContent: string): void;
onText(text: string): void;
onBeginElement(name: string, contentAttributes: {
name: string;
value: string;
}[], isEmpty: boolean): void;
onEndElement(name: string): void;
beginElement(name: any, attrs: any, namespaces: Namespace[], isEmpty: boolean): void;
endElement(_name: any): void;
text(text: string, isWhitespacePreserve: boolean): void;
cdata(text: string): void;
comment(text: string): void;
pi(name: string, value: any): void;
doctype(_text: any): void;
parseFromString(s: string, _mimeType?: string): ASXML;
}
export declare class ASNamespace extends ASObject implements XMLType {
static instanceConstructor: any;
static classInitializer(): void;
_ns: Namespace;
/**
* 13.2.1 The Namespace Constructor Called as a Function
*
* Namespace ()
* Namespace (uriValue)
* Namespace (prefixValue, uriValue)
*/
static axApply(_self: ASNamespace, args: any[]): ASNamespace;
static Create(_uriOrPrefix_: any, _uri_: any): ASNamespace;
static FromNamespace(ns: Namespace): ASNamespace;
static defaultNamespace: Namespace;
axInitializer: (uriOrPrefix_?: any, uri_?: any) => any;
/**
* 13.2.2 The Namespace Constructor
*
* Namespace ()
* Namespace (uriValue)
* Namespace (prefixValue, uriValue)
*/
constructor(uriOrPrefix_?: any, uri_?: any);
equals(other: any): boolean;
get prefix(): any;
get uri(): string;
toString(): string;
valueOf(): string;
}
export declare class ASQName extends ASObject implements XMLType {
static classInitializer(): void;
static Create(_nameOrNS_: any, _name_?: any, _isAttribute?: boolean): ASQName;
static FromMultiname(mn: Multiname): ASQName;
axInitializer: (nameOrNS_?: any, name_?: any) => any;
/**
* 13.3.1 The QName Constructor Called as a Function
*
* QName ( )
* QName ( Name )
* QName ( Namespace , Name )
*/
static axApply(_self: ASNamespace, args: any[]): ASQName;
name: Multiname;
/**
* 13.3.2 The QName Constructor
*
* new QName ()
* new QName (Name)
* new QName (Namespace, Name)
*/
constructor(nameOrNS_?: any, name_?: any);
equals(other: any): boolean;
get localName(): string;
get uri(): string;
ecmaToString(): string;
toString(): any;
valueOf(): this;
/**
* 13.3.5.3 [[Prefix]]
* The [[Prefix]] property is an optional internal property that is not directly visible to
* users. It may be used by implementations that preserve prefixes in qualified names. The
* value of the [[Prefix]] property is a value of type string or undefined. If the [[Prefix]]
* property is undefined, the prefix associated with this QName is unknown.
*/
get prefix(): string;
}
export declare const enum ASXMLKind {
Element = 1,
Attribute = 2,
Text = 3,
Comment = 4,
ProcessingInstruction = 5
}
export interface XMLType {
equals(other: any): boolean;
axClass: any;
}
export declare class ASXML extends ASObject implements XMLType {
static instanceConstructor: any;
static classInitializer(): void;
static Create(value?: any): ASXML;
static resetSettings(): void;
axInitializer: (value?: any) => any;
static native_settings(): Object;
static native_setSettings(o: any): void;
static native_defaultSettings(): Object;
private static _flags;
private static _prettyIndent;
_attributes: ASXML[];
_inScopeNamespaces: Namespace[];
_kind: ASXMLKind;
_name: Multiname;
_value: any;
_parent: ASXML;
_children: ASXML[];
static axApply(self: ASXML, args: any[]): ASXML;
constructor(value?: any);
valueOf(): this;
equals(other: any): boolean;
init(kind: number, mn: Multiname): this;
_deepEquals(V: XMLType): boolean;
_deepCopy(): ASXML;
resolveValue(): this;
_addInScopeNamespace(ns: Namespace): void;
static get ignoreComments(): boolean;
static set ignoreComments(newIgnore: boolean);
static get ignoreProcessingInstructions(): boolean;
static set ignoreProcessingInstructions(newIgnore: boolean);
static get ignoreWhitespace(): boolean;
static set ignoreWhitespace(newIgnore: boolean);
static get prettyPrinting(): boolean;
static set prettyPrinting(newPretty: boolean);
static get prettyIndent(): number;
static set prettyIndent(newIndent: number);
toString(): string;
native_hasOwnProperty(P: string): boolean;
native_propertyIsEnumerable(P?: any): boolean;
addNamespace(ns: any): ASXML;
appendChild(child: any): ASXML;
attribute(arg: any): ASXMLList;
attributes(): ASXMLList;
child(propertyName: any): ASXMLList;
childIndex(): number;
children(): ASXMLList;
comments(): ASXMLList;
contains(value: any): boolean;
copy(): ASXML;
descendants(name: any): ASXMLList;
elements(name: any): ASXMLList;
hasComplexContent(): boolean;
hasSimpleContent(): boolean;
inScopeNamespaces(): ASNamespace[];
private _inScopeNamespacesImpl;
insertChildAfter(child1: any, child2: any): any;
insertChildBefore(child1: any, child2: any): any;
length(): number;
localName(): Object;
name(): Object;
namespace(prefix?: string): any;
namespaceDeclarations(): any[];
nodeKind(): string;
normalize(): ASXML;
private removeByIndex;
parent(): any;
processingInstructions(name: any): ASXMLList;
processingInstructionsInto(name: Multiname, list: ASXMLList): ASXMLList;
prependChild(child: any): ASXML;
removeNamespace(ns: any): ASXML;
replace(propertyName: any, value: any): ASXML;
_replaceByIndex(p: number, v: any): ASXML;
setChildren(value: any): ASXML;
setLocalName(name_: any): void;
setName(name_: any): void;
setNamespace(ns: any): void;
text(): ASXMLList;
toXMLString(): string;
private toXMLStringImpl;
toJSON(_k: string): string;
axGetEnumerableKeys(): any[];
setProperty(mn: Multiname, v: any): void;
axSetProperty(mn: Multiname, value: any, _bc: Bytecode): void;
getProperty(mn: Multiname): any;
axGetProperty(mn: Multiname): any;
hasProperty(mn: Multiname): boolean;
deleteProperty(mn: Multiname): boolean;
axHasProperty(mn: Multiname): boolean;
axHasPropertyInternal(mn: Multiname): boolean;
axDeleteProperty(mn: Multiname): boolean;
axCallProperty(mn: Multiname, args: any[]): any;
_delete(key: any, isMethod: any): void;
deleteByIndex(p: number): void;
insert(p: number, v: any): void;
addInScopeNamespace(ns: Namespace): void;
descendantsInto(name: Multiname, xl: ASXMLList): ASXMLList;
}
export declare class ASXMLList extends ASObject implements XMLType {
static instanceConstructor: any;
static classInitializer(): void;
static axApply(_self: ASXMLList, args: any[]): ASXMLList;
static addXML(left: ASXMLList, right: ASXMLList): ASXMLList;
get value(): ASXML[];
_children: ASXML[];
_targetObject: any;
_targetProperty: Multiname;
static Create(value?: any): ASXMLList;
axInitializer: (value?: any) => any;
constructor(value?: any);
static CreateList(targetObject: ASXML, targetProperty: Multiname): ASXMLList;
valueOf(): this;
equals(other: any): boolean;
toString(): string;
_deepCopy(): ASXMLList;
_shallowCopy(): ASXMLList;
native_hasOwnProperty(P: string): boolean;
native_propertyIsEnumerable(P: any): boolean;
attribute(arg: any): ASXMLList;
attributes(): ASXMLList;
child(propertyName: any): ASXMLList;
children(): ASXMLList;
descendants(name_: any): ASXMLList;
comments(): ASXMLList;
contains(value: any): boolean;
copy(): ASXMLList;
elements(name: any): ASXMLList;
hasComplexContent(): boolean;
hasSimpleContent(): boolean;
length(): number;
name(): Object;
normalize(): ASXMLList;
parent(): any;
processingInstructions(name_: any): ASXMLList;
text(): ASXMLList;
toXMLString(): string;
toJSON(k: string): string;
addNamespace(ns: any): ASXML;
appendChild(child: any): ASXML;
append(V: any): void;
childIndex(): number;
inScopeNamespaces(): any[];
insertChildAfter(child1: any, child2: any): any;
insertChildBefore(child1: any, child2: any): any;
nodeKind(): string;
namespace(prefix: string): any;
localName(): Object;
namespaceDeclarations(): any[];
prependChild(value: any): ASXML;
removeNamespace(ns: any): ASXML;
replace(propertyName: any, value: any): ASXML;
setChildren(value: any): ASXML;
setLocalName(name: any): void;
setName(name: any): void;
setNamespace(ns: any): void;
axGetEnumerableKeys(): any[];
getProperty(mn: Multiname): any;
axGetProperty(mn: Multiname): any;
axGetPublicProperty(nm: any): any;
hasProperty(mn: Multiname): boolean;
axHasProperty(mn: Multiname): boolean;
axHasPropertyInternal(mn: Multiname): boolean;
resolveValue(): this;
setProperty(mn: Multiname, value: any): void;
axSetProperty(mn: Multiname, value: any, _bc: Bytecode): void;
axDeleteProperty(mn: Multiname): boolean;
private removeByIndex;
axCallProperty(mn: Multiname, args: any[]): any;
}
//# sourceMappingURL=xml.d.ts.map