Documentation / @sw-file-lib/xml
@sw-file-lib/xml
TypeScript libraries for reading, writing Stormworks files.
This package includes parser, serializer, and typed schemas for Stormworks XML files. For other packages, see GitHub Repository.
Documentation
Modules
| Module | Description |
|---|---|
| xml-schema | Module for working with Stormworks XML data. |
Namespaces
| Namespace | Description |
|---|---|
| ComponentDefinitionSchemas | - |
| MicrocontrollerSchemas | - |
| VehicleSchemas | - |
Classes
| Class | Description |
|---|---|
| SwXmlParseError | An error thrown when there were unexpected conversion failures in conversion from fast-xml-parser result to internal node tree. |
| SwXmlStructureError | An error thrown when parsed XML nodes cannot be interpreted as the requested structure. |
| SwXmlNodeList | A list of parsed Stormworks XML nodes. |
| SwXmlNode | A parsed Stormworks XML element. |
| XmlWriter | A utility class for generating XML content programmatically. |
Interfaces
| Interface | Description |
|---|---|
| SwXmlStructureErrorDetails | Additional metadata for XML structure errors. |
| XmlVec2 | Represents elements with x and y attributes in Stormworks XML data. |
| XmlVec3 | Represents elements with x, y, and z attributes in Stormworks XML data. |
| XmlRgb | Represents elements with r, g, and b attributes in Stormworks XML data. |
| XmlMat3 | Represents elements with 00, 01, 02, 10, 11, 12, 20, 21, and 22 attributes in Stormworks XML data. |
| TextValuePair | Represents elements with text and value attributes in Stormworks microcontroller data. |
| XmlVec2Immutable | Represents elements with x and y attributes in Stormworks XML data. |
| XmlVec3Immutable | Represents elements with x, y, and z attributes in Stormworks XML data. |
| XmlRgbImmutable | Represents elements with r, g, and b attributes in Stormworks XML data. |
| XmlMat3Immutable | Represents elements with 00, 01, 02, 10, 11, 12, 20, 21, and 22 attributes in Stormworks XML data. |
| TextValuePairImmutable | Represents elements with text and value attributes in Stormworks microcontroller data. |
| XmlWriterOptions | Options for configuring the behavior of an XmlWriter instance. |
Type Aliases
| Type Alias | Description |
|---|---|
| SwXmlParseErrorCode | Error codes for SwXmlParseError. |
| SwXmlStructureErrorCode | Error codes for SwXmlStructureError. |
| DuplicateChildElementMode | How to resolve duplicate child elements when reading an XML record. |
| ParseOptions | Options used when parsing Stormworks XML files. |
| XmlAttributeValue | Value types that can be used as XML attribute values. |
| XmlAttributes | An iterable of key-value pairs representing XML attributes. |
Variables
| Variable | Description |
|---|---|
| XmlVec2Schema | Represents elements with x and y attributes in Stormworks XML data. |
| XmlVec3Schema | Represents elements with x, y, and z attributes in Stormworks XML data. |
| XmlRgbSchema | Represents elements with r, g, and b attributes in Stormworks XML data. |
| XmlMat3Schema | Represents elements with 00, 01, 02, 10, 11, 12, 20, 21, and 22 attributes in Stormworks XML data. |
| TextValuePairSchema | Represents elements with text and value attributes in Stormworks microcontroller data. |
Functions
| Function | Description |
|---|---|
| parseSwXml | Parses a Stormworks XML document into a node tree. |
| parseComponentDefinitionXml | Parses a Stormworks component definition XML document. |
| safeParseComponentDefinitionXml | Parses a Stormworks component definition XML document without throwing schema errors. |
| serializeComponentDefinitionXml | Serializes a Stormworks component definition into an XML document. |
| safeSerializeComponentDefinitionXml | Serializes a Stormworks component definition into an XML document without throwing schema errors. |
| parseVehicleXml | Parses a Stormworks vehicle XML document. |
| safeParseVehicleXml | Parses a Stormworks vehicle XML document without throwing schema errors. |
| serializeVehicleXml | Serializes a Stormworks vehicle into an XML document. |
| safeSerializeVehicleXml | Serializes a Stormworks vehicle into an XML document without throwing schema errors. |
| parseMicrocontrollerXml | Parses a standalone Stormworks microcontroller XML document rooted at <microprocessor>. |
| safeParseMicrocontrollerXml | Parses a standalone Stormworks microcontroller XML document without throwing schema errors. |
| serializeMicrocontrollerXml | Serializes a standalone Stormworks microcontroller into an XML document rooted at <microprocessor>. |
| safeSerializeMicrocontrollerXml | Serializes a standalone Stormworks microcontroller into an XML document without throwing schema errors. |
| escapeXmlAttribute | Escape special characters in a string for use in XML attribute values. |
References
ComponentDefinitionSchema
Re-exports ComponentDefinitionSchema
ComponentDefinition
Re-exports ComponentDefinition
ComponentDefinitionImmutable
Re-exports ComponentDefinitionImmutable
MicroprocessorSchema
Re-exports MicroprocessorSchema
Microprocessor
Re-exports Microprocessor
MicroprocessorImmutable
Re-exports MicroprocessorImmutable
VehicleSchema
Re-exports VehicleSchema
Vehicle
Re-exports Vehicle
VehicleImmutable
Re-exports VehicleImmutable
SchemaError
Re-exports SchemaError
SchemaSerializeError
Re-exports SchemaSerializeError