IXmlSchemaCache
public interface IXmlSchemaCacheDefines a thread-safe registry and cache for precompiled XSD schema sets.
Implementations must be thread-safe for concurrent registration and lookup operations. Precompiled `XmlSchemaSet` instances are cached to eliminate redundant compilation overhead and ensure safe schema resolution with external entity resolution disabled.
Miembros (7)
- methodClear
void Clear()Removes all registered schemas from the cache.
This operation is thread-safe. Concurrent registrations or lookups in progress will complete normally; subsequent operations will see an empty cache.
- methodContainsSchema
bool ContainsSchema(string targetNamespace)Determines whether a schema for the specified target namespace is registered in the cache.
- targetNamespace: string
- The target XML namespace to look up
Retorna: `true` if a schema for the specified namespace is registered; otherwise, `false`.
Exceptions: ArgumentNullException: `targetNamespace` is `null`
- methodIsRootElementDeclared
bool IsRootElementDeclared(string targetNamespace, string localName, string namespaceUri)Determines whether the specified root element qualified name is declared as a global element in the registered schema.
- targetNamespace: string
- The target XML namespace of the schema
- localName: string
- The local name of the root element
- namespaceUri: string
- The namespace URI of the root element
Retorna: `true` if the element is declared as a global element in the target schema; otherwise, `false`.
Exceptions: ArgumentNullException: `targetNamespace`, `localName`, or `namespaceUri` is `null`
- methodRegisterSchema
void RegisterSchema(string targetNamespace, ReadOnlySpan<byte> utf8Xsd)Registers a precompiled XSD schema definition from the specified UTF-8 byte span.
- targetNamespace: string
- The target XML namespace associated with the schema
- utf8Xsd: ReadOnlySpan<byte>
- The UTF-8 encoded bytes representing the XSD schema
Exceptions: ArgumentNullException: `targetNamespace` is `null`; XmlException: The bytes do not represent well-formed XML, or the span is empty; XmlSchemaException: The bytes contain schema structural or syntax errors
- methodRegisterSchema
void RegisterSchema(string targetNamespace, Stream xsdStream)Registers a precompiled XSD schema definition from the specified stream.
- targetNamespace: string
- The target XML namespace associated with the schema
- xsdStream: Stream
- The readable stream containing XSD schema data
Exceptions: ArgumentNullException: `targetNamespace` or `xsdStream` is `null`; XmlException: The stream does not contain well-formed XML; XmlSchemaException: The stream contains schema structural or syntax errors
- methodRegisterSchema
void RegisterSchema(string targetNamespace, string xsdContent)Registers a precompiled XSD schema definition from the specified string.
- targetNamespace: string
- The target XML namespace associated with the schema
- xsdContent: string
- The raw XML Schema Definition (XSD) string to compile
Exceptions: ArgumentNullException: `targetNamespace` or `xsdContent` is `null`; XmlException: The `xsdContent` is not well-formed XML; XmlSchemaException: The `xsdContent` contains schema structural or syntax errors
- propertyCount
int Count { get; }Gets the total number of precompiled schema sets currently registered in the cache.