mrglavas    2005/05/08 11:54:10

  Modified:    java/src/org/apache/xerces/xinclude XIncludeHandler.java
  Log:
  Report a resource error when parse="xml", href="" and an xpointer has been 
specified.
  This is a same document reference which this processor cannot handle because 
of its
  streaming nature.
  
  Revision  Changes    Path
  1.48      +12 -3     
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.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- XIncludeHandler.java      5 May 2005 17:59:55 -0000       1.47
  +++ XIncludeHandler.java      8 May 2005 18:54:10 -0000       1.48
  @@ -19,6 +19,7 @@
   import java.io.IOException;
   import java.util.ArrayList;
   import java.util.Enumeration;
  +import java.util.Locale;
   import java.util.Stack;
   import java.util.StringTokenizer;
   
  @@ -261,6 +262,7 @@
       protected XMLParserConfiguration fChildConfig;
   
       protected XMLLocator fDocLocation;
  +    protected XIncludeMessageFormatter fXIncludeMessageFormatter = new 
XIncludeMessageFormatter();
       protected XIncludeNamespaceSupport fNamespaceContext;
       protected SymbolTable fSymbolTable;
       protected XMLErrorReporter fErrorReporter;
  @@ -1374,8 +1376,7 @@
           fErrorReporter = reporter;
           if (fErrorReporter != null) {
               fErrorReporter.putMessageFormatter(
  -                XIncludeMessageFormatter.XINCLUDE_DOMAIN,
  -                new XIncludeMessageFormatter());
  +                XIncludeMessageFormatter.XINCLUDE_DOMAIN, 
fXIncludeMessageFormatter);
               // this ensures the proper location is displayed in error 
messages
               if (fDocLocation != null) {
                   fErrorReporter.setDocumentLocator(fDocLocation);
  @@ -1437,6 +1438,14 @@
               if (xpointer == null) {
                   reportFatalError("XpointerMissing");
               }
  +            else {
  +                // When parse="xml" and an xpointer is specified treat 
  +                // all absences of the href attribute as a resource error.
  +                Locale locale = (fErrorReporter != null) ? 
fErrorReporter.getLocale() : null;
  +                String reason = 
fXIncludeMessageFormatter.formatMessage(locale, "XPointerStreamability", null);
  +                reportResourceError("XMLResourceError", new Object[] { href, 
reason });
  +                return false;
  +            }
           }
   
           URI hrefURI = null;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to