You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2013/01/03 15:55:20 UTC
svn commit: r1428379 - in /xerces/java/trunk/src/org/apache/xerces/impl/xs:
XMLSchemaValidator.java util/XS10TypeHelper.java
Author: mukulg
Date: Thu Jan 3 14:55:20 2013
New Revision: 1428379
URL: http://svn.apache.org/viewvc?rev=1428379&view=rev
Log:
schema 1.0 commit: committing a minor fix to produce non null strings for XSD type names in error messages, when xsi:type attribute is used.
Added:
xerces/java/trunk/src/org/apache/xerces/impl/xs/util/XS10TypeHelper.java (with props)
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=1428379&r1=1428378&r2=1428379&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Thu Jan 3 14:55:20 2013
@@ -51,6 +51,7 @@ import org.apache.xerces.impl.xs.identit
import org.apache.xerces.impl.xs.models.CMBuilder;
import org.apache.xerces.impl.xs.models.CMNodeFactory;
import org.apache.xerces.impl.xs.models.XSCMValidator;
+import org.apache.xerces.impl.xs.util.XS10TypeHelper;
import org.apache.xerces.util.AugmentationsImpl;
import org.apache.xerces.util.IntStack;
import org.apache.xerces.util.SymbolTable;
@@ -2850,7 +2851,7 @@ public class XMLSchemaValidator
if (!XSConstraints.checkTypeDerivationOk(type, fCurrentType, block)) {
reportSchemaError(
"cvc-elt.4.3",
- new Object[] { element.rawname, xsiType, fCurrentType.getName()});
+ new Object[] { element.rawname, xsiType, XS10TypeHelper.getSchemaTypeName(fCurrentType)});
}
}
Added: xerces/java/trunk/src/org/apache/xerces/impl/xs/util/XS10TypeHelper.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/util/XS10TypeHelper.java?rev=1428379&view=auto
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/util/XS10TypeHelper.java (added)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/util/XS10TypeHelper.java Thu Jan 3 14:55:20 2013
@@ -0,0 +1,62 @@
+/*
+ * 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.xerces.impl.xs.util;
+
+import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
+import org.apache.xerces.impl.xs.XSComplexTypeDecl;
+import org.apache.xerces.xs.XSSimpleTypeDefinition;
+import org.apache.xerces.xs.XSTypeDefinition;
+
+/**
+ * Class defining utility/helper methods to support XML Schema 1.0 implementation.
+ *
+ * @xerces.internal
+ *
+ * @author Mukul Gandhi, IBM
+ * @version $Id$
+ */
+public class XS10TypeHelper {
+
+ /*
+ * Class constructor.
+ */
+ private XS10TypeHelper() {
+ // a private constructor, to prohibit instantiating this class from an outside class/application.
+ // this is a good practice, since all methods of this class are "static".
+ }
+
+ /*
+ * Get name of an XSD type definition as a string value (which will typically be the value of "name" attribute of a
+ * type definition, or an internal name determined by the validator for anonymous types).
+ */
+ public static String getSchemaTypeName(XSTypeDefinition typeDefn) {
+
+ String typeNameStr = "";
+ if (typeDefn instanceof XSSimpleTypeDefinition) {
+ typeNameStr = ((XSSimpleTypeDecl) typeDefn).getTypeName();
+ }
+ else {
+ typeNameStr = ((XSComplexTypeDecl) typeDefn).getTypeName();
+ }
+
+ return typeNameStr;
+
+ } // getSchemaTypeName
+
+
+} // class XS10TypeHelper
Propchange: xerces/java/trunk/src/org/apache/xerces/impl/xs/util/XS10TypeHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/src/org/apache/xerces/impl/xs/util/XS10TypeHelper.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org