This is an automated email from the ASF dual-hosted git repository.
pjfanning pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi-xmlbeans.git
The following commit(s) were added to refs/heads/trunk by this push:
new 356dc2e5 build the complete attribute wildcard of restrictions from
their attribute groups (#168)
356dc2e5 is described below
commit 356dc2e5e47e0b9bfb58fde47cbb9b47a61c96b4
Author: PJ Fanning <[email protected]>
AuthorDate: Sun Nov 15 22:01:03 2026 +0100
build the complete attribute wildcard of restrictions from their attribute
groups (#168)
A restriction dropped any attribute wildcard that came only from its
attribute groups: the inherited-wildcard reset at the end of
translateAttributeModel also ran for every attribute group, and for the
type itself when it had no anyAttribute of its own. Each wildcard was also
checked against the base type's wildcard on its own, so a group wildcard
wider than the base failed even when the combined wildcard was a subset.
Restrictions now build the complete wildcard like extensions do
(XML Schema 1.0 3.4.2): the type's own anyAttribute and its attribute group
wildcards are intersected, and derivation-ok-restriction.4 is checked once
against the complete wildcard. processContents comes from the type's own
anyAttribute, or else from the first attribute group wildcard, as Xerces
does.
XmlOptions.setCompileLegacyAttributeWildcards() restores the pre-6.0.0
handling, including the union of a type's own wildcards that #167 replaced.
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
src/main/java/org/apache/xmlbeans/XmlOptions.java | 40 +++++
.../impl/schema/StscComplexTypeResolver.java | 144 ++++++++++++----
.../org/apache/xmlbeans/impl/schema/StscState.java | 10 ++
.../checkin/AttributeWildcardRestrictionTest.java | 189 +++++++++++++++++++++
4 files changed, 348 insertions(+), 35 deletions(-)
diff --git a/src/main/java/org/apache/xmlbeans/XmlOptions.java
b/src/main/java/org/apache/xmlbeans/XmlOptions.java
index 725a0f37..7db90f20 100644
--- a/src/main/java/org/apache/xmlbeans/XmlOptions.java
+++ b/src/main/java/org/apache/xmlbeans/XmlOptions.java
@@ -132,6 +132,7 @@ public class XmlOptions implements java.io.Serializable {
COMPILE_NO_UPA_RULE,
COMPILE_NO_PVR_RULE,
COMPILE_LEGACY_REGEX_WORD_CLASS,
+ COMPILE_LEGACY_ATTRIBUTE_WILDCARDS,
COMPILE_NO_ANNOTATIONS,
COMPILE_DOWNLOAD_URLS,
COMPILE_MDEF_NAMESPACES,
@@ -1114,6 +1115,45 @@ public class XmlOptions implements java.io.Serializable {
return hasOption(XmlOptionsKeys.COMPILE_LEGACY_REGEX_WORD_CLASS);
}
+ /**
+ * If this option is set, the attribute wildcard of a complex type is built
+ * the way XMLBeans did before 6.0.0:
+ * <ul>
+ * <li>the type's own {@code anyAttribute} and the {@code anyAttribute}s
of its
+ * attribute groups are combined by union instead of intersection;</li>
+ * <li>in a restriction, a wildcard that comes only from attribute groups
is
+ * dropped, and each wildcard is checked against the base type's wildcard
on
+ * its own instead of the combined wildcard.</li>
+ * </ul>
+ * By default the complete wildcard follows
+ * <a target="_blank"
href="https://www.w3.org/TR/xmlschema-1/#declare-type">Section 3.4.2 of the XML
Schema specification</a>.
+ * <p>
+ * The attribute wildcard is stored in the compiled {@code
SchemaTypeSystem}, so
+ * type systems compiled by older XMLBeans versions keep their wildcards
when loaded.
+ *
+ * @see XmlBeans#compileXsd
+ * @since 6.0.0
+ */
+ public XmlOptions setCompileLegacyAttributeWildcards() {
+ return setCompileLegacyAttributeWildcards(true);
+ }
+
+ /**
+ * @see #setCompileLegacyAttributeWildcards()
+ * @since 6.0.0
+ */
+ public XmlOptions setCompileLegacyAttributeWildcards(boolean b) {
+ return set(XmlOptionsKeys.COMPILE_LEGACY_ATTRIBUTE_WILDCARDS, b);
+ }
+
+ /**
+ * @see #setCompileLegacyAttributeWildcards()
+ * @since 6.0.0
+ */
+ public boolean isCompileLegacyAttributeWildcards() {
+ return hasOption(XmlOptionsKeys.COMPILE_LEGACY_ATTRIBUTE_WILDCARDS);
+ }
+
/**
* if this option is set, the schema compiler will skip annotations when
* processing Schema components.
diff --git
a/src/main/java/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java
b/src/main/java/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java
index a043c02f..a6eda035 100644
--- a/src/main/java/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java
@@ -807,16 +807,75 @@ public class StscComplexTypeResolver {
SchemaType baseType, boolean extension,
SchemaAttributeGroupImpl
redefinitionFor) {
StscState state = StscState.get();
- // the type's own wildcards (local and from attribute groups) are
intersected,
- // an extension then adds the base type's wildcard by union
- QNameSet baseWildcardSet = null;
- int baseWildcardProcess = SchemaAttributeModel.NONE;
- if (extension && seenAttributes == null) {
- baseWildcardSet = result.getWildcardSet();
- baseWildcardProcess = result.getWildcardProcess();
- result.setWildcardSet(null);
- result.setWildcardProcess(SchemaAttributeModel.NONE);
+ if (state.legacyAttributeWildcards()) {
+ translateAttributeModel(parseTree, targetNamespace, chameleon,
formDefault, anonymousTypes,
+ outerType, seenAttributes, result, baseType, extension,
redefinitionFor, null);
+ return;
+ }
+
+ // XML Schema 1.0 3.4.2: the complete wildcard is the intersection of
the type's
+ // own anyAttribute and the wildcards of its attribute groups. An
extension then
+ // adds the base type's wildcard by union; a restriction uses the
complete
+ // wildcard alone, which must be a subset of the base type's wildcard.
+ QNameSet baseWildcardSet = result.getWildcardSet();
+ int baseWildcardProcess = result.getWildcardProcess();
+ result.setWildcardSet(null);
+ result.setWildcardProcess(SchemaAttributeModel.NONE);
+
+ WildcardSource source = new WildcardSource();
+ translateAttributeModel(parseTree, targetNamespace, chameleon,
formDefault, anonymousTypes,
+ outerType, seenAttributes, result, baseType, extension,
redefinitionFor, source);
+
+ if (extension) {
+ if (baseWildcardProcess != SchemaAttributeModel.NONE) {
+ if (result.getWildcardProcess() == SchemaAttributeModel.NONE) {
+ result.setWildcardSet(baseWildcardSet);
+ result.setWildcardProcess(baseWildcardProcess);
+ } else {
+
result.setWildcardSet(result.getWildcardSet().union(baseWildcardSet));
+ }
+ }
+ } else if (baseType != null && result.getWildcardProcess() !=
SchemaAttributeModel.NONE) {
+ SchemaAttributeModel baseModel = baseType.getAttributeModel();
+ QNameSet baseSet = baseModel.getWildcardSet();
+ if (baseSet == null || baseModel.getWildcardProcess() ==
SchemaAttributeModel.NONE) {
+
state.error(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$BASE_HAS_ATTR_WILDCARD,
null, source.location);
+ result.setWildcardSet(null);
+ result.setWildcardProcess(SchemaAttributeModel.NONE);
+ } else if (!baseSet.containsAll(result.getWildcardSet())) {
+
state.error(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$ATTR_WILDCARD_SUBSET,
+ new Object[]{source.nsText}, source.location);
+ result.setWildcardSet(null);
+ result.setWildcardProcess(SchemaAttributeModel.NONE);
+ }
}
+ }
+
+ /**
+ * Where the complete attribute wildcard of a type comes from, for error
reporting:
+ * the type's own anyAttribute if it has one, otherwise the first
attribute group wildcard.
+ */
+ private static final class WildcardSource {
+ XmlObject location;
+ String nsText;
+ }
+
+ /**
+ * @param source null for the pre-6.0.0 wildcard handling
+ * ({@link
XmlOptions#setCompileLegacyAttributeWildcards()}), otherwise
+ * collects where the complete wildcard comes from
+ */
+ private static void translateAttributeModel(XmlObject parseTree,
+ String targetNamespace,
boolean chameleon, String formDefault,
+ List<SchemaType>
anonymousTypes, SchemaType outerType,
+ Set<QName> seenAttributes,
SchemaAttributeModelImpl result,
+ SchemaType baseType, boolean
extension,
+ SchemaAttributeGroupImpl
redefinitionFor,
+ WildcardSource source) {
+ StscState state = StscState.get();
+ boolean legacy = source == null;
+ // the top-level call is for the type itself, nested calls are for its
attribute groups
+ boolean nested = seenAttributes != null;
if (seenAttributes == null) {
seenAttributes = new HashSet<>();
}
@@ -918,27 +977,49 @@ public class StscComplexTypeResolver {
}
QNameSet wcset =
QNameSet.forWildcardNamespaceString(nsText, targetNamespace);
- if (baseModel != null && !extension) {
- if (baseModel.getWildcardSet() == null) {
-
state.error(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$BASE_HAS_ATTR_WILDCARD,
null, xsdwc);
- continue; // ignore the extra wildcard
- } else if
(!baseModel.getWildcardSet().containsAll(wcset)) {
-
state.error(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$ATTR_WILDCARD_SUBSET,
- new Object[]{nsText}, xsdwc);
- continue; // ignore the restriction
+ int wcprocess =
translateWildcardProcess(xsdwc.xgetProcessContents());
+
+ if (legacy) {
+ // pre-6.0.0: each wildcard of a restriction is
checked against the
+ // base on its own, and an extension unions all
the wildcards
+ if (baseModel != null && !extension) {
+ if (baseModel.getWildcardSet() == null) {
+
state.error(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$BASE_HAS_ATTR_WILDCARD,
null, xsdwc);
+ continue; // ignore the extra wildcard
+ } else if
(!baseModel.getWildcardSet().containsAll(wcset)) {
+
state.error(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$ATTR_WILDCARD_SUBSET,
+ new Object[]{nsText}, xsdwc);
+ continue; // ignore the restriction
+ }
+ }
+ if (result.getWildcardProcess() ==
SchemaAttributeModel.NONE) {
+ result.setWildcardSet(wcset);
+ result.setWildcardProcess(wcprocess);
+ } else if (extension) {
+
result.setWildcardSet(wcset.union(result.getWildcardSet()));
+ result.setWildcardProcess(wcprocess);
+ } else {
+
result.setWildcardSet(wcset.intersect(result.getWildcardSet()));
+ // keep old process
}
+ break;
}
- int wcprocess =
translateWildcardProcess(xsdwc.xgetProcessContents());
if (result.getWildcardProcess() ==
SchemaAttributeModel.NONE) {
result.setWildcardSet(wcset);
- result.setWildcardProcess(wcprocess);
} else {
result.setWildcardSet(wcset.intersect(result.getWildcardSet()));
- if (extension) {
- result.setWildcardProcess(wcprocess);
- }
- // else keep old process
+ }
+ // processContents comes from the type's own
anyAttribute, or else from
+ // the first attribute group wildcard
+ if (!nested) {
+ result.setWildcardProcess(wcprocess);
+ source.location = xsdwc;
+ source.nsText = nsText;
+ } else if (source.location == null) {
+ result.setWildcardProcess(wcprocess);
+ source.location = xsdwc;
+ source.nsText = nsText;
}
break;
}
@@ -987,7 +1068,7 @@ public class StscComplexTypeResolver {
translateAttributeModel(group.getParseObject(),
subTargetNamespace, chameleon,
group.getFormDefault(),
anonymousTypes, outerType, seenAttributes, result,
baseType,
- extension, nestedRedefinitionFor);
+ extension, nestedRedefinitionFor, source);
state.finishProcessing(group);
break;
}
@@ -997,20 +1078,13 @@ public class StscComplexTypeResolver {
}
}
}
- // If this is restriction and no wildcard was present, then
- // we have to erase the inherited wildcards
- if (!extension && !seenWildcard) {
+ // pre-6.0.0: if this is restriction and no wildcard was present, then
+ // we have to erase the inherited wildcards. This also runs for each
+ // attribute group, so a restriction drops the wildcards of its groups
+ if (legacy && !extension && !seenWildcard) {
result.setWildcardSet(null);
result.setWildcardProcess(SchemaAttributeModel.NONE);
}
- if (baseWildcardProcess != SchemaAttributeModel.NONE) {
- if (result.getWildcardProcess() == SchemaAttributeModel.NONE) {
- result.setWildcardSet(baseWildcardSet);
- result.setWildcardProcess(baseWildcardProcess);
- } else {
-
result.setWildcardSet(result.getWildcardSet().union(baseWildcardSet));
- }
- }
}
static SchemaParticle extendContentModel(SchemaParticle baseContentModel,
SchemaParticle extendedContentModel, XmlObject parseTree) {
diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java
b/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java
index 17781d47..b4377f93 100644
--- a/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java
+++ b/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java
@@ -104,6 +104,7 @@ public class StscState {
private boolean _noUpa;
private boolean _noPvr;
private boolean _legacyRegexWordClass;
+ private boolean _legacyAttributeWildcards;
private boolean _noAnn;
private boolean _mdefAll;
private String _sourceCodeEncoding ;
@@ -477,6 +478,7 @@ public class StscState {
_doingDownloads = options.isCompileDownloadUrls() ||
"true".equals(SystemProperties.getProperty("xmlbean.downloadurls", "false"));
_legacyRegexWordClass = options.isCompileLegacyRegexWordClass();
+ _legacyAttributeWildcards =
options.isCompileLegacyAttributeWildcards();
_maxNumberOfCharsForNumbers = options.getMaxNumberOfCharsForNumbers();
_sourceCodeEncoding = options.getCharacterEncoding();
if (_sourceCodeEncoding == null || _sourceCodeEncoding.isEmpty()) {
@@ -539,6 +541,14 @@ public class StscState {
return _legacyRegexWordClass;
}
+ /**
+ * True if attribute wildcards are built the pre-6.0.0 way,
+ * see {@link XmlOptions#setCompileLegacyAttributeWildcards()}.
+ */
+ public boolean legacyAttributeWildcards() {
+ return _legacyAttributeWildcards;
+ }
+
/**
* True if annotations should be skipped
*/
diff --git a/src/test/java/misc/checkin/AttributeWildcardRestrictionTest.java
b/src/test/java/misc/checkin/AttributeWildcardRestrictionTest.java
new file mode 100644
index 00000000..e8f35f43
--- /dev/null
+++ b/src/test/java/misc/checkin/AttributeWildcardRestrictionTest.java
@@ -0,0 +1,189 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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 misc.checkin;
+
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The complete attribute wildcard (XML Schema 1.0 3.4.2) of restrictions,
where it
+ * comes from attribute groups and its processContents, and the pre-6.0.0
behaviour
+ * behind XmlOptions.setCompileLegacyAttributeWildcards.
+ */
+public class AttributeWildcardRestrictionTest {
+
+ private static final String HEAD =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' " +
+ "xmlns:t='urn:t' targetNamespace='urn:t'>" +
+ " <xs:attributeGroup name='ab'>" +
+ " <xs:anyAttribute namespace='urn:a urn:b'
processContents='skip'/>" +
+ " </xs:attributeGroup>" +
+ " <xs:attributeGroup name='bcStrict'>" +
+ " <xs:anyAttribute namespace='urn:b urn:c'
processContents='strict'/>" +
+ " </xs:attributeGroup>" +
+ " <xs:complexType name='any'>" +
+ " <xs:anyAttribute namespace='##any' processContents='skip'/>" +
+ " </xs:complexType>" +
+ " <xs:complexType name='bOnly'>" +
+ " <xs:anyAttribute namespace='urn:b' processContents='skip'/>" +
+ " </xs:complexType>";
+
+ private static final String XSD = HEAD +
+ // wildcard only from an attribute group
+ " <xs:element name='restGroup'><xs:complexType><xs:complexContent>" +
+ " <xs:restriction base='t:any'><xs:attributeGroup
ref='t:ab'/></xs:restriction>" +
+ " </xs:complexContent></xs:complexType></xs:element>" +
+ // group and local wildcard are intersected
+ " <xs:element name='restBoth'><xs:complexType><xs:complexContent>" +
+ " <xs:restriction base='t:any'><xs:attributeGroup ref='t:ab'/>" +
+ " <xs:anyAttribute namespace='urn:b urn:c'
processContents='skip'/></xs:restriction>" +
+ " </xs:complexContent></xs:complexType></xs:element>" +
+ // processContents comes from the local wildcard
+ " <xs:element name='restProc'><xs:complexType><xs:complexContent>" +
+ " <xs:restriction base='t:any'><xs:attributeGroup ref='t:ab'/>" +
+ " <xs:anyAttribute namespace='urn:a urn:b'
processContents='strict'/></xs:restriction>" +
+ " </xs:complexContent></xs:complexType></xs:element>" +
+ // no local wildcard: processContents comes from the first attribute
group
+ " <xs:element name='firstGroup'><xs:complexType>" +
+ " <xs:attributeGroup ref='t:ab'/><xs:attributeGroup
ref='t:bcStrict'/>" +
+ " </xs:complexType></xs:element>" +
+ // the type's own wildcards are unioned in legacy mode
+ " <xs:element name='local'><xs:complexType>" +
+ " <xs:attributeGroup ref='t:ab'/>" +
+ " <xs:anyAttribute namespace='urn:b urn:c'
processContents='skip'/>" +
+ " </xs:complexType></xs:element>" +
+ "</xs:schema>";
+
+ private static SchemaTypeLoader loader;
+ private static SchemaTypeLoader legacyLoader;
+
+ @BeforeAll
+ static void compileSchemas() throws Exception {
+ loader = XmlBeans.loadXsd(new
XmlObject[]{SchemaDocument.Factory.parse(XSD)});
+ legacyLoader = XmlBeans.loadXsd(new
XmlObject[]{SchemaDocument.Factory.parse(XSD)},
+ new XmlOptions().setCompileLegacyAttributeWildcards());
+ }
+
+ private static boolean valid(SchemaTypeLoader stl, String element, String
ns) throws Exception {
+ XmlObject doc = stl.parse(
+ "<t:" + element + " xmlns:t='urn:t' xmlns:p='" + ns + "'
p:x='1'/>", null, null);
+ List<XmlError> errors = new ArrayList<>();
+ return doc.validate(new XmlOptions().setErrorListener(errors));
+ }
+
+ @ParameterizedTest
+ @CsvSource({
+ "restGroup, urn:a, true",
+ "restGroup, urn:b, true",
+ "restGroup, urn:c, false",
+ "restBoth, urn:a, false",
+ "restBoth, urn:b, true",
+ "restBoth, urn:c, false",
+ // strict: there is no global declaration for p:x
+ "restProc, urn:b, false",
+ "firstGroup, urn:b, true",
+ "firstGroup, urn:a, false",
+ "firstGroup, urn:c, false",
+ "local, urn:a, false",
+ "local, urn:b, true"
+ })
+ void completeWildcard(String element, String ns, boolean expected) throws
Exception {
+ assertEquals(expected, valid(loader, element, ns));
+ }
+
+ @ParameterizedTest
+ @CsvSource({
+ // a restriction drops a wildcard that only comes from attribute groups
+ "restGroup, urn:a, false",
+ "restGroup, urn:b, false",
+ "restBoth, urn:b, true",
+ "restBoth, urn:c, false",
+ // processContents is inherited from the base type
+ "restProc, urn:b, true",
+ // the last wildcard's processContents wins
+ "firstGroup, urn:b, false",
+ // the type's own wildcards are unioned
+ "local, urn:a, true",
+ "local, urn:b, true",
+ "local, urn:c, true"
+ })
+ void legacyWildcard(String element, String ns, boolean expected) throws
Exception {
+ assertEquals(expected, valid(legacyLoader, element, ns));
+ }
+
+ private static final String WIDE_GROUP = HEAD +
+ // the group alone is wider than the base, the complete wildcard is not
+ " <xs:complexType name='wide'><xs:complexContent>" +
+ " <xs:restriction base='t:bOnly'><xs:attributeGroup ref='t:ab'/>" +
+ " <xs:anyAttribute namespace='urn:b'
processContents='skip'/></xs:restriction>" +
+ " </xs:complexContent></xs:complexType>" +
+ " <xs:element name='wide' type='t:wide'/>" +
+ "</xs:schema>";
+
+ @Test
+ void subsetCheckUsesCompleteWildcard() throws Exception {
+ SchemaTypeLoader stl = XmlBeans.loadXsd(new
XmlObject[]{SchemaDocument.Factory.parse(WIDE_GROUP)});
+ assertTrue(valid(stl, "wide", "urn:b"));
+ assertEquals(false, valid(stl, "wide", "urn:a"));
+
+ // pre-6.0.0 checked the group wildcard against the base on its own
+ XmlException e = assertThrows(XmlException.class, () ->
XmlBeans.loadXsd(
+ new XmlObject[]{SchemaDocument.Factory.parse(WIDE_GROUP)},
+ new XmlOptions().setCompileLegacyAttributeWildcards()));
+ assertTrue(e.getMessage().contains("derivation-ok-restriction.4.2"),
e.getMessage());
+ }
+
+ @Test
+ void completeWildcardNotSubsetOfBase() throws Exception {
+ String xsd = HEAD +
+ " <xs:complexType name='notSubset'><xs:complexContent>" +
+ " <xs:restriction base='t:bOnly'><xs:attributeGroup
ref='t:ab'/></xs:restriction>" +
+ " </xs:complexContent></xs:complexType>" +
+ "</xs:schema>";
+ XmlException e = assertThrows(XmlException.class,
+ () -> XmlBeans.loadXsd(new
XmlObject[]{SchemaDocument.Factory.parse(xsd)}));
+ assertTrue(e.getMessage().contains("derivation-ok-restriction.4.2"),
e.getMessage());
+ }
+
+ @Test
+ void baseWithoutWildcard() throws Exception {
+ String xsd = HEAD +
+ " <xs:complexType name='none'/>" +
+ " <xs:complexType name='addsWildcard'><xs:complexContent>" +
+ " <xs:restriction base='t:none'><xs:attributeGroup
ref='t:ab'/></xs:restriction>" +
+ " </xs:complexContent></xs:complexType>" +
+ "</xs:schema>";
+ XmlException e = assertThrows(XmlException.class,
+ () -> XmlBeans.loadXsd(new
XmlObject[]{SchemaDocument.Factory.parse(xsd)}));
+ assertTrue(e.getMessage().contains("derivation-ok-restriction.4.1"),
e.getMessage());
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]