Aller au contenu

xsd

Ce contenu n’est pas encore disponible dans votre langue.

Functions and types to parse XML schema definitions (ie. .xsd files).

Classes

ChildProps

Constructors

new ChildProps()
new ChildProps(params): ChildProps
Parameters

params

params.maxOccurs?: number

params.minOccurs?: number

params.type: string

Returns

ChildProps

Defined in

tmp/commons/src/lib/utils/xsd.ts:46

Properties

maxOccurs?
optional maxOccurs: number;
Defined in

tmp/commons/src/lib/utils/xsd.ts:44

minOccurs?
optional minOccurs: number;
Defined in

tmp/commons/src/lib/utils/xsd.ts:43

type
type: string;
Defined in

tmp/commons/src/lib/utils/xsd.ts:42

Accessors

required
get required(): boolean
Returns

boolean

Defined in

tmp/commons/src/lib/utils/xsd.ts:56

unique
get unique(): boolean
Returns

boolean

Defined in

tmp/commons/src/lib/utils/xsd.ts:52

Methods

toJSON()
toJSON(): object
Returns

object

maxOccurs
maxOccurs: undefined | number;
minOccurs
minOccurs: undefined | number;
type
type: string;
Defined in

tmp/commons/src/lib/utils/xsd.ts:64

fromObject()
static fromObject(obj): ChildProps
Parameters

obj

obj.maxOccurs: undefined | number = ...

obj.minOccurs: undefined | number = ...

obj.type: string = ...

Returns

ChildProps

Defined in

tmp/commons/src/lib/utils/xsd.ts:60


ComplexType

A complex type in an XML schema definition.

Constructors

new ComplexType()
new ComplexType(params): ComplexType
Parameters

params

params.attributes?: Attribute[]

params.children?: ChildProps[]

params.doc?: string

params.name: string

Returns

ComplexType

Defined in

tmp/commons/src/lib/utils/xsd.ts:87

Properties

attributes
attributes: Map<string, Attribute>;
Defined in

tmp/commons/src/lib/utils/xsd.ts:84

children
children: ChildProps[];
Defined in

tmp/commons/src/lib/utils/xsd.ts:85

doc?
optional doc: string;

Documentation of the complex type.

Defined in

tmp/commons/src/lib/utils/xsd.ts:79

name
name: string;

Name of the complex type.

Defined in

tmp/commons/src/lib/utils/xsd.ts:77

Accessors

attrs
get attrs(): Attribute[]

Attributes of the complex type.

Returns

Attribute[]

Defined in

tmp/commons/src/lib/utils/xsd.ts:81

childTypes
get childTypes(): string[]
Returns

string[]

Defined in

tmp/commons/src/lib/utils/xsd.ts:99

optionalChildren
get optionalChildren(): ChildProps[]
Returns

ChildProps[]

Defined in

tmp/commons/src/lib/utils/xsd.ts:103

optionalChildTypes
get optionalChildTypes(): string[]
Returns

string[]

Defined in

tmp/commons/src/lib/utils/xsd.ts:107

requiredChildren
get requiredChildren(): ChildProps[]
Returns

ChildProps[]

Defined in

tmp/commons/src/lib/utils/xsd.ts:111

uniqueChildren
get uniqueChildren(): ChildProps[]
Returns

ChildProps[]

Defined in

tmp/commons/src/lib/utils/xsd.ts:115

Methods

toJSON()
toJSON(): object
Returns

object

attributes
attributes: Attribute[];
children
children: object[];
doc
doc: undefined | string;
name
name: string;
Defined in

tmp/commons/src/lib/utils/xsd.ts:119

fromObject()
static fromObject(__namedParameters): ComplexType
Parameters

__namedParameters

__namedParameters.attributes: Attribute[]

__namedParameters.children: object[]

__namedParameters.doc: undefined | string

__namedParameters.name: string

Returns

ComplexType

Defined in

tmp/commons/src/lib/utils/xsd.ts:128


XmlSchema

Type of an XML schema definition.

It defines the types allowed in an xml file, usually derived from an xsd file.

Constructors

new XmlSchema()
new XmlSchema(): XmlSchema
Returns

XmlSchema

Properties

complexTypes
complexTypes: Map<string, ComplexType>;

Complex types of the xml schema.

Defined in

tmp/commons/src/lib/utils/xsd.ts:169

simpleTypes
simpleTypes: Map<string, SimpleType>;

Simple types of the xml schema.

