UNPKG

@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

34 lines (33 loc) 2.59 kB
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 { AttributeElementMixin, AttributeElementOptions } from './mixins/attribute-element.mixin'; import { TagElementMixin, TagElementOptions } from './mixins/tag-element.mixin'; export interface ElementChildAttributeOptions<Value> extends AttributeElementOptions<Value>, TagElementOptions { } export interface ElementChildAttributeParser<T extends ParsedElement, Value> extends AttributeElementMixin<Value>, TagElementMixin { } export declare class ElementChildAttributeParser<T extends ParsedElement = ParsedElement, Value = any> implements ElementParser<T> { readonly propertyKey: string; readonly options: ElementChildAttributeOptions<Value>; constructor(propertyKey: string, options: ElementChildAttributeOptions<Value>); parse(xmlParser: XmlParserService, element: RxapElement, parsedElement: T): T; } export interface ElementChildAttributeSerializerOptions<Value> extends AttributeElementOptions<Value>, TagElementOptions { } export interface ElementChildAttributeSerializer<T extends ParsedElement, Value> extends AttributeElementMixin<Value>, TagElementMixin { } export declare class ElementChildAttributeSerializer<T extends ParsedElement = ParsedElement, Value = any> implements ElementSerializer<T> { readonly propertyKey: string; readonly options: ElementChildAttributeSerializerOptions<Value>; constructor(propertyKey: string, options: ElementChildAttributeSerializerOptions<Value>); serialize(xmlParser: XmlSerializerService, element: RxapElement, parsedElement: T): void; } export declare function ElementChildAttribute<Value>(options: ElementChildAttributeOptions<Value>): (target: any, propertyKey: string) => void; export declare function ElementChildAttribute<Value>(tag: string): (target: any, propertyKey: string) => void; export declare function ElementChildAttribute<Value>(tag: string, options: Partial<ElementChildAttributeOptions<Value>>): (target: any, propertyKey: string) => void; export declare function ElementChildAttribute<Value>(tag: string, attribute: string): (target: any, propertyKey: string) => void; export declare function ElementChildAttribute<Value>(tag: string, attribute: string, options: Partial<ElementChildAttributeOptions<Value>>): (target: any, propertyKey: string) => void;