ilene 2002/07/24 07:15:03
Modified: java/src/org/apache/xalan/res XSLTErrorResources.java
XSLTErrorResources.properties
java/src/org/apache/xml/utils QName.java
java/src/org/apache/xalan/processor XSLTSchema.java
java/src/org/apache/xalan/templates ElemPI.java
Log:
Remaining updates for Bugzilla#5013.
Some attributes that should have been handled as errors were getting
handled as warnings.
Revision Changes Path
1.29 +6 -0
xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java
Index: XSLTErrorResources.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- XSLTErrorResources.java 10 Jul 2002 16:06:31 -0000 1.28
+++ XSLTErrorResources.java 24 Jul 2002 14:15:03 -0000 1.29
@@ -1205,6 +1205,12 @@
/** WG_EMPTY_SECOND_ARG */
public static final int WG_EMPTY_SECOND_ARG = 26;
+ /** WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML */
+ public static final int WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = 27;
+
+ /** WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME */
+ public static final int WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = 28;
+
//The following warning codes are shared with the error codes ...
// Illegal value: {1} used for CHAR attribute: {0}. An attribute of type
CHAR must be only 1 character!
1.8 +4 -0
xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.properties
Index: XSLTErrorResources.properties
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XSLTErrorResources.properties 10 Jul 2002 16:06:31 -0000 1.7
+++ XSLTErrorResources.properties 24 Jul 2002 14:15:03 -0000 1.8
@@ -557,6 +557,10 @@
WR0025=Illegal value used for attribute {0}\u003a {1}
# WG_EMPTY_SECOND_ARG
WR0026=Resulting nodeset from second argument of document function is empty.
The first agument will be used.
+# WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML
+WR0027=processing-instruction name can not be 'xml'
+# WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME
+WR0028=processing-instruction name must be a valid NCName\u003a {0}
# INVALID_TCHAR
1.9 +9 -17 xml-xalan/java/src/org/apache/xml/utils/QName.java
Index: QName.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/QName.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- QName.java 10 Jul 2002 16:06:32 -0000 1.8
+++ QName.java 24 Jul 2002 14:15:03 -0000 1.9
@@ -105,12 +105,6 @@
"http://www.w3.org/XML/1998/namespace";
/**
- * The xmlns namespace.
- */
- public static final String S_XMLNSNAMESPACEURI =
- "http://www.w3.org/2000/xmlns";
-
- /**
* The cached hashcode, which is calculated at construction time.
* @serial
*/
@@ -403,7 +397,7 @@
// Do we want this?
else if (prefix.equals("xmlns"))
{
- _namespaceURI = S_XMLNSNAMESPACEURI;
+ return;
}
else
{
@@ -468,23 +462,19 @@
public QName(String qname, PrefixResolver resolver, boolean validate)
{
+ String prefix = null;
_namespaceURI = null;
int indexOfNSSep = qname.indexOf(':');
if (indexOfNSSep > 0)
{
- String prefix = qname.substring(0, indexOfNSSep);
+ prefix = qname.substring(0, indexOfNSSep);
if (prefix.equals("xml"))
{
_namespaceURI = S_XMLNAMESPACEURI;
}
- // Do we want this?
- else if (prefix.equals("xmlns"))
- {
- _namespaceURI = S_XMLNSNAMESPACEURI;
- }
else
{
_namespaceURI = resolver.getNamespaceForPrefix(prefix);
@@ -499,9 +489,9 @@
}
}
- _localName = (indexOfNSSep < 0)
- ? qname : qname.substring(indexOfNSSep + 1);
-
+ _localName = (indexOfNSSep < 0)
+ ? qname : qname.substring(indexOfNSSep + 1);
+
if (validate)
{
if ((_localName == null) || (!XMLChar.isValidNCName(_localName)))
@@ -510,8 +500,10 @@
XPATHErrorResources.ER_ARG_LOCALNAME_INVALID,null ));
//"Argument 'localName' not a valid NCName");
}
}
-
+
+
m_hashCode = toString().hashCode();
+ _prefix = prefix;
}
/**
1.28 +45 -49
xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java
Index: XSLTSchema.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- XSLTSchema.java 10 Jul 2002 16:06:31 -0000 1.27
+++ XSLTSchema.java 24 Jul 2002 14:15:03 -0000 1.28
@@ -85,44 +85,44 @@
{
// xsl:import, xsl:include
XSLTAttributeDef hrefAttr = new XSLTAttributeDef(null, "href",
- XSLTAttributeDef.T_URL, true,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_URL, true,
false,XSLTAttributeDef.ERROR);
// xsl:preserve-space, xsl:strip-space
XSLTAttributeDef elementsAttr = new XSLTAttributeDef(null, "elements",
XSLTAttributeDef.T_SIMPLEPATTERNLIST,
- true, false, XSLTAttributeDef.WARNING);
+ true, false, XSLTAttributeDef.ERROR);
// XSLTAttributeDef anyNamespacedAttr = new XSLTAttributeDef("*", "*",
// XSLTAttributeDef.T_CDATA, false);
// xsl:output
XSLTAttributeDef methodAttr = new XSLTAttributeDef(null, "method",
- XSLTAttributeDef.T_QNAME, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_QNAME, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef versionAttr = new XSLTAttributeDef(null, "version",
- XSLTAttributeDef.T_NMTOKEN, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_NMTOKEN, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef encodingAttr = new XSLTAttributeDef(null, "encoding",
- XSLTAttributeDef.T_CDATA, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_CDATA, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef omitXmlDeclarationAttr = new XSLTAttributeDef(null,
"omit-xml-declaration",
XSLTAttributeDef.T_YESNO,
- false,
false,XSLTAttributeDef.WARNING);
+ false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef standaloneAttr = new XSLTAttributeDef(null,
"standalone",
- XSLTAttributeDef.T_YESNO, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_YESNO, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef doctypePublicAttr = new XSLTAttributeDef(null,
"doctype-public",
- XSLTAttributeDef.T_CDATA, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_CDATA, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef doctypeSystemAttr = new XSLTAttributeDef(null,
"doctype-system",
- XSLTAttributeDef.T_CDATA, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_CDATA, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef cdataSectionElementsAttr = new XSLTAttributeDef(null,
"cdata-section-elements",
XSLTAttributeDef.T_QNAMES,
- false,
false,XSLTAttributeDef.WARNING);
+ false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef indentAttr = new XSLTAttributeDef(null, "indent",
- XSLTAttributeDef.T_YESNO, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_YESNO, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef mediaTypeAttr = new XSLTAttributeDef(null, "media-type",
- XSLTAttributeDef.T_CDATA, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_CDATA, false,
false,XSLTAttributeDef.ERROR);
// Required.
@@ -145,17 +145,13 @@
// Optional.
// Static error if invalid
- // xsl:template
+ // xsl:template, xsl:decimal-format
XSLTAttributeDef nameAttrOpt_ERROR = new XSLTAttributeDef(null, "name",
XSLTAttributeDef.T_QNAME, false,
false,XSLTAttributeDef.ERROR);
- // Optional.
- // xsl:decimal-format
- XSLTAttributeDef nameAttrOpt = new XSLTAttributeDef(null, "name",
- XSLTAttributeDef.T_QNAME, false,
false,XSLTAttributeDef.WARNING);
// xsl:key
XSLTAttributeDef useAttr = new XSLTAttributeDef(null, "use",
- XSLTAttributeDef.T_EXPR, true,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_EXPR, true,
false,XSLTAttributeDef.ERROR);
// xsl:element, xsl:attribute
XSLTAttributeDef namespaceAVTOpt = new XSLTAttributeDef(null,
@@ -166,11 +162,11 @@
"decimal-separator",
XSLTAttributeDef.T_CHAR,
false,XSLTAttributeDef.ERROR, ".");
XSLTAttributeDef infinityAttr = new XSLTAttributeDef(null, "infinity",
- XSLTAttributeDef.T_CDATA,
false,XSLTAttributeDef.WARNING,"Infinity");
+ XSLTAttributeDef.T_CDATA,
false,XSLTAttributeDef.ERROR,"Infinity");
XSLTAttributeDef minusSignAttr = new XSLTAttributeDef(null, "minus-sign",
XSLTAttributeDef.T_CHAR,
false,XSLTAttributeDef.ERROR,"-");
XSLTAttributeDef NaNAttr = new XSLTAttributeDef(null, "NaN",
- XSLTAttributeDef.T_CDATA,
false,XSLTAttributeDef.WARNING, "NaN");
+ XSLTAttributeDef.T_CDATA,
false,XSLTAttributeDef.ERROR, "NaN");
XSLTAttributeDef percentAttr = new XSLTAttributeDef(null, "percent",
XSLTAttributeDef.T_CHAR,
false,XSLTAttributeDef.ERROR, "%");
XSLTAttributeDef perMilleAttr = new XSLTAttributeDef(null, "per-mille",
@@ -193,29 +189,29 @@
XSLTAttributeDef useAttributeSetsAttr = new XSLTAttributeDef(null,
"use-attribute-sets",
XSLTAttributeDef.T_QNAMES,
- false, false,
XSLTAttributeDef.WARNING);
+ false, false,
XSLTAttributeDef.ERROR);
// xsl:if, xsl:when
XSLTAttributeDef testAttrRequired = new XSLTAttributeDef(null, "test",
- XSLTAttributeDef.T_EXPR, true,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_EXPR, true,
false,XSLTAttributeDef.ERROR);
// Required.
// xsl:value-of, xsl:for-each, xsl:copy-of
XSLTAttributeDef selectAttrRequired = new XSLTAttributeDef(null,
"select",
- XSLTAttributeDef.T_EXPR, true,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_EXPR, true,
false,XSLTAttributeDef.ERROR);
// Optional.
// xsl:variable, xsl:param, xsl:with-param
XSLTAttributeDef selectAttrOpt = new XSLTAttributeDef(null, "select",
- XSLTAttributeDef.T_EXPR, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_EXPR, false,
false,XSLTAttributeDef.ERROR);
// Optional.
// Default: "node()"
// xsl:apply-templates
XSLTAttributeDef selectAttrDefNode = new XSLTAttributeDef(null, "select",
- XSLTAttributeDef.T_EXPR,
false,XSLTAttributeDef.WARNING, "node()");
+ XSLTAttributeDef.T_EXPR,
false,XSLTAttributeDef.ERROR, "node()");
// Optional.
// Default: "."
// xsl:sort
@@ -223,17 +219,17 @@
XSLTAttributeDef.T_EXPR,
false,XSLTAttributeDef.ERROR, ".");
// xsl:key
XSLTAttributeDef matchAttrRequired = new XSLTAttributeDef(null, "match",
- XSLTAttributeDef.T_PATTERN, true,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_PATTERN, true,
false,XSLTAttributeDef.ERROR);
// xsl:template
XSLTAttributeDef matchAttrOpt = new XSLTAttributeDef(null, "match",
- XSLTAttributeDef.T_PATTERN, false,
false,XSLTAttributeDef.WARNING);
- // xsl:tempate
+ XSLTAttributeDef.T_PATTERN, false,
false,XSLTAttributeDef.ERROR);
+ // xsl:template
XSLTAttributeDef priorityAttr = new XSLTAttributeDef(null, "priority",
- XSLTAttributeDef.T_NUMBER, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_NUMBER, false,
false,XSLTAttributeDef.ERROR);
// xsl:template, xsl:apply-templates
XSLTAttributeDef modeAttr = new XSLTAttributeDef(null, "mode",
- XSLTAttributeDef.T_QNAME, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_QNAME, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef spaceAttr =
new XSLTAttributeDef(Constants.S_XMLNAMESPACEURI, "space", false,
false, false, XSLTAttributeDef.WARNING,
@@ -243,35 +239,35 @@
XSLTAttributeDef spaceAttrLiteral =
new XSLTAttributeDef(Constants.S_XMLNAMESPACEURI, "space",
- XSLTAttributeDef.T_URL, false,
true,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_URL, false,
true,XSLTAttributeDef.ERROR);
// xsl:namespace-alias
XSLTAttributeDef stylesheetPrefixAttr = new XSLTAttributeDef(null,
"stylesheet-prefix",
- XSLTAttributeDef.T_CDATA,
true, false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_CDATA,
true, false,XSLTAttributeDef.ERROR);
XSLTAttributeDef resultPrefixAttr = new XSLTAttributeDef(null,
"result-prefix",
- XSLTAttributeDef.T_CDATA, true,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_CDATA, true,
false,XSLTAttributeDef.ERROR);
// xsl:text, xsl:value-of
XSLTAttributeDef disableOutputEscapingAttr = new XSLTAttributeDef(null,
"disable-output-escaping",
XSLTAttributeDef.T_YESNO,
- false,
false,XSLTAttributeDef.WARNING);
+ false,
false,XSLTAttributeDef.ERROR);
// xsl:number
- XSLTAttributeDef levelAttr = new XSLTAttributeDef(null, "level", false,
false, false, XSLTAttributeDef.WARNING,
+ XSLTAttributeDef levelAttr = new XSLTAttributeDef(null, "level", false,
false, false, XSLTAttributeDef.ERROR,
"single", Constants.NUMBERLEVEL_SINGLE,
"multiple", Constants.NUMBERLEVEL_MULTI,
"any", Constants.NUMBERLEVEL_ANY);
levelAttr.setDefault("single");
XSLTAttributeDef countAttr = new XSLTAttributeDef(null, "count",
- XSLTAttributeDef.T_PATTERN, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_PATTERN, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef fromAttr = new XSLTAttributeDef(null, "from",
- XSLTAttributeDef.T_PATTERN, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_PATTERN, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef valueAttr = new XSLTAttributeDef(null, "value",
- XSLTAttributeDef.T_EXPR, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_EXPR, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef formatAttr = new XSLTAttributeDef(null, "format",
- XSLTAttributeDef.T_CDATA, false,
true,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_CDATA, false,
true,XSLTAttributeDef.ERROR);
formatAttr.setDefault("1");
// xsl:number, xsl:sort
@@ -281,20 +277,20 @@
// xsl:number
XSLTAttributeDef letterValueAttr = new XSLTAttributeDef(null,
"letter-value",
- false, true, false,
XSLTAttributeDef.WARNING,
+ false, true, false,
XSLTAttributeDef.ERROR,
"alphabetic",
Constants.NUMBERLETTER_ALPHABETIC,
"traditional",
Constants.NUMBERLETTER_TRADITIONAL);
// xsl:number
XSLTAttributeDef groupingSeparatorAVT = new XSLTAttributeDef(null,
"grouping-separator",
- XSLTAttributeDef.T_CHAR,
false, true,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_CHAR,
false, true,XSLTAttributeDef.ERROR);
// xsl:number
XSLTAttributeDef groupingSizeAttr = new XSLTAttributeDef(null,
"grouping-size",
- XSLTAttributeDef.T_NUMBER, false,
true,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_NUMBER, false,
true,XSLTAttributeDef.ERROR);
// xsl:sort
- XSLTAttributeDef dataTypeAttr = new XSLTAttributeDef(null, "data-type",
false, true, true, XSLTAttributeDef.WARNING,
+ XSLTAttributeDef dataTypeAttr = new XSLTAttributeDef(null, "data-type",
false, true, true, XSLTAttributeDef.ERROR,
"text", Constants.SORTDATATYPE_TEXT
,"number", Constants.SORTDATATYPE_TEXT);
dataTypeAttr.setDefault("text");
@@ -311,25 +307,25 @@
// xsl:message
XSLTAttributeDef terminateAttr = new XSLTAttributeDef(null, "terminate",
- XSLTAttributeDef.T_YESNO, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_YESNO, false,
false,XSLTAttributeDef.ERROR);
terminateAttr.setDefault("no");
// top level attributes
XSLTAttributeDef xslExcludeResultPrefixesAttr =
new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
"exclude-result-prefixes",
- XSLTAttributeDef.T_STRINGLIST, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_STRINGLIST, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef xslExtensionElementPrefixesAttr =
new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
"extension-element-prefixes",
- XSLTAttributeDef.T_PREFIX_URLLIST, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_PREFIX_URLLIST, false,
false,XSLTAttributeDef.ERROR);
// result-element-atts
XSLTAttributeDef xslUseAttributeSetsAttr =
new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "use-attribute-sets",
- XSLTAttributeDef.T_QNAMES, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_QNAMES, false,
false,XSLTAttributeDef.ERROR);
XSLTAttributeDef xslVersionAttr =
new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "version",
- XSLTAttributeDef.T_NMTOKEN, false,
false,XSLTAttributeDef.WARNING);
+ XSLTAttributeDef.T_NMTOKEN, false,
false,XSLTAttributeDef.ERROR);
XSLTElementDef charData = new XSLTElementDef(this, null, "text()",
null /*alias */, null /* elements */, null,
/* attributes */
@@ -732,7 +728,7 @@
null /*alias */,
null /* elements */, // EMPTY
new XSLTAttributeDef[]{
- nameAttrOpt,
+ nameAttrOpt_ERROR,
decimalSeparatorAttr,
groupingSeparatorAttr,
infinityAttr,
1.14 +14 -4 xml-xalan/java/src/org/apache/xalan/templates/ElemPI.java
Index: ElemPI.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemPI.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ElemPI.java 10 Jul 2002 16:06:31 -0000 1.13
+++ ElemPI.java 24 Jul 2002 14:15:03 -0000 1.14
@@ -173,18 +173,28 @@
XPathContext xctxt = transformer.getXPathContext();
int sourceNode = xctxt.getCurrentNode();
- String piName = m_name_atv.evaluate(xctxt, sourceNode, this);
+
+ String piName = m_name_atv == null ? null : m_name_atv.evaluate(xctxt,
sourceNode, this);
+
+ // Ignore processing instruction if name is null
+ if (piName == null) return;
if (piName.equalsIgnoreCase("xml"))
{
- error(XSLTErrorResources.ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML);
//"processing-instruction name can not be 'xml'");
+ transformer.getMsgMgr().warn(
+ this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML,
+ new Object[]{ Constants.ATTRNAME_NAME, piName });
+ return;
}
// Only check if an avt was used (ie. this wasn't checked at compose
time.)
+ // Ignore processing instruction, if invalid
else if ((!m_name_atv.isSimple()) && (!isValidNCName(piName)))
{
- error(XSLTErrorResources.ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
- new Object[]{ piName }); //"processing-instruction name must be
a valid NCName: "+piName);
+ transformer.getMsgMgr().warn(
+ this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
+ new Object[]{ Constants.ATTRNAME_NAME, piName });
+ return;
}
// Note the content model is:
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]