/** * SchemaInference — G17 * ────────────────────── * Infer a draft XSD schema from one or more XML document samples. * * `inferSchema(docs)` observes element structure, attribute presence/types, * and occurrence frequencies across the sample corpus to produce a * `SchemaModel` and (optionally) an XSD string via `toXsdString()`. * * Design notes * ──────────── * • Types are inferred from text/attribute values using a simple * heuristic cascade: xs:integer → xs:decimal → xs:boolean → xs:date * → xs:dateTime → xs:string. * • minOccurs/maxOccurs are derived from the min/max observed repetitions * across all sample documents (per parent element context). * • All elements are treated as locally-scoped; global complex types are * not generated in this draft phase. * • No external dependencies. */ import { XmlDocument } from '../parser/XmlNodes'; import { SchemaModel } from '../schema/SchemaModel'; export interface InferSchemaOptions { /** * Target namespace URI for the generated schema (default: empty string). */ targetNamespace?: string; /** * Prefix to use for the target namespace in attribute declarations * (default: 'tns'). */ targetNamespacePrefix?: string; /** * When true, elements that always contain only text are given simple types * (default: true). */ inferSimpleTypes?: boolean; /** * When true, mandatory attributes (present in every sample occurrence) get * use="required" (default: true). */ inferRequired?: boolean; /** * P0 fix: maximum nesting depth to traverse during inference. * Prevents complexity spikes on deeply nested XML (default: 50). */ maxDepth?: number; /** * P0 fix: maximum number of distinct element types to track. * Prevents memory blow-up on documents with unbounded element variety (default: 1000). */ maxElements?: number; } /** Result of schema inference */ export interface InferredSchema { /** * The inferred SchemaModel — can be used directly with ValidationEngine, * code-generators, etc. */ model: SchemaModel; /** * Generate an XSD string from the inferred model. */ toXsdString(): string; } /** * Infer a draft XSD schema from one or more XML documents. * * @param docs One or more parsed XML documents to observe. * @param options Optional tuning options. * * @example * const docs = [parseXml(xml1), parseXml(xml2)]; * const { model, toXsdString } = inferSchema(docs); * console.log(toXsdString()); */ export declare function inferSchema(docs: XmlDocument[], options?: InferSchemaOptions): InferredSchema; //# sourceMappingURL=SchemaInference.d.ts.map