xsd
Functions and types to parse XML schema definitions (ie. .xsd files).
Classes
ChildProps
Constructors
new ChildProps()
Parameters
• params
• params.maxOccurs?: number
• params.minOccurs?: number
• params.type: string
Returns
Defined in
tmp/commons/src/lib/utils/xsd.ts:46
Properties
maxOccurs?
Defined in
tmp/commons/src/lib/utils/xsd.ts:44
minOccurs?
Defined in
tmp/commons/src/lib/utils/xsd.ts:43
type
Defined in
tmp/commons/src/lib/utils/xsd.ts:42
Accessors
required
Returns
boolean
Defined in
tmp/commons/src/lib/utils/xsd.ts:56
unique
Returns
boolean
Defined in
tmp/commons/src/lib/utils/xsd.ts:52
Methods
toJSON()
Returns
object
maxOccurs
minOccurs
type
Defined in
tmp/commons/src/lib/utils/xsd.ts:64
fromObject()
Parameters
• obj
• obj.maxOccurs: undefined
| number
= ...
• obj.minOccurs: undefined
| number
= ...
• obj.type: string
= ...
Returns
Defined in
tmp/commons/src/lib/utils/xsd.ts:60
ComplexType
A complex type in an XML schema definition.
Constructors
new ComplexType()
Parameters
• params
• params.attributes?: Attribute
[]
• params.children?: ChildProps
[]
• params.doc?: string
• params.name: string
Returns
Defined in
tmp/commons/src/lib/utils/xsd.ts:87
Properties
attributes
Defined in
tmp/commons/src/lib/utils/xsd.ts:84
children
Defined in
tmp/commons/src/lib/utils/xsd.ts:85
doc?
Documentation of the complex type.
Defined in
tmp/commons/src/lib/utils/xsd.ts:79
name
Name of the complex type.
Defined in
tmp/commons/src/lib/utils/xsd.ts:77
Accessors
attrs
Attributes of the complex type.
Returns
Defined in
tmp/commons/src/lib/utils/xsd.ts:81
childTypes
Returns
string
[]
Defined in
tmp/commons/src/lib/utils/xsd.ts:99
optionalChildren
Returns
Defined in
tmp/commons/src/lib/utils/xsd.ts:103
optionalChildTypes
Returns
string
[]
Defined in
tmp/commons/src/lib/utils/xsd.ts:107
requiredChildren
Returns
Defined in
tmp/commons/src/lib/utils/xsd.ts:111
uniqueChildren
Returns
Defined in
tmp/commons/src/lib/utils/xsd.ts:115
Methods
toJSON()
Returns
object
attributes
children
doc
name
Defined in
tmp/commons/src/lib/utils/xsd.ts:119
fromObject()
Parameters
• __namedParameters
• __namedParameters.attributes: Attribute
[]
• __namedParameters.children: object
[]
• __namedParameters.doc: undefined
| string
• __namedParameters.name: string
Returns
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()
Returns
Properties
complexTypes
Complex types of the xml schema.
Defined in
tmp/commons/src/lib/utils/xsd.ts:169
simpleTypes
Simple types of the xml schema.
Defined in
tmp/commons/src/lib/utils/xsd.ts:167
Accessors
parentsMap
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
Roots of the XML schema.
Returns
string
[]
Defined in
tmp/commons/src/lib/utils/xsd.ts:208
simpleTypeMap
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
Tree representation of the XML schema.
It is a recursive structure that represents the hierarchy of the types in the schema.
Returns
Defined in
tmp/commons/src/lib/utils/xsd.ts:221
typeMap
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
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()
Parameters
• …complexs: ComplexType
[]
Returns
void
Defined in
tmp/commons/src/lib/utils/xsd.ts:181
addSimpleType()
Parameters
• …simples: SimpleType
[]
Returns
void
Defined in
tmp/commons/src/lib/utils/xsd.ts:186
toJSON()
Returns
object
complexTypes
simpleTypes
Defined in
tmp/commons/src/lib/utils/xsd.ts:160
fromJSON()
Parameters
• data
• data.complexTypes: object
[] = ...
• data.simpleTypes: SimpleType
[] = ...
Returns
Defined in
tmp/commons/src/lib/utils/xsd.ts:154
Type Aliases
Attribute
An attribute of a complex type in an XML schema.
Type declaration
default
Default value of the attribute.
doc?
Documentation of the attribute. Extracted from comment or annotation.
name
Name of the attribute.
required
Is the attribute required.
type
Data type of the attribute.
Defined in
tmp/commons/src/lib/utils/xsd.ts:28
SimpleType
A simple datatype in an XML schema.
Type declaration
doc?
Documentation of the simple type. Extracted from comments or annotations.
name
Name of the simple type.
options?
Options if type is an enum.
pattern?
Regex to validate the type.
Defined in
tmp/commons/src/lib/utils/xsd.ts:14
XMLTypeName
Type alias to make code more explicit.
Defined in
tmp/commons/src/lib/utils/xsd.ts:147
XMLTypeTree
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()
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()
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