Skip to content

Class XmlFile

Namespace: Apogee.Content.Xml
Assembly: Apogee.Content.dll

Reads an XML file of the game, whichever form it is in: text, as it is written and edited, or cooked (), as a shipped pack holds it. A cooked file keeps the path of its source, so this is the one way to read an authored or definition file; reading it as text () would give the binary.

public static class XmlFile

Inheritance

object ← XmlFile

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Methods

Read(VirtualFileSystem, string)

The document at path.

public static XmlNode Read(VirtualFileSystem files, string path)

Parameters

files VirtualFileSystem

path string

Returns

XmlNode

Exceptions

FileNotFoundException

No source has the file.

XmlParseException

The file is text and is not well-formed XML.

ContentException

The file is cooked and damaged, or cooked by a newer engine.

Read(ReadOnlySpan<byte>, string)

The document in bytes: cooked when it starts with the magic, UTF-8 text (with or without a byte order mark) otherwise.

public static XmlNode Read(ReadOnlySpan<byte> bytes, string origin)

Parameters

bytes ReadOnlySpan<byte>

The file's bytes.

origin string

The path to name in errors, and what becomes.

Returns

XmlNode

Exceptions

XmlParseException

The bytes are text and not well-formed XML.

ContentException

The bytes are cooked and damaged, or cooked by a newer engine.