@itwin/core-backend
Version:
iTwin.js backend components
46 lines • 2.64 kB
TypeScript
/** @packageDocumentation
* @module Schema
*/
import { IModelJsNative } from "@bentley/imodeljs-native";
/** @internal */
export type SchemaKey = IModelJsNative.ECSchemaXmlContext.SchemaKey;
/** @internal */
export type SchemaMatchType = IModelJsNative.ECSchemaXmlContext.SchemaMatchType;
/** Context used when deserializing a [Schema]($ecschema-metadata) from an XML file.
* A schema may contain references to other schemas, which may reside elsewhere on the local disk than the referencing schema.
* The context maintains a list of directories ("search paths") to search for referenced schemas. Directories can be appended to the list via [[addSchemaPath]].
* When a referenced schema needs to be located, the list of directories is searched in the order in which each was added.
* Once located, the schema is cached to avoid performing repeated lookups in the file system.
* @see [[readSchemaFromXmlFile]] to deserialize a schema.
* @public @preview
*/
export declare class ECSchemaXmlContext {
private _nativeContext;
/** Construct a context with an empty list of search paths. */
constructor();
/** @internal */
get nativeContext(): IModelJsNative.ECSchemaXmlContext;
/** Append a directory to the list of directories that will be searched to locate referenced schemas.
* The directories are searched in the order in which they were added to the list.
* @param searchPath The absolute path to the directory to search.
*/
addSchemaPath(searchPath: string): void;
/** Set the last locater to be used when trying to find a schema
* @param locater Locater that should be used as the last locater when trying to find a schema
* @internal
*/
setSchemaLocater(locater: IModelJsNative.ECSchemaXmlContext.SchemaLocaterCallback): void;
/** Adds a schema locator to the beginning of the list of locators used to search for schemas.
* This schema locator will be prioritized over other locators when searching for schemas in the current context.
* @param locater Locater to add to the current context
* @internal
*/
setFirstSchemaLocater(locater: IModelJsNative.ECSchemaXmlContext.SchemaLocaterCallback): void;
/** Deserialize a [Schema]($ecschema-metadata) from an ECSchemaXML-formatted file.
* @param filePath The absolute path of the XML file.
* @returns The JSON representation of the schema, as a [SchemaProps]($ecschema-metadata).
* @throws [[IModelError]] if there is a problem reading schema from the XML file
*/
readSchemaFromXmlFile(filePath: string): any;
}
//# sourceMappingURL=ECSchemaXmlContext.d.ts.map