private static PrismSchema parse(Element element, EntityResolver resolver, PrismSchemaImpl schema, boolean isRuntime, String shortDescription, boolean allowDelayedItemDefinitions, PrismContext prismContext) throws SchemaException { if (element == null) { throw new IllegalArgumentException("Schema element must not be null in "+shortDescription); } setSchemaNamespace(schema, element); DomToSchemaProcessor processor = new DomToSchemaProcessor(resolver, prismContext); processor.parseSchema(schema, element, isRuntime, allowDelayedItemDefinitions, shortDescription); return schema; }
public static void parseSchemas(Element wrapperElement, XmlEntityResolver resolver, List<SchemaDescription> schemaDescriptions, boolean allowDelayedItemDefinitions, PrismContext prismContext) throws SchemaException { for (SchemaDescription schemaDescription : schemaDescriptions) { setSchemaNamespace((PrismSchemaImpl) schemaDescription.getSchema(), schemaDescription.getDomElement()); } DomToSchemaProcessor processor = new DomToSchemaProcessor(resolver, prismContext); processor.parseSchemas(schemaDescriptions, wrapperElement, allowDelayedItemDefinitions, "multiple schemas"); }
/** * Parses single schema. */ void parseSchema(@NotNull PrismSchemaImpl prismSchema, @NotNull Element xsdSchema, boolean isRuntime, boolean allowDelayedItemDefinitions, String shortDescription) throws SchemaException { this.shortDescription = shortDescription; XSSchemaSet xsSchemaSet = parseSchema(xsdSchema); if (xsSchemaSet == null) { return; } DomToSchemaPostProcessor postProcessor = new DomToSchemaPostProcessor(xsSchemaSet, prismContext); postProcessor.postprocessSchema(prismSchema, isRuntime, allowDelayedItemDefinitions, shortDescription); }
XSOMParser parser = createSchemaParser(); InputSource inSource = new InputSource(new ByteArrayInputStream(out.toByteArray()));
/** * Parses several schemas, referenced by a wrapper schema. * Provided to allow circular references (e.g. common-3 -> scripting-3 -> common-3). */ void parseSchemas(List<SchemaDescription> schemaDescriptions, Element wrapper, boolean allowDelayedItemDefinitions, String shortDescription) throws SchemaException { this.shortDescription = shortDescription; XSSchemaSet xsSchemaSet = parseSchema(wrapper); if (xsSchemaSet == null) { return; } for (SchemaDescription schemaDescription : schemaDescriptions) { DomToSchemaPostProcessor postProcessor = new DomToSchemaPostProcessor(xsSchemaSet, prismContext); PrismSchemaImpl prismSchema = (PrismSchemaImpl) schemaDescription.getSchema(); boolean isRuntime = schemaDescription.getCompileTimeClassesPackage() == null; String schemaShortDescription = schemaDescription.getSourceDescription() + " in " + shortDescription; postProcessor.postprocessSchema(prismSchema, isRuntime, allowDelayedItemDefinitions, schemaShortDescription); } }