Defined in

tmp/commons/src/lib/utils/xsd.ts:167

Accessors

parentsMap
get parentsMap(): Map<string, string[]>

Map which associates the names of complex XML types to their parents’ names.

Returns

Map<string, string[]>

Defined in

tmp/commons/src/lib/utils/xsd.ts:193

roots
get roots(): string[]

Roots of the XML schema.

Returns

string[]

Defined in

tmp/commons/src/lib/utils/xsd.ts:208

simpleTypeMap
get simpleTypeMap(): Map<string, SimpleType>

Map which associates the names of simple XML types to their definition.

Returns

Map<string, SimpleType>

Defined in

tmp/commons/src/lib/utils/xsd.ts:172

tree
get tree(): XMLTypeTree

Tree representation of the XML schema.

It is a recursive structure that represents the hierarchy of the types in the schema.

Returns

XMLTypeTree

Defined in

tmp/commons/src/lib/utils/xsd.ts:221

typeMap
get typeMap(): Map<string, ComplexType>

Map which associates the names of complex XML types to their definitions.

Returns

Map<string, ComplexType>

Defined in

tmp/commons/src/lib/utils/xsd.ts:177

typePaths
get typePaths(): Map<string, string[][] | "infinite">

Map which associates the names of complex XML types to their possible paths in an XML file.

The paths are represented as an array of type names. If a type is recursive, the value is ‘infinite’.

Returns

Map<string, string[][] | "infinite">

Defined in

tmp/commons/src/lib/utils/xsd.ts:247

Methods

addComplexType()
addComplexType(...complexs): void
Parameters

• …complexs: ComplexType[]

Returns

void

Defined in

tmp/commons/src/lib/utils/xsd.ts:181

addSimpleType()
addSimpleType(...simples): void
Parameters

• …simples: SimpleType[]

Returns

void

Defined in

tmp/commons/src/lib/utils/xsd.ts:186

toJSON()
toJSON(): object
Returns

object

complexTypes
complexTypes: object[];
simpleTypes
simpleTypes: SimpleType[];
Defined in

tmp/commons/src/lib/utils/xsd.ts:160

fromJSON()
static fromJSON(data): XmlSchema
Parameters

data

data.complexTypes: object[] = ...

data.simpleTypes: SimpleType[] = ...

Returns

XmlSchema

Defined in

tmp/commons/src/lib/utils/xsd.ts:154

Type Aliases

Attribute

type Attribute: object;

An attribute of a complex type in an XML schema.

Type declaration

default
default: unknown;

Default value of the attribute.

doc?
optional doc: string;

Documentation of the attribute. Extracted from comment or annotation.

name
name: string;

Name of the attribute.

required
required: boolean;

Is the attribute required.

type
type: string;

Data type of the attribute.

Defined in

tmp/commons/src/lib/utils/xsd.ts:28


SimpleType

type SimpleType: object;

A simple datatype in an XML schema.

Type declaration

doc?
optional doc: string;

Documentation of the simple type. Extracted from comments or annotations.

name
name: string;

Name of the simple type.

options?
optional options: string[];

Options if type is an enum.

pattern?
optional pattern: string;

Regex to validate the type.

Defined in

tmp/commons/src/lib/utils/xsd.ts:14


XMLTypeName

type XMLTypeName: string;

Type alias to make code more explicit.

Defined in

tmp/commons/src/lib/utils/xsd.ts:147


XMLTypeTree

type XMLTypeTree: object;

A tree view of an XML schema.

It is a recursive structure that represents the hierarchy of types in a schema.

Index Signature

[key: string]: XMLTypeTree | "recursive"

Defined in

tmp/commons/src/lib/utils/xsd.ts:144

Functions

parseXsd()

function parseXsd(xsd): Promise<XmlSchema | undefined>

Parses an XML schema from an XSD string.

Parameters

xsd: string

xsd string

Returns

Promise<XmlSchema | undefined>

XMLSchema, or undefined if the string could not be parsed

Defined in

tmp/commons/src/lib/utils/xsd.ts:274


parseXsdFromUrl()

function parseXsdFromUrl(url): Promise<XmlSchema | undefined>

Parses an XML schema from the url of an XSD file.

Parameters

url: string

url of the xsd file

Returns

Promise<XmlSchema | undefined>

XMLSchema, or undefined if the file could not be fetched or parsed

Defined in

tmp/commons/src/lib/utils/xsd.ts:344