schemaRegistry.registerPrismDefaultSchemaResource("xml/ns/public/common/common-3.xsd", "c", com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory.class.getPackage()); // declared by default
public static PrismContextImpl constructPrismContext(File extraSchema) throws SchemaException, FileNotFoundException { SchemaRegistryImpl schemaRegistry = new SchemaRegistryImpl(); schemaRegistry.setCatalogResourceName(TEST_CATALOG_RESOURCE_NAME); DynamicNamespacePrefixMapper prefixMapper = new GlobalDynamicNamespacePrefixMapper(); // Set default namespace? schemaRegistry.setNamespacePrefixMapper(prefixMapper); schemaRegistry.registerPrismDefaultSchemaResource("xml/ns/test/foo-1.xsd", "foo", ObjectFactory.class.getPackage()); schemaRegistry.registerPrismSchemaResource("xml/ns/test/foo-types-1.xsd", "foot", null); schemaRegistry.registerPrismSchemaResource("xml/ns/public/types-3.xsd", "t", com.evolveum.prism.xml.ns._public.types_3.ObjectFactory.class.getPackage()); schemaRegistry.registerPrismSchemaResource("xml/ns/public/query-3.xsd", "q", com.evolveum.prism.xml.ns._public.query_3.ObjectFactory.class.getPackage()); schemaRegistry.registerPrismSchemasFromDirectory(SCHEMA_DIR); if (extraSchema != null){ schemaRegistry.registerPrismSchemaFile(extraSchema); } prefixMapper.registerPrefix(XMLConstants.W3C_XML_SCHEMA_NS_URI, DOMUtil.NS_W3C_XML_SCHEMA_PREFIX, false); prefixMapper.registerPrefix(PrismConstants.NS_ANNOTATION, PrismConstants.PREFIX_NS_ANNOTATION, false); prefixMapper.registerPrefix(PrismInternalTestUtil.NS_WEAPONS, PrismInternalTestUtil.NS_WEAPONS_PREFIX, false); PrismContextImpl prismContext = PrismContextImpl.create(schemaRegistry); prismContext.setObjectsElementName(new QName("http://midpoint.evolveum.com/xml/ns/public/common/common-3", "objects")); return prismContext; }