mrglavas 2004/04/14 12:23:53
Modified: java/src/org/apache/xerces/xinclude XIncludeHandler.java
java/src/org/apache/xerces/impl/msg
XIncludeMessages.properties
Log:
Updating implementation to incorporate change to XInclude namespace
from the latest draft: http://www.w3.org/TR/2004/CR-xinclude-20040413/
The namespace has been restored to http://www.w3.org/2001/XInclude,
replacing the namespace http://www.w3.org/2003/XInclude. Also,
removing the diagnostic for the 2001 namespace specified in the working
draft.
Revision Changes Path
1.25 +10 -52
xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java
Index: XIncludeHandler.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- XIncludeHandler.java 11 Mar 2004 18:15:18 -0000 1.24
+++ XIncludeHandler.java 14 Apr 2004 19:23:53 -0000 1.25
@@ -65,7 +65,7 @@
* <p>
* This component analyzes each event in the pipeline, looking for <include>
* elements. An <include> element is one which has a namespace of
- * <code>http://www.w3.org/2003/XInclude</code> and a localname of
<code>include</code>.
+ * <code>http://www.w3.org/2001/XInclude</code> and a localname of
<code>include</code>.
* When it finds an <include> element, it attempts to include the file
specified
* in the <code>href</code> attribute of the element. If inclusion succeeds, all
* children of the <include> element are ignored (with the exception of
@@ -110,8 +110,6 @@
public final static String XPOINTER = "xpointer";
public final static String XINCLUDE_NS_URI =
- "http://www.w3.org/2003/XInclude".intern();
- public final static String XINCLUDE_NS_URI_OLD =
"http://www.w3.org/2001/XInclude".intern();
public final static String XINCLUDE_INCLUDE = "include".intern();
public final static String XINCLUDE_FALLBACK = "fallback".intern();
@@ -263,10 +261,6 @@
// track whether a DTD is being parsed
private boolean fInDTD;
- // track whether a warning has already been reported for
- // use of the old http://www.w3.org/2001/XInclude namespace.
- private boolean fOldNamespaceWarningIssued;
-
// Constructors
public XIncludeHandler() {
@@ -296,7 +290,6 @@
fParentRelativeURI = null;
fIsXML11 = false;
fInDTD = false;
- fOldNamespaceWarningIssued = false;
baseURIScope.clear();
baseURI.clear();
@@ -1303,9 +1296,9 @@
}
/**
- * Returns true if the element has the namespace
"http://www.w3.org/2003/XInclude"
+ * Returns true if the element has the namespace
"http://www.w3.org/2001/XInclude"
* @param element the element to check
- * @return true if the element has the namespace
"http://www.w3.org/2003/XInclude"
+ * @return true if the element has the namespace
"http://www.w3.org/2001/XInclude"
*/
protected boolean hasXIncludeNamespace(QName element) {
// REVISIT: The namespace of this element should be bound
@@ -1316,64 +1309,29 @@
}
/**
- * Returns true if the element has the namespace
"http://www.w3.org/2001/XInclude"
- * @param element the element to check
- * @return true if the element has the namespace
"http://www.w3.org/2001/XInclude"
- */
- protected boolean hasXInclude2001Namespace(QName element) {
- // REVISIT: The namespace of this element should be bound
- // already. Why are we looking it up from the namespace
- // context? -- mrglavas
- return element.uri == XINCLUDE_NS_URI_OLD
- || fNamespaceContext.getURI(element.prefix) == XINCLUDE_NS_URI_OLD;
- }
-
- /**
* Checks if the element is an <include> element. The element must have
- * the XInclude namespace, and a local name of "include". If the local name
- * is "include" and the namespace name is the old XInclude namespace
- * "http://www.w3.org/2001/XInclude" a warning is issued the first time
- * an element from the old namespace is encountered.
+ * the XInclude namespace, and a local name of "include".
*
* @param element the element to check
* @return true if the element is an <include> element
* @see #hasXIncludeNamespace(QName)
*/
protected boolean isIncludeElement(QName element) {
- if (element.localpart.equals(XINCLUDE_INCLUDE)) {
- if (hasXIncludeNamespace(element)) {
- return true;
- }
- else if (!fOldNamespaceWarningIssued &&
hasXInclude2001Namespace(element)) {
- reportError("OldXIncludeNamespace", null,
XMLErrorReporter.SEVERITY_WARNING);
- fOldNamespaceWarningIssued = true;
- }
- }
- return false;
+ return element.localpart.equals(XINCLUDE_INCLUDE) &&
+ hasXIncludeNamespace(element);
}
/**
* Checks if the element is an <fallback> element. The element must have
- * the XInclude namespace, and a local name of "fallback". If the local name
- * is "fallback" and the namespace name is the old XInclude namespace
- * "http://www.w3.org/2001/XInclude" a warning is issued the first time
- * an element from the old namespace is encountered.
+ * the XInclude namespace, and a local name of "fallback".
*
* @param element the element to check
* @return true if the element is an <fallback; element
* @see #hasXIncludeNamespace(QName)
*/
protected boolean isFallbackElement(QName element) {
- if (element.localpart.equals(XINCLUDE_FALLBACK)) {
- if (hasXIncludeNamespace(element)) {
- return true;
- }
- else if (!fOldNamespaceWarningIssued &&
hasXInclude2001Namespace(element)) {
- reportError("OldXIncludeNamespace", null,
XMLErrorReporter.SEVERITY_WARNING);
- fOldNamespaceWarningIssued = true;
- }
- }
- return false;
+ return element.localpart.equals(XINCLUDE_FALLBACK) &&
+ hasXIncludeNamespace(element);
}
/**
1.7 +1 -4
xml-xerces/java/src/org/apache/xerces/impl/msg/XIncludeMessages.properties
Index: XIncludeMessages.properties
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/msg/XIncludeMessages.properties,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XIncludeMessages.properties 3 Dec 2003 07:32:56 -0000 1.6
+++ XIncludeMessages.properties 14 Apr 2004 19:23:53 -0000 1.7
@@ -6,7 +6,7 @@
NoFallback = An 'include' failed, and no 'fallback' element was found.
MultipleFallbacks = The [children] of an 'include' element cannot contain more than
one 'fallback' element.
FallbackParent = A 'fallback' element was found that did not have 'include' as the
parent.
-IncludeChild = Elements from namespace ''http://www.w3.org/2003/XInclude'', other
than ''fallback'', are not allowed to be children of ''include'' elements. However,
''{0}'' was found.
+IncludeChild = Elements from namespace ''http://www.w3.org/2001/XInclude'', other
than ''fallback'', are not allowed to be children of ''include'' elements. However,
''{0}'' was found.
HrefMissing = The 'href' attribute of an 'include' element is missing.
RecursiveInclude = Recursive include detected. Document ''{0}'' was already
processed.
InvalidParseValue = Invalid value for ''parse'' attribute on ''include'' element:
''{0}''.
@@ -16,9 +16,6 @@
NonDuplicateNotation = Multiple notations were used which had the name ''{0}'', but
which were not determined to be duplicates.
NonDuplicateUnparsedEntity = Multiple unparsed entities were used which had the
name ''{0}'', but which were not determined to be duplicates.
XpointerMissing = xpointer attribute must be present when href attribute is absent
-
-# Warning Messages
-OldXIncludeNamespace = At least one 'include' or 'fallback' element in the document
is bound to the old ''http://www.w3.org/2001/XInclude'' namespace. This namespace is
no longer processed. The namespace ''http://www.w3.org/2003/XInclude'' must be used
for XInclude processing.
# Messages from erroneous set-up
IncompatibleNamespaceContext = The type of the NamespaceContext is incompatible
with using XInclude; it must be an instance of XIncludeNamespaceSupport
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]