Author: kiwiwings
Date: Wed Apr 10 22:41:12 2019
New Revision: 1857286
URL: http://svn.apache.org/viewvc?rev=1857286&view=rev
Log:
(XMLBEANS-536) - unify calls to XmlBeans.compileXmlBeans(Parameters), flag
other compile methods as deprecated
Added:
xmlbeans/branches/xmlbeans-536/src/common/org/apache/xmlbeans/impl/common/Removal.java
Modified:
xmlbeans/branches/xmlbeans-536/src/tools/org/apache/xmlbeans/impl/xsd2inst/SchemaInstanceGenerator.java
xmlbeans/branches/xmlbeans-536/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/StreamInstanceValidator.java
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBeanXSTCHarness.java
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/BindingConfig.java
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlBeans.java
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/CompilationTests.java
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/XmlBeansCompCheckinTests.java
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/common/CompileTestBase.java
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/DetailedCompTests.java
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/XmlBeanCompilationTests.java
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/incr/schemaCompile/detailed/IncrCompilationTests.java
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/som/common/SomTestBase.java
xmlbeans/branches/xmlbeans-536/test/src/misc/detailed/JiraRegression1_50Test.java
xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java
xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/restriction/detailed/EnumTest.java
xmlbeans/branches/xmlbeans-536/test/src/scomp/redefine/detailed/MultipleRedefines.java
xmlbeans/branches/xmlbeans-536/test/src/scomp/substGroup/restriction/detailed/Final.java
xmlbeans/branches/xmlbeans-536/test/src/xmlobject/detailed/TestsFromBugs.java
xmlbeans/branches/xmlbeans-536/test/tools/src/tools/util/SchemaValidator.java
Added:
xmlbeans/branches/xmlbeans-536/src/common/org/apache/xmlbeans/impl/common/Removal.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/common/org/apache/xmlbeans/impl/common/Removal.java?rev=1857286&view=auto
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/common/org/apache/xmlbeans/impl/common/Removal.java
(added)
+++
xmlbeans/branches/xmlbeans-536/src/common/org/apache/xmlbeans/impl/common/Removal.java
Wed Apr 10 22:41:12 2019
@@ -0,0 +1,63 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.xmlbeans.impl.common;
+
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+
+/**
+ * Program elements annotated @Removal track the earliest final release
+ * when a deprecated feature will be removed. This is an internal decoration:
+ * a feature may be removed in a release earlier or later than the release
+ * number specified by this annotation.<p>
+ *
+ * The XmlBeans project policy is to deprecate an element for on the next
major release
+ * before removing. This annotation exists to make it easier to follow up on
the
+ * second step of the two-step deprecate and remove process.<p>
+ *
+ * A deprecated feature may be removed in nightly release prior
+ * to the major release for which it is eligible, but may be removed later for
+ * various reasons. If it is known in advance that the feature will not be
+ * removed in the next major release, a later version should be specified by
this
+ * annotation.<p>
+ *
+ * For example, a feature with a {@code @deprecated XmlBeans 3.1}
+ * is deprecated in XmlBeans 3.1 and may be deleted in the preparation for
XmlBeans 4.0.
+ * This would be annotated {@code @Removal(version="3.17")}.
+ *
+ * @since XmlBeans 3.1.0
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Removal {
+ /**
+ * The XmlBeans version when this feature may be removed.
+ *
+ * To ensure that the version number can be compared to the current version
+ * and a unit test can generate a warning if a removal-eligible feature has
+ * not been removed yet, the version number should adhere to the following
format:
+ * Format: "(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)"
+ * Example: "3.1.5"
+ */
+ String version() default "";
+ // TODO: Verify that the version syntax is valid by parsing with a
version-aware parser like
+ // org.apache.maven.artifact.versioning.DefaultArtifactVersion
+}
Modified:
xmlbeans/branches/xmlbeans-536/src/tools/org/apache/xmlbeans/impl/xsd2inst/SchemaInstanceGenerator.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/tools/org/apache/xmlbeans/impl/xsd2inst/SchemaInstanceGenerator.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/tools/org/apache/xmlbeans/impl/xsd2inst/SchemaInstanceGenerator.java
(original)
+++
xmlbeans/branches/xmlbeans-536/src/tools/org/apache/xmlbeans/impl/xsd2inst/SchemaInstanceGenerator.java
Wed Apr 10 22:41:12 2019
@@ -15,25 +15,15 @@
package org.apache.xmlbeans.impl.xsd2inst;
-import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
+import org.apache.xmlbeans.impl.tool.CommandLine;
+import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
-import java.util.ArrayList;
-import java.io.File;
-import java.util.HashSet;
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlBeans;
-import org.apache.xmlbeans.SchemaTypeSystem;
-import org.apache.xmlbeans.SchemaType;
-import org.apache.xmlbeans.impl.xsd2inst.SampleXmlUtil;
-import java.util.Set;
-import org.apache.xmlbeans.XmlException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collection;
-import org.apache.xmlbeans.impl.tool.CommandLine;
+import java.util.*;
public class SchemaInstanceGenerator
{
@@ -310,9 +300,12 @@ public class SchemaInstanceGenerator
if (options.isNoupa())
compileOptions.setCompileNoUpaRule();
- try
- {
- sts = XmlBeans.compileXsd(schemas,
XmlBeans.getBuiltinTypeSystem(), compileOptions);
+ try {
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(schemas);
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setOptions(compileOptions);
+ sts = XmlBeans.compileXmlBeans(params);
}
catch (Exception e)
{
Modified:
xmlbeans/branches/xmlbeans-536/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java
(original)
+++
xmlbeans/branches/xmlbeans-536/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java
Wed Apr 10 22:41:12 2019
@@ -73,7 +73,7 @@ public class SchemaTypeSystemCompiler
return schemas;
}
- public void setSchemas(SchemaDocument.Schema[] schemas)
+ public void setSchemas(SchemaDocument.Schema... schemas)
{
this.schemas = schemas;
}
@@ -172,7 +172,7 @@ public class SchemaTypeSystemCompiler
return inputXmls;
}
- public void setInputXmls(XmlObject[] inputXmls) {
+ public void setInputXmls(XmlObject... inputXmls) {
this.inputXmls = inputXmls;
}
@@ -431,7 +431,7 @@ public class SchemaTypeSystemCompiler
/**
* Generate java source files for a SchemaTypeSystem.
* Please do not invoke this method directly as the signature could change
unexpectedly.
- * Use {@link org.apache.xmlbeans.XmlBeans#compileXmlBeans}
+ * Use {@link org.apache.xmlbeans.XmlBeans#compileXmlBeans(Parameters)}
*
* @param system the SchemaTypeSystem to generated java source for
* @param filer to create the java source files
Modified:
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java
(original)
+++
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java
Wed Apr 10 22:41:12 2019
@@ -20,6 +20,7 @@ import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import java.util.Collections;
import java.util.List;
@@ -153,8 +154,14 @@ public class InstanceValidator
try
{
- if (schemas != null && schemas.length > 0)
- sLoader = XmlBeans.compileXsd(schemas, sLoader, schemaOptions);
+ if (schemas != null && schemas.length > 0) {
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(schemas);
+ params.setLinkTo(sLoader);
+ params.setOptions(schemaOptions);
+
+ sLoader = XmlBeans.compileXmlBeans(params);
+ }
}
catch (Exception e)
{
Modified:
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/StreamInstanceValidator.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/StreamInstanceValidator.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/StreamInstanceValidator.java
(original)
+++
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/StreamInstanceValidator.java
Wed Apr 10 22:41:12 2019
@@ -23,6 +23,7 @@ import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlOptionsBean;
import org.apache.xmlbeans.XmlError;
import org.apache.xmlbeans.impl.common.StaxHelper;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.apache.xmlbeans.impl.validator.ValidatingXMLStreamReader;
import javax.xml.stream.XMLInputFactory;
@@ -141,8 +142,13 @@ public class StreamInstanceValidator
sLoader =
XmlBeans.typeLoaderForResource(XmlBeans.resourceLoaderForPath(jarFiles));
try {
- if (schemas != null && schemas.length > 0)
- sLoader = XmlBeans.compileXsd(schemas, sLoader, schemaOptions);
+ if (schemas != null && schemas.length > 0) {
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(schemas);
+ params.setLinkTo(sLoader);
+ params.setOptions(schemaOptions);
+ sLoader = XmlBeans.compileXmlBeans(params);
+ }
}
catch (Exception e) {
if (compErrors.isEmpty() || !(e instanceof XmlException)) {
Modified:
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java
(original)
+++
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java
Wed Apr 10 22:41:12 2019
@@ -36,6 +36,7 @@ import java.util.Set;
import java.util.HashSet;
import java.io.File;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
public class TypeHierarchyPrinter
@@ -148,9 +149,12 @@ public class TypeHierarchyPrinter
if (jarFiles != null && jarFiles.length > 0)
linkTo =
XmlBeans.typeLoaderForResource(XmlBeans.resourceLoaderForPath(jarFiles));
- try
- {
- typeSystem = XmlBeans.compileXsd(schemas, linkTo, schemaOptions);
+ try {
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(schemas);
+ params.setLinkTo(linkTo);
+ params.setOptions(schemaOptions);
+ typeSystem = XmlBeans.compileXmlBeans(params);
}
catch (XmlException e)
{
Modified:
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBeanXSTCHarness.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBeanXSTCHarness.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBeanXSTCHarness.java
(original)
+++
xmlbeans/branches/xmlbeans-536/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBeanXSTCHarness.java
Wed Apr 10 22:41:12 2019
@@ -21,6 +21,7 @@ import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.SchemaTypeSystem;
import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import java.util.Collection;
import java.util.ArrayList;
@@ -47,15 +48,20 @@ public class XMLBeanXSTCHarness implemen
// step 1, load schema file etc.
SchemaTypeLoader loader = null;
- try
- {
- XmlObject schema =
XmlObject.Factory.parse(testCase.getSchemaFile(), new
XmlOptions().setErrorListener(errors).setLoadLineNumbers());
- XmlObject schema2 = null;
- if (testCase.getResourceFile() != null)
- schema2 =
XmlObject.Factory.parse(testCase.getResourceFile(), new
XmlOptions().setErrorListener(errors).setLoadLineNumbers());
- XmlObject[] schemas = schema2 == null ? new XmlObject[] {
schema } : new XmlObject[] { schema, schema2 };
- SchemaTypeSystem system = XmlBeans.compileXsd(schemas,
XmlBeans.getBuiltinTypeSystem(), new XmlOptions().setErrorListener(errors));
- loader = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[] {
system, XmlBeans.getBuiltinTypeSystem() });
+ try {
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ XmlOptions options = new
XmlOptions().setErrorListener(errors).setLoadLineNumbers();
+ XmlObject schema =
XmlObject.Factory.parse(testCase.getSchemaFile(), options);
+ if (testCase.getResourceFile() != null) {
+ params.setInputXmls(schema,
XmlObject.Factory.parse(testCase.getResourceFile(), options));
+ } else {
+ params.setInputXmls(schema);
+ }
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setOptions(options);
+
+ SchemaTypeSystem system = XmlBeans.compileXmlBeans(params);
+ loader = XmlBeans.typeLoaderUnion(system,
XmlBeans.getBuiltinTypeSystem());
}
catch (Exception e)
{
Modified:
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/BindingConfig.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/BindingConfig.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/BindingConfig.java
(original)
+++
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/BindingConfig.java
Wed Apr 10 22:41:12 2019
@@ -21,7 +21,7 @@ import javax.xml.namespace.QName;
* The BindingConfig class is used during compilation to control the
generation of java source files.
* The default BindingConfig does nothing, but sub-classes should provide more
interesting behavior.
*
- * @see XmlBeans#compileXmlBeans(String, SchemaTypeSystem, XmlObject[],
BindingConfig, SchemaTypeLoader, Filer, XmlOptions) XmlBeans.compileXmlBeans()
+ * @see
XmlBeans#compileXmlBeans(org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.Parameters)
XmlBeans.compileXmlBeans()
*/
public class BindingConfig
{
Modified:
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlBeans.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlBeans.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlBeans.java
(original)
+++
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlBeans.java
Wed Apr 10 22:41:12 2019
@@ -15,6 +15,7 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.common.Removal;
import org.apache.xmlbeans.impl.common.XmlErrorWatcher;
import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
import org.apache.xmlbeans.impl.schema.PathResourceLoader;
@@ -324,7 +325,11 @@ public final class XmlBeans
* @param schemas The schema definitions from which to build the schema
type system.
* @param typepath The path to already-compiled schema types for linking
while processing.
* @param options Options specifying an error listener and/or validation
behavior.
+ *
+ * @deprecated use {@link #compileXmlBeans(Parameters)} instead
*/
+ @Removal(version = "4.0")
+ @Deprecated
public static SchemaTypeSystem compileXsd(XmlObject[] schemas,
SchemaTypeLoader typepath, XmlOptions options) throws XmlException
{
return compileXmlBeans(null, null, schemas, null, typepath, null,
options);
@@ -372,7 +377,11 @@ public final class XmlBeans
* @param schemas The schema definitions from which to build the schema
type system.
* @param typepath The path to already-compiled schema types for linking
while processing.
* @param options Options specifying an error listener and/or validation
behavior.
+ *
+ * @deprecated use {@link #compileXmlBeans(Parameters)} instead
*/
+ @Removal(version = "4.0")
+ @Deprecated
public static SchemaTypeSystem compileXsd(SchemaTypeSystem system,
XmlObject[] schemas, SchemaTypeLoader typepath, XmlOptions options) throws
XmlException
{
return compileXmlBeans(null, system, schemas, null, typepath, null,
options);
@@ -436,7 +445,12 @@ public final class XmlBeans
* @param typepath The path to already-compiled schema types for linking
while processing.
* @param filer The Filer instance used to create binary binding files and
source text files.
* @param options Options specifying an error listener and/or validation
behavior.
+ *
+ * @deprecated use {@link #compileXmlBeans(Parameters)} instead
+ *
*/
+ @Removal(version = "4.0")
+ @Deprecated
public static SchemaTypeSystem compileXmlBeans(String name,
SchemaTypeSystem system, XmlObject[] schemas, BindingConfig config,
SchemaTypeLoader typepath, Filer filer, XmlOptions options) throws XmlException
{
Parameters params = new Parameters();
params.setName(name);
@@ -446,8 +460,65 @@ public final class XmlBeans
params.setLinkTo(typepath);
params.setFiler(filer);
params.setOptions(options);
+ return compileXmlBeans(params);
+ }
- XmlErrorWatcher xew = setErrorWatcher(params, options);
+ /**
+ * Returns the SchemaTypeSystem that results from augumenting the
+ * SchemaTypeSystem passed in by incrementally adding the given XML
+ * schema definitions.<p>
+ *
+ * These could be new definitions (if the Schema document is not recorded
into
+ * the existing SchemaTypeSystem), modifications to the already existing
+ * definitions (if the Schema document is already recorded in the existing
+ * SchemaTypeSystem), or deletions (if the Schema document is already
recorded
+ * in the existing SchemaTypeSystem and the new definitions are empty).
+ * The identity of documents is established using
+ * {@link XmlDocumentProperties#getSourceName}, so if the caller chooses to
+ * construct the Schema definitions using other methods than parsing an
+ * XML document, they should make sure that the names returned by that
+ * method are consistent with the caller's intent (add/modify).<p>
+ *
+ * The XmlObjects passed via {@link Parameters#setInputXmls(XmlObject[])}
should
+ * be w3c <schema> elements whose type
+ * is org.w3c.x2001.xmlSchema.Schema. (That is, schema elements in
+ * the XML namespace http://www.w3c.org/2001/XMLSchema.) Also
+ * org.w3c.x2001.xmlSchema.SchemaDocument is permitted.<p>
+ *
+ * The optional name passed via {@link Parameters#setName(String)} is used
to name
+ * the compiled schema type system.
+ * A randomly generated name will be used if the name is null.<p>
+ *
+ * The optional BindingConfig passed via {@link
Parameters#setConfig(BindingConfig)}
+ * is used to control the shape of the generated code. A BindingConfig
isn't
+ * used if {@link Parameters#getFiler()} is null.<p>
+ *
+ * The optional SchemaTypeLoader passed via {@link
Parameters#setLinkTo(SchemaTypeLoader)} will be
+ * consulted for already-compiled schema types which may be linked
+ * while processing the given schemas. If not specified, the context
+ * typeloader (as returned by {@link #getContextTypeLoader}) will be
used.<p>
+ *
+ * The optional Filer passed via {@link Parameters#setFiler(Filer)} is
used to
+ * create new binary or source files which are the product of the
compilation.
+ * If the Filer is null, the schema binaries (.xsb) files and source files
won't be generated.<p>
+ *
+ * The SchemaTypeSystem passed via {@link
Parameters#setExistingTypeSystem(SchemaTypeSystem)}
+ * that is returned should be combined (via {@link #typeLoaderUnion}) with
the typepath typeloader
+ * in order to create a typeloader that can be used for creating and
validating instances.<p>
+ *
+ * Use the {@link Parameters#setOptions(XmlOptions)} to specify the
following:<p>
+ *
+ * <ul>
+ * <li>A collection instance that should be used as an error listener
during
+ * compilation, as described in {@link XmlOptions#setErrorListener}.
+ * <li>Whether validation should not be done when building the
SchemaTypeSystem,
+ * as described in {@link XmlOptions#setCompileNoValidation}.
+ * </ul>
+ *
+ * @param params the schema compiler parameters
+ */
+ public static SchemaTypeSystem compileXmlBeans(Parameters params) throws
XmlException {
+ XmlErrorWatcher xew = setErrorWatcher(params, params.getOptions());
SchemaTypeSystem sts = SchemaTypeSystemCompiler.compile(params);
@@ -458,6 +529,7 @@ public final class XmlBeans
return sts;
}
+
@SuppressWarnings("unchecked")
private static XmlErrorWatcher setErrorWatcher(Parameters params,
XmlOptions options) {
Collection<XmlError> errorListener = (options != null &&
options.hasOption (XmlOptions.ERROR_LISTENER))
Modified:
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java
(original)
+++
xmlbeans/branches/xmlbeans-536/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java
Wed Apr 10 22:41:12 2019
@@ -15,6 +15,7 @@
package org.apache.xmlbeans;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.xml.sax.EntityResolver;
import org.xml.sax.XMLReader;
@@ -216,7 +217,7 @@ public class XmlOptions implements java.
* @see XmlError
* @see XmlObject.Factory#parse(java.io.File, XmlOptions)
* @see XmlObject#validate(XmlOptions)
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
* @see XmlOptions#setLoadLineNumbers
*/
public XmlOptions setErrorListener (Collection c) {
@@ -672,7 +673,7 @@ public class XmlOptions implements java.
*
* @param nameMap a map from <code>QName</code>s to substitute
<code>QName</code>s.
*
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setCompileSubstituteNames (Map nameMap) {
return set( COMPILE_SUBSTITUTE_NAMES, nameMap );
@@ -682,7 +683,7 @@ public class XmlOptions implements java.
* If this option is set, validation is not done on the Schema XmlBeans
* when building a <code>SchemaTypeSystem</code>
*
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setCompileNoValidation () {
return set( COMPILE_NO_VALIDATION );
@@ -694,7 +695,7 @@ public class XmlOptions implements java.
* <a target="_blank"
href="http://www.w3.org/TR/xmlschema-1/#non-ambig">Appendix H of the XML Schema
specification</a>
* for information on the UPA rule.
*
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setCompileNoUpaRule () {
return set( COMPILE_NO_UPA_RULE );
@@ -706,7 +707,7 @@ public class XmlOptions implements java.
* <a target="_blank"
href="http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict">Section 3.9.6 of
the XML Schema specification</a>
* for information on the PVR rule.
*
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setCompileNoPvrRule () {
return set( COMPILE_NO_PVR_RULE );
@@ -716,7 +717,7 @@ public class XmlOptions implements java.
* if this option is set, the schema compiler will skip annotations when
* processing Schema components.
*
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setCompileNoAnnotations() {
return set( COMPILE_NO_ANNOTATIONS );
@@ -726,7 +727,7 @@ public class XmlOptions implements java.
* If this option is set, then the schema compiler will try to download
* schemas that appear in imports and includes from network based URLs.
*
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setCompileDownloadUrls () {
return set( COMPILE_DOWNLOAD_URLS);
@@ -741,7 +742,7 @@ public class XmlOptions implements java.
*
* @param mdefNamespaces a set of namespace URIs as Strings
*
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setCompileMdefNamespaces(Set mdefNamespaces)
{
@@ -802,7 +803,7 @@ public class XmlOptions implements java.
* are not consulted by other functions, for example, parse.
* This will likely change in the future.
*
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setEntityResolver(EntityResolver resolver) {
return set( ENTITY_RESOLVER, resolver );
@@ -813,7 +814,7 @@ public class XmlOptions implements java.
* URI will be considered as base URI when deciding the directory
* structure for saving the sources inside the generated JAR file.
* @param baseURI the URI to be considered as "base"
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setBaseURI(URI baseURI) {
return set( BASE_URI, baseURI );
@@ -824,7 +825,7 @@ public class XmlOptions implements java.
* SchemaTypeCodePrinter.Printer will be used to generate the
* Java code.
*
- * @see XmlBeans#compileXsd
+ * @see XmlBeans#compileXmlBeans(SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setSchemaCodePrinter(SchemaCodePrinter printer) {
return set( SCHEMA_CODE_PRINTER, printer );
@@ -840,7 +841,7 @@ public class XmlOptions implements java.
*
* @see #GENERATE_JAVA_14
* @see #GENERATE_JAVA_15
- * @see XmlBeans#compileXmlBeans
+ * @see
XmlBeans#compileXmlBeans(org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.Parameters)
*/
public XmlOptions setGenerateJavaVersion (String source) {
return set( GENERATE_JAVA_VERSION, source );
Modified:
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/CompilationTests.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/CompilationTests.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/CompilationTests.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/CompilationTests.java
Wed Apr 10 22:41:12 2019
@@ -17,6 +17,7 @@ package compile.scomp.checkin;
import org.apache.xmlbeans.*;
import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.apache.xmlbeans.impl.tool.CodeGenUtil;
import org.apache.xmlbeans.impl.tool.Diff;
import org.apache.xmlbeans.impl.tool.SchemaCodeGenerator;
@@ -100,7 +101,11 @@ public class CompilationTests {
List errors = new ArrayList();
XmlOptions options = (new XmlOptions()).setErrorListener(errors);
SchemaTypeSystem builtin = XmlBeans.getBuiltinTypeSystem();
- system = XmlBeans.compileXsd(schemas, builtin, options);
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setSchemas(schemas);
+ params.setLinkTo(builtin);
+ params.setOptions(options);
+ system = XmlBeans.compileXmlBeans(params);
Assert.assertNotNull("Compilation failed during inititial compile.",
system);
System.out.println("-= Initial Compile =-");
@@ -116,11 +121,16 @@ public class CompilationTests {
// Incremental compile
String url = schemas[n - 2].documentProperties().getSourceName();
- SchemaDocument.Schema[] schemas1 = new SchemaDocument.Schema[1];
- schemas1[0] = SchemaDocument.Factory.parse(files[n - 1]).getSchema();
- schemas1[0].documentProperties().setSourceName(url);
+ SchemaDocument.Schema schemas1 = SchemaDocument.Factory.parse(files[n
- 1]).getSchema();
+ schemas1.documentProperties().setSourceName(url);
errors.clear();
- system = XmlBeans.compileXsd(system, schemas1, builtin, options);
+ params = new SchemaTypeSystemCompiler.Parameters();
+ params.setExistingTypeSystem(system);
+ params.setSchemas(schemas1);
+ params.setLinkTo(builtin);
+ params.setOptions(options);
+
+ system = XmlBeans.compileXmlBeans(params);
Assert.assertNotNull("Compilation failed during incremental compile.",
system);
SchemaCodeGenerator.saveTypeSystem(system, outincr, null, null, null);
System.out.println("-= Incremental Compile =-");
@@ -135,8 +145,13 @@ public class CompilationTests {
}
// Now compile non-incrementally for the purpose of comparing the
result
errors.clear();
- schemas[n - 2] = schemas1[0];
- system = XmlBeans.compileXsd(schemas, builtin, options);
+ schemas[n - 2] = schemas1;
+ params = new SchemaTypeSystemCompiler.Parameters();
+ params.setSchemas(schemas);
+ params.setLinkTo(builtin);
+ params.setOptions(options);
+
+ system = XmlBeans.compileXmlBeans(params);
Assert.assertNotNull("Compilation failed during reference compile.",
system);
SchemaCodeGenerator.saveTypeSystem(system, out, null, null, null);
@@ -185,8 +200,10 @@ public class CompilationTests {
SchemaBookmark sb = new SchemaBookmark("MyBookmark");
cTypes[i].newCursor().setBookmark(sb);
// Compile it into STS
- SchemaTypeSystem sts = XmlBeans.compileXsd(new XmlObject[]{parsed},
- XmlBeans.getBuiltinTypeSystem(), null);
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(parsed);
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ SchemaTypeSystem sts = XmlBeans.compileXmlBeans(params);
Assert.assertNotNull("Could not compile person.xsd", sts);
SchemaType personType = sts.findType(QNameHelper.forLNS("person",
"http://openuri.org/mytest"));
Assert.assertNotNull("Could not find the \"person\" schema type",
personType);
Modified:
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/XmlBeansCompCheckinTests.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/XmlBeansCompCheckinTests.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/XmlBeansCompCheckinTests.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/checkin/XmlBeansCompCheckinTests.java
Wed Apr 10 22:41:12 2019
@@ -18,6 +18,7 @@ import compile.scomp.common.CompileCommo
import compile.scomp.common.CompileTestBase;
import compile.scomp.common.mockobj.TestFiler;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.Parameters;
import org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl;
import org.junit.After;
import org.junit.Test;
@@ -67,11 +68,17 @@ public class XmlBeansCompCheckinTests ex
public void test_Filer_compilation() throws Exception
{
XmlObject obj1 = XmlObject.Factory.parse(forXsd);
- XmlObject[] schemas = new XmlObject[]{obj1};
TestFiler f = new TestFiler();//FilerImpl(fClass, fSrc, repackage,
true, false);
- SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans("apiCompile", null,
- schemas, null, XmlBeans.getBuiltinTypeSystem(), f, xm_opts);
+
+ Parameters params = new Parameters();
+ params.setName("apiCompile");
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(obj1);
+ params.setFiler(f);
+ params.setOptions(xm_opts);
+
+ SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans(params);
for (int i = 0; i < apiSts.globalElements().length; i++) {
@@ -103,11 +110,8 @@ public class XmlBeansCompCheckinTests ex
public void test_sts_noSave() throws Exception
{
XmlObject obj1 = XmlObject.Factory.parse(forXsd);
- XmlObject[] schemas = new XmlObject[]{obj1};
XmlObject obj2 = XmlObject.Factory.parse(incrXsd);
- XmlObject[] schemas2 = new XmlObject[]{obj2};
XmlObject obj3 = XmlObject.Factory.parse(errXsd);
- XmlObject[] schemas3 = new XmlObject[]{obj3};
SchemaTypeSystem sts;
TestFiler f = new TestFiler();
@@ -117,9 +121,11 @@ public class XmlBeansCompCheckinTests ex
try {
// since you can't save a partial SOM, don't bother passing in a
Filer
- sts = XmlBeans.compileXmlBeans(null,
- null, schemas3, null,
- XmlBeans.getBuiltinTypeSystem(), null, opt);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(obj3);
+ params.setOptions(opt);
+ sts = XmlBeans.compileXmlBeans(params);
boolean psom_expError = false;
// print out the recovered xm_errors
if (!err.isEmpty()) {
@@ -218,9 +224,12 @@ public class XmlBeansCompCheckinTests ex
err.clear();
//filer methods on partial SOM should not be returned
- sts = XmlBeans.compileXmlBeans(null,
- null, schemas3, null,
- XmlBeans.getBuiltinTypeSystem(), tf, opt);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(obj3);
+ params.setFiler(tf);
+ params.setOptions(opt);
+ sts = XmlBeans.compileXmlBeans(params);
assertTrue("Errors was not empty", !err.isEmpty());
//make sure nothing was written
@@ -255,23 +264,26 @@ public class XmlBeansCompCheckinTests ex
public void test_entrypoint_nullVals() throws Exception
{
XmlObject obj1 = XmlObject.Factory.parse(forXsd);
- XmlObject[] schemas = new XmlObject[]{obj1};
TestFiler f = new TestFiler();
- SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans(null, null,
- schemas, null, XmlBeans.getBuiltinTypeSystem(), null, null);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(obj1);
+
+ SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans(params);
System.out.println("Name: " + apiSts.getName());
printSTS(apiSts);
- apiSts = XmlBeans.compileXmlBeans(null, null,
- null, null, XmlBeans.getBuiltinTypeSystem(), null, null);
+ params.setInputXmls(null);
+
+ apiSts = XmlBeans.compileXmlBeans(params);
printSTS(apiSts);
boolean iArgExThrown = false;
try {
- apiSts = XmlBeans.compileXmlBeans(null, null,
- null, null, null, null, null);
+ params = new Parameters();
+ apiSts = XmlBeans.compileXmlBeans(params);
printSTS(apiSts);
} catch (IllegalArgumentException iaEx) {
@@ -284,8 +296,9 @@ public class XmlBeansCompCheckinTests ex
iArgExThrown = false;
try {
- apiSts = XmlBeans.compileXmlBeans(null, null,
- schemas, null, null, null, null);
+ params.setInputXmls(obj1);
+ params.setLinkTo(null);
+ apiSts = XmlBeans.compileXmlBeans(params);
printSTS(apiSts);
} catch (IllegalArgumentException iaEx) {
iArgExThrown = true;
Modified:
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/common/CompileTestBase.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/common/CompileTestBase.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/common/CompileTestBase.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/common/CompileTestBase.java
Wed Apr 10 22:41:12 2019
@@ -15,6 +15,7 @@
package compile.scomp.common;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.apache.xmlbeans.impl.tool.Diff;
import org.apache.xmlbeans.impl.tool.SchemaCodeGenerator;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
@@ -187,8 +188,13 @@ public class CompileTestBase extends Com
public SchemaTypeSystem incrCompileXsd(SchemaTypeSystem system,
XmlObject[] schemas,
SchemaTypeLoader typepath,
XmlOptions options) throws XmlException, IOException {
- SchemaTypeSystem sts;
- sts = XmlBeans.compileXsd(system, schemas, builtin, options);
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setExistingTypeSystem(system);
+ params.setInputXmls(schemas);
+ params.setLinkTo(builtin);
+ params.setOptions(options);
+
+ SchemaTypeSystem sts = XmlBeans.compileXmlBeans(params);
assertNotNull("Compilation failed during Incremental Compile.", sts);
SchemaCodeGenerator.saveTypeSystem(sts, outincr, null, null, null);
return sts;
@@ -202,7 +208,11 @@ public class CompileTestBase extends Com
XmlOptions options, File outDir)
throws XmlException, IOException {
SchemaTypeSystem system;
SchemaTypeSystem builtin = XmlBeans.getBuiltinTypeSystem();
- system = XmlBeans.compileXsd(schemas, builtin, options);
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(schemas);
+ params.setLinkTo(builtin);
+ params.setOptions(options);
+ system = XmlBeans.compileXmlBeans(params);
assertNotNull("Compilation failed during compile.", system);
SchemaCodeGenerator.saveTypeSystem(system, outDir, null, null, null);
return system;
@@ -214,7 +224,11 @@ public class CompileTestBase extends Com
XmlOptions options) throws
XmlException, IOException {
SchemaTypeSystem system;
SchemaTypeSystem builtin = XmlBeans.getBuiltinTypeSystem();
- system = XmlBeans.compileXsd(schemas, builtin, options);
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(schemas);
+ params.setLinkTo(builtin);
+ params.setOptions(options);
+ system = XmlBeans.compileXmlBeans(params);
assertNotNull("Compilation failed during compile.", system);
SchemaCodeGenerator.saveTypeSystem(system, out, null, null, null);
return system;
Modified:
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/DetailedCompTests.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/DetailedCompTests.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/DetailedCompTests.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/DetailedCompTests.java
Wed Apr 10 22:41:12 2019
@@ -17,6 +17,7 @@ package compile.scomp.detailed;
import compile.scomp.common.CompileCommon;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.Parameters;
import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
import org.junit.Test;
@@ -44,15 +45,17 @@ public class DetailedCompTests {
XmlObject xObj = XmlObject.Factory.parse(
new File(CompileCommon.fileLocation+"/detailed/laxDoc.xsd"));
- XmlObject[] schemas = new XmlObject[]{xObj};
-
// ensure exception is thrown when
// xmloptions flag is not set
boolean valDocEx = false;
try{
- SchemaTypeSystem sts = XmlBeans.compileXmlBeans(null, null,
- schemas, null, XmlBeans.getBuiltinTypeSystem(), null, xm_opt);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(xObj);
+ params.setOptions(xm_opt);
+
+ SchemaTypeSystem sts = XmlBeans.compileXmlBeans(params);
assertNotNull("STS was null", sts);
}catch(XmlException xmlEx){
valDocEx = true;
@@ -86,9 +89,12 @@ public class DetailedCompTests {
//ensure no exception when error
xm_opt = xm_opt.setCompileNoValidation();
try {
- SchemaTypeSystem sts = XmlBeans.compileXmlBeans(null, null,
- schemas, null, XmlBeans.getBuiltinTypeSystem(), null,
- xm_opt);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(xObj);
+ params.setOptions(xm_opt);
+
+ SchemaTypeSystem sts = XmlBeans.compileXmlBeans(params);
if(!err.isEmpty())
throw new Exception("Error listener should be empty");
@@ -152,7 +158,6 @@ public class DetailedCompTests {
String schema;
String xml;
SchemaTypeSystem typeSystem;
- XmlObject[] parsedSchema = new XmlObject[1];
XmlObject parsedDoc;
XmlOptions opts = new XmlOptions();
ArrayList errors = new ArrayList();
@@ -161,10 +166,11 @@ public class DetailedCompTests {
// 1. Negative test - Error if xs:NOTATION used directly
schema = schema_begin + root_decl + notation1 + root_end + schema_end;
-// System.out.println(schema);
- parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+ Parameters params = new Parameters();
+ params.setInputXmls(SchemaDocument.Factory.parse(schema));
+ params.setOptions(opts);
errors.clear();
- XmlBeans.compileXsd(parsedSchema, null, opts);
+ XmlBeans.compileXmlBeans(params);
assertTrue("Expected error: NOTATION type cannot be used directly",
errors.size() == 1);
assertEquals("Expected error: NOTATION type cannot be used directly",
XmlErrorCodes.ATTR_NOTATION_TYPE_FORBIDDEN,
((XmlError)errors.get(0)).getErrorCode());
@@ -172,10 +178,9 @@ public class DetailedCompTests {
// 2. Negative test - Error if xs:NOTATION restricted without
enumeration
schema = schema_begin + root_decl + att_decl + root_end + notation2 +
schema_end;
-// System.out.println(schema);
- parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+ params.setInputXmls(SchemaDocument.Factory.parse(schema));
errors.clear();
- XmlBeans.compileXsd(parsedSchema, null, opts);
+ XmlBeans.compileXmlBeans(params);
assertTrue("Expected error: restriction of NOTATION must use
enumeration facet", errors.size() == 1);
assertEquals("Expected error: restriction of NOTATION must use
enumeration facet",
XmlErrorCodes.DATATYPE_ENUM_NOTATION,
((XmlError)errors.get(0)).getErrorCode());
@@ -184,10 +189,9 @@ public class DetailedCompTests {
// 3. Warning if xs:NOTATION used as type of an element
final String correctTypes = simpleTypeDef + notation6 + enumDef;
schema = schema_begin + root_decl + notation3 + root_end +
correctTypes + schema_end;
-// System.out.println(schema);
- parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+ params.setInputXmls(SchemaDocument.Factory.parse(schema));
errors.clear();
- XmlBeans.compileXsd(parsedSchema, null, opts);
+ XmlBeans.compileXmlBeans(params);
assertTrue("Expected warning: NOTATION-derived type should not be used
on elements", errors.size() == 1);
assertEquals("Expected warning: NOTATION-derived type should not be
used on elements",
XmlErrorCodes.ELEM_COMPATIBILITY_TYPE,
((XmlError)errors.get(0)).getErrorCode());
@@ -196,10 +200,9 @@ public class DetailedCompTests {
// 4. Warning if xs:NOTATION is used in a Schema with target namespace
schema = schema_begin.substring(0, schema_begin.length() - 2) +
notation4 + root_decl +
att_decl + root_end + correctTypes + schema_end;
-// System.out.println(schema);
- parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+ params.setInputXmls(SchemaDocument.Factory.parse(schema));
errors.clear();
- XmlBeans.compileXsd(parsedSchema, null, opts);
+ XmlBeans.compileXmlBeans(params);
assertTrue("Expected warning: NOTATION-derived type should not be used
in a Schema with target namespace", errors.size() == 1);
assertEquals("Expected warning: NOTATION-derived type should not be
used in a Schema with target namespace",
XmlErrorCodes.ATTR_COMPATIBILITY_TARGETNS,
((XmlError)errors.get(0)).getErrorCode());
@@ -208,10 +211,9 @@ public class DetailedCompTests {
// 5. Warning - Deprecation of minLength, maxLength and length facets
schema = schema_begin + root_decl + att_decl + root_end +
simpleTypeDef + notation5 +
enumDef + schema_end;
-// System.out.println(schema);
- parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+ params.setInputXmls(SchemaDocument.Factory.parse(schema));
errors.clear();
- XmlBeans.compileXsd(parsedSchema, null, opts);
+ XmlBeans.compileXmlBeans(params);
assertTrue("Expected warning: length facet cannot be used on a type
derived from NOTATION", errors.size() == 1);
assertEquals("Expected warning: length facet cannot be used on a type
derived from NOTATION",
XmlErrorCodes.FACETS_DEPRECATED_NOTATION,
((XmlError)errors.get(0)).getErrorCode());
@@ -219,10 +221,9 @@ public class DetailedCompTests {
// 6. Positive test - Test restriction via enumeration, then same as 2
schema = schema_begin + root_decl + att_decl + root_end + correctTypes
+ schema_end;
-// System.out.println(schema);
- parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+ params.setInputXmls(SchemaDocument.Factory.parse(schema));
errors.clear();
- typeSystem = XmlBeans.compileXsd(parsedSchema, null, opts);
+ typeSystem = XmlBeans.compileXmlBeans(params);
assertTrue("Expected no errors or warnings", errors.size() == 0);
SchemaType docType = typeSystem.findDocumentType(new QName("",
"root"));
SchemaType type = docType.getElementProperty(new QName("",
"root")).getType().
Modified:
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/XmlBeanCompilationTests.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/XmlBeanCompilationTests.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/XmlBeanCompilationTests.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/detailed/XmlBeanCompilationTests.java
Wed Apr 10 22:41:12 2019
@@ -19,6 +19,7 @@ import compile.scomp.common.CompileTestB
import compile.scomp.common.mockobj.TestBindingConfig;
import compile.scomp.common.mockobj.TestFiler;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.Parameters;
import org.apache.xmlbeans.impl.xb.xmlconfig.ConfigDocument;
import org.junit.After;
import org.junit.Test;
@@ -103,11 +104,17 @@ public class XmlBeanCompilationTests ext
XmlObject obj1 = XmlObject.Factory.parse(new File(dir + P + "po.xsd"));
XmlObject obj2 = XmlObject.Factory.parse(
new File(dir2 + P + "company.xsd"));
- XmlObject[] schemas = new XmlObject[]{obj1, obj2};
//filer must be present on this method
- SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans("apiCompile", null,
- schemas, bind, XmlBeans.getBuiltinTypeSystem(), f, xm_opts);
+ Parameters params = new Parameters();
+ params.setName("apiCompile");
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(obj1, obj2);
+ params.setConfig(bind);
+ params.setFiler(f);
+ params.setOptions(xm_opts);
+
+ SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans(params);
if (!bind.isIslookupPrefixForNamespace())
throw new Exception("isIslookupPrefixForNamespace not invoked");
@@ -135,17 +142,14 @@ public class XmlBeanCompilationTests ext
public void test_incrCompile() throws Exception {
XmlObject obj1 = XmlObject.Factory.parse(forXsd);
obj1.documentProperties().setSourceName("OBJ1");
- XmlObject[] schemas = new XmlObject[]{obj1};
QName sts1 = new QName("http://baz", "elName");
XmlObject obj2 = XmlObject.Factory.parse(incrXsd);
obj2.documentProperties().setSourceName("OBJ2");
- XmlObject[] schemas2 = new XmlObject[]{obj2};
QName sts2 = new QName("http://bar", "elName");
XmlObject obj3 = XmlObject.Factory.parse(errXsd);
obj3.documentProperties().setSourceName("OBJ3");
- XmlObject[] schemas3 = new XmlObject[]{obj3};
QName sts3 = new QName("http://bar", "elErrName");
SchemaTypeSystem sts;
@@ -154,9 +158,11 @@ public class XmlBeanCompilationTests ext
opt.put("COMPILE_PARTIAL_TYPESYSTEM");
//BASIC COMPILATION
- sts = XmlBeans.compileXmlBeans(null,
- null, schemas, null,
- XmlBeans.getBuiltinTypeSystem(), null, opt);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(obj1);
+ params.setOptions(opt);
+ sts = XmlBeans.compileXmlBeans(params);
assertTrue("Errors should have been empty", err.isEmpty());
// find element in the type System
@@ -165,9 +171,9 @@ public class XmlBeanCompilationTests ext
"Could Not find Type from first Type System: " + sts1);
//SIMPLE INCR COMPILATION
- sts = XmlBeans.compileXmlBeans(null,
- sts, schemas2, null,
- XmlBeans.getBuiltinTypeSystem(), null, opt);
+ params.setExistingTypeSystem(sts);
+ params.setInputXmls(obj2);
+ sts = XmlBeans.compileXmlBeans(params);
assertTrue("Errors should have been empty", err.isEmpty());
// find element in the type System
@@ -181,9 +187,10 @@ public class XmlBeanCompilationTests ext
System.out.println("Building over Existing");
//BUILDING OFF BASE SIMPLE INCR COMPILATION
- sts = XmlBeans.compileXmlBeans(null,
- sts, schemas2, null,
- sts, null, opt);
+ params.setInputXmls(obj2);
+ params.setExistingTypeSystem(sts);
+ params.setLinkTo(sts);
+ sts = XmlBeans.compileXmlBeans(params);
assertTrue("Errors should have been empty", err.isEmpty());
// find element in the type System
@@ -197,9 +204,12 @@ public class XmlBeanCompilationTests ext
//INCR COMPILATION WITH RECOVERABLE ERROR
err.clear();
- SchemaTypeSystem b = XmlBeans.compileXmlBeans(null,
- sts, schemas3, null,
- XmlBeans.getBuiltinTypeSystem(), null, opt);
+ params = new Parameters();
+ params.setExistingTypeSystem(sts);
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(obj3);
+ params.setOptions(opt);
+ SchemaTypeSystem b = XmlBeans.compileXmlBeans(params);
// find element in the type System
if (!findGlobalElement(b.globalElements(), sts1))
throw new Exception("Could Not find Type from first Type System: "
+
Modified:
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/incr/schemaCompile/detailed/IncrCompilationTests.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/incr/schemaCompile/detailed/IncrCompilationTests.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/incr/schemaCompile/detailed/IncrCompilationTests.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/incr/schemaCompile/detailed/IncrCompilationTests.java
Wed Apr 10 22:41:12 2019
@@ -18,6 +18,7 @@ package compile.scomp.incr.schemaCompile
import compile.scomp.common.CompileCommon;
import compile.scomp.common.CompileTestBase;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.apache.xmlbeans.impl.util.FilerImpl;
import org.junit.*;
@@ -274,7 +275,14 @@ public class IncrCompilationTests extend
// create a new filer here with the incrCompile flag value set to
'true'
Filer filer = new FilerImpl(out, out, null, true, true);
- SchemaTypeSystem base =
XmlBeans.compileXmlBeans("teststs",null,schemas,null,builtin,filer,xm);
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setName("teststs");
+ params.setLinkTo(builtin);
+ params.setInputXmls(obj1);
+ params.setFiler(filer);
+ params.setOptions(xm);
+
+ SchemaTypeSystem base = XmlBeans.compileXmlBeans(params);
Assert.assertNotNull("Compilation failed during Incremental Compile.",
base);
base.saveToDirectory(out);
@@ -286,7 +294,11 @@ public class IncrCompilationTests extend
// note: providing a null or different name results in regeneration of
generated Interface java src files
HashMap recompileTimeStamps = new HashMap();
Filer filer2 = new FilerImpl(out, out, null, true, true);
- SchemaTypeSystem incr =
XmlBeans.compileXmlBeans("teststs",base,schemas2,null,builtin,filer2,xm);
+ params.setExistingTypeSystem(base);
+ params.setInputXmls(obj2);
+ params.setFiler(filer2);
+
+ SchemaTypeSystem incr = XmlBeans.compileXmlBeans(params);
Assert.assertNotNull("Compilation failed during Incremental Compile.",
incr);
incr.saveToDirectory(out);
recordTimeStamps(out, recompileTimeStamps);
@@ -317,7 +329,13 @@ public class IncrCompilationTests extend
// create a new filer here with the incrCompile flag value set to
'true'
Filer filer = new FilerImpl(out, out, null, true, true);
- SchemaTypeSystem base =
XmlBeans.compileXmlBeans("test",null,schemas,null,builtin,filer,xm);
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setName("test");
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(obj1);
+ params.setFiler(filer);
+ params.setOptions(xm);
+ SchemaTypeSystem base = XmlBeans.compileXmlBeans(params);
Assert.assertNotNull("Compilation failed during Incremental Compile.",
base);
base.saveToDirectory(out);
@@ -328,7 +346,10 @@ public class IncrCompilationTests extend
// the incr compile
HashMap recompileTimeStamps = new HashMap();
Filer filer2 = new FilerImpl(out, out, null, true, true);
- SchemaTypeSystem incr =
XmlBeans.compileXmlBeans("test",base,schemas2,null,builtin,filer2,xm);
+ params.setExistingTypeSystem(base);
+ params.setInputXmls(obj2);
+ params.setFiler(filer2);
+ SchemaTypeSystem incr = XmlBeans.compileXmlBeans(params);
Assert.assertNotNull("Compilation failed during Incremental Compile.",
incr);
incr.saveToDirectory(out);
recordTimeStamps(out, recompileTimeStamps);
Modified:
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/som/common/SomTestBase.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/som/common/SomTestBase.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/som/common/SomTestBase.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/compile/scomp/som/common/SomTestBase.java
Wed Apr 10 22:41:12 2019
@@ -30,6 +30,8 @@ package compile.scomp.som.common;
import compile.scomp.common.CompileTestBase;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.Parameters;
import org.apache.xmlbeans.impl.tool.Diff;
import org.junit.Assert;
@@ -507,9 +509,15 @@ public class SomTestBase extends Compile
xsdModifiedObj.documentProperties().setSourceName(sBaseSourceName);
}
Assert.assertNotNull("Xml Object creation failed", xsdModifiedObj);
- XmlObject[] xobjArr = new XmlObject[]{xsdModifiedObj};
- returnSTS = XmlBeans.compileXmlBeans(sSTSName, baseSchema,
xobjArr, null, builtin, null, options);
+ Parameters params = new Parameters();
+ params.setName(sSTSName);
+ params.setLinkTo(builtin);
+ params.setInputXmls(xsdModifiedObj);
+ params.setExistingTypeSystem(baseSchema);
+ params.setOptions(options);
+
+ returnSTS = XmlBeans.compileXmlBeans(params);
Assert.assertNotNull("Schema Type System created is Null.",
returnSTS);
// validate the XmlObject created
Modified:
xmlbeans/branches/xmlbeans-536/test/src/misc/detailed/JiraRegression1_50Test.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/misc/detailed/JiraRegression1_50Test.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/misc/detailed/JiraRegression1_50Test.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/misc/detailed/JiraRegression1_50Test.java
Wed Apr 10 22:41:12 2019
@@ -16,6 +16,7 @@ package misc.detailed;
import misc.common.JiraTestBase;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
import org.junit.Ignore;
@@ -144,9 +145,10 @@ public class JiraRegression1_50Test exte
SchemaDocument sd =
SchemaDocument.Factory.parse(xsdAsString.toString());
// compile loaded XmlObject
- SchemaTypeSystem sts = XmlBeans.compileXsd((XmlObject[])
Collections.singletonList(sd).toArray(new XmlObject[]{}),
- XmlBeans.getContextTypeLoader(),
- new XmlOptions());
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(sd);
+
+ SchemaTypeSystem sts = XmlBeans.compileXmlBeans(params);
sts.resolve();
SchemaType[] st = sts.globalTypes();
Modified:
xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/extension/detailed/ComplexContentExtensionTest.java
Wed Apr 10 22:41:12 2019
@@ -15,6 +15,7 @@
package scomp.derivation.extension.detailed;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.Parameters;
import org.junit.Test;
import scomp.common.BaseCase;
import xbean.scomp.derivation.complexExtension.ChoiceExtensionEltDocument;
@@ -184,8 +185,12 @@ public class ComplexContentExtensionTest
try {
XmlObject xobj = XmlObject.Factory.parse(inputXsd);
- XmlObject[] compInput = new XmlObject[]{xobj};
- XmlBeans.compileXmlBeans(null, null, compInput, null,
XmlBeans.getBuiltinTypeSystem(), null, options);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setOptions(options);
+ params.setInputXmls(xobj);
+
+ XmlBeans.compileXmlBeans(params);
}
catch (XmlException xme) {
// The convention is that the XmlException that gets thrown form
XmlBeans.compile* methods always contains
@@ -233,8 +238,11 @@ public class ComplexContentExtensionTest
try {
XmlObject xobj = XmlObject.Factory.parse(inputXsd);
- XmlObject[] compInput = new XmlObject[]{xobj};
- XmlBeans.compileXmlBeans(null, null, compInput, null,
XmlBeans.getBuiltinTypeSystem(), null, null);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(xobj);
+
+ XmlBeans.compileXmlBeans(params);
}
catch (XmlException xme) {
assertEquals(xme.getErrors().size(), 1);
@@ -269,8 +277,11 @@ public class ComplexContentExtensionTest
try {
XmlObject xobj = XmlObject.Factory.parse(inputXsd);
- XmlObject[] compInput = new XmlObject[]{xobj};
- XmlBeans.compileXmlBeans(null, null, compInput, null,
XmlBeans.getBuiltinTypeSystem(), null, null);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(xobj);
+
+ XmlBeans.compileXmlBeans(params);
}
catch (XmlException xme) {
assertEquals(1, xme.getErrors().size());
@@ -320,8 +331,12 @@ public class ComplexContentExtensionTest
try {
XmlObject xobj = XmlObject.Factory.parse(inputXsd);
- XmlObject[] compInput = new XmlObject[]{xobj};
- XmlBeans.compileXmlBeans(null, null, compInput, null,
XmlBeans.getBuiltinTypeSystem(), null, options);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(xobj);
+ params.setOptions(options);
+
+ XmlBeans.compileXmlBeans(params);
}
catch (XmlException xme) {
// The convention is that the XmlException that gets thrown form
XmlBeans.compile* methods always contains
Modified:
xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/restriction/detailed/EnumTest.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/restriction/detailed/EnumTest.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/restriction/detailed/EnumTest.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/scomp/derivation/restriction/detailed/EnumTest.java
Wed Apr 10 22:41:12 2019
@@ -16,6 +16,7 @@
package scomp.derivation.restriction.detailed;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
import org.junit.Test;
import scomp.common.BaseCase;
@@ -62,14 +63,16 @@ public class EnumTest extends BaseCase
SchemaDocument sd =
SchemaDocument.Factory.parse(xsdAsString.toString());
// compile loaded XmlObject
- try
- {
- XmlOptions options = new XmlOptions();
- List errors = new ArrayList();
- options.setErrorListener(errors);
- SchemaTypeSystem sts = XmlBeans.compileXsd((XmlObject[])
Collections.singletonList(sd).toArray(new XmlObject[]{}),
- XmlBeans.getContextTypeLoader(),
- options);
+ try {
+ XmlOptions options = new XmlOptions();
+ List errors = new ArrayList();
+ options.setErrorListener(errors);
+
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(sd);
+ params.setOptions(options);
+
+ SchemaTypeSystem sts = XmlBeans.compileXmlBeans(params);
}
catch(XmlException xme)
Modified:
xmlbeans/branches/xmlbeans-536/test/src/scomp/redefine/detailed/MultipleRedefines.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/scomp/redefine/detailed/MultipleRedefines.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/scomp/redefine/detailed/MultipleRedefines.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/scomp/redefine/detailed/MultipleRedefines.java
Wed Apr 10 22:41:12 2019
@@ -15,6 +15,7 @@
package scomp.redefine.detailed;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
import org.junit.Assert;
import org.junit.Test;
@@ -175,8 +176,12 @@ public class MultipleRedefines extends B
sdocs[i].documentProperties().setSourceName(MULTIPLE_SCHEMAS_NAME[i]);
}
- SchemaTypeSystem ts = XmlBeans.compileXsd(sdocs,
- XmlBeans.getBuiltinTypeSystem(), validateOptions);
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(sdocs);
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setOptions(validateOptions);
+
+ SchemaTypeSystem ts = XmlBeans.compileXmlBeans(params);
assertNotNull(ts);
SchemaType t = ts.findType(new QName("", "T"));
@@ -209,10 +214,12 @@ public class MultipleRedefines extends B
setUp();
boolean caught = false;
- try
- {
- SchemaTypeSystem ts = XmlBeans.compileXsd(sdocs,
- XmlBeans.getBuiltinTypeSystem(), validateOptions);
+ try {
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(sdocs);
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setOptions(validateOptions);
+ SchemaTypeSystem ts = XmlBeans.compileXmlBeans(params);
}
catch (XmlException e)
{
Modified:
xmlbeans/branches/xmlbeans-536/test/src/scomp/substGroup/restriction/detailed/Final.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/scomp/substGroup/restriction/detailed/Final.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/scomp/substGroup/restriction/detailed/Final.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/scomp/substGroup/restriction/detailed/Final.java
Wed Apr 10 22:41:12 2019
@@ -15,6 +15,7 @@
package scomp.substGroup.restriction.detailed;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.Parameters;
import org.junit.Test;
import scomp.common.BaseCase;
@@ -95,8 +96,10 @@ public class Final extends BaseCase {
{
try {
XmlObject xobj = XmlObject.Factory.parse(inputXsd);
- XmlObject[] compInput = new XmlObject[]{xobj};
- XmlBeans.compileXmlBeans(null, null, compInput, null,
XmlBeans.getBuiltinTypeSystem(), null, null);
+ Parameters params = new Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(xobj);
+ XmlBeans.compileXmlBeans(params);
}
catch (XmlException xme) {
assertEquals(1,xme.getErrors().size());
Modified:
xmlbeans/branches/xmlbeans-536/test/src/xmlobject/detailed/TestsFromBugs.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/src/xmlobject/detailed/TestsFromBugs.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/src/xmlobject/detailed/TestsFromBugs.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/src/xmlobject/detailed/TestsFromBugs.java
Wed Apr 10 22:41:12 2019
@@ -20,6 +20,7 @@ import com.mytest.Foo;
import com.mytest.Info;
import com.mytest.TestDocument;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.junit.Test;
import test.xmlobject.test36510.Test36510AppDocument;
@@ -144,8 +145,11 @@ public class TestsFromBugs {
XmlObject.Factory.parse(str)};
XmlOptions xOpt = new XmlOptions().setValidateTreatLaxAsSkip();
- SchemaTypeSystem sts = XmlBeans.compileXmlBeans(null, null, schemas,
- null, XmlBeans.getBuiltinTypeSystem(), null, xOpt);
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setInputXmls(schemas);
+ params.setOptions(xOpt);
+ SchemaTypeSystem sts = XmlBeans.compileXmlBeans(params);
//ensure SchemaGlobalElement has getSourceName Method
SchemaGlobalElement[] sge = sts.globalElements();
Modified:
xmlbeans/branches/xmlbeans-536/test/tools/src/tools/util/SchemaValidator.java
URL:
http://svn.apache.org/viewvc/xmlbeans/branches/xmlbeans-536/test/tools/src/tools/util/SchemaValidator.java?rev=1857286&r1=1857285&r2=1857286&view=diff
==============================================================================
---
xmlbeans/branches/xmlbeans-536/test/tools/src/tools/util/SchemaValidator.java
(original)
+++
xmlbeans/branches/xmlbeans-536/test/tools/src/tools/util/SchemaValidator.java
Wed Apr 10 22:41:12 2019
@@ -15,6 +15,7 @@
package tools.util;
import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import java.util.ArrayList;
import java.util.Collection;
@@ -74,12 +75,12 @@ public class SchemaValidator
Exception ioex = null;
XmlObject[] schema = new XmlObject[1];
SchemaTypeSystem system = null;
- try
- {
- schema[0] = XmlObject.Factory.parse(new File(schemaFile));
- system = XmlBeans.compileXsd(schema,
- XmlBeans.getBuiltinTypeSystem(),
- options);
+ try {
+ SchemaTypeSystemCompiler.Parameters params = new
SchemaTypeSystemCompiler.Parameters();
+ params.setInputXmls(XmlObject.Factory.parse(new File(schemaFile)));
+ params.setLinkTo(XmlBeans.getBuiltinTypeSystem());
+ params.setOptions(options);
+ system = XmlBeans.compileXmlBeans(params);
} catch (XmlException e)
{
// Parse Exception
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]