@rxap/xml-parser
Version:
Provides a set of decorators and services for parsing and serializing XML documents into TypeScript classes. It simplifies the process of mapping XML elements and attributes to class properties, handling data validation, and serializing objects back into
31 lines (30 loc) • 2.06 kB
TypeScript
import { RxapElement } from '../element';
import { ParsedElement } from '../elements/parsed-element';
import { XmlParserService } from '../xml-parser.service';
import { XmlSerializerService } from '../xml-serializer.service';
import { ElementParser } from './element.parser';
import { ElementSerializer } from './element.serializer';
import { AttributeElementOptions, AttributeElementMixin } from './mixins/attribute-element.mixin';
export interface ElementAttributeParserOptions<Value> extends AttributeElementOptions<Value> {
}
export interface ElementAttributeParser<T extends ParsedElement, Value> extends AttributeElementMixin<Value> {
}
export declare class ElementAttributeParser<T extends ParsedElement = ParsedElement, Value = any> implements ElementParser<T> {
readonly propertyKey: string;
readonly options: ElementAttributeParserOptions<Value>;
constructor(propertyKey: string, options: ElementAttributeParserOptions<Value>);
parse(xmlParser: XmlParserService, element: RxapElement, parsedElement: T): T;
}
export interface ElementAttributeSerializerOptions<Value> extends AttributeElementOptions<Value> {
}
export interface ElementAttributeSerializer<T extends ParsedElement, Value> extends AttributeElementMixin<Value> {
}
export declare class ElementAttributeSerializer<T extends ParsedElement = ParsedElement, Value = any> implements ElementSerializer<T> {
readonly propertyKey: string;
readonly options: ElementAttributeParserOptions<Value>;
constructor(propertyKey: string, options: ElementAttributeParserOptions<Value>);
serialize(xmlParser: XmlSerializerService, element: RxapElement, parsedElement: T): void;
}
export declare function ElementAttribute<Value>(): (target: any, propertyKey: string) => void;
export declare function ElementAttribute<Value>(attribute: string): (target: any, propertyKey: string) => void;
export declare function ElementAttribute<Value>(options: Partial<ElementAttributeParserOptions<Value> & ElementAttributeSerializerOptions<Value>>): (target: any, propertyKey: string) => void;