You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2003/09/14 06:31:04 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/dtd XMLDTDLoader.java

mrglavas    2003/09/13 21:31:04

  Modified:    java/src/org/apache/xerces/impl/dtd XMLDTDLoader.java
  Log:
  Fixes: Ensure we have a message formatter, and that the locator for the error reporter is the current entity scanner.
  Errors reported had garbled messages and no locator info.
  
  Revision  Changes    Path
  1.8       +17 -3     xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDLoader.java
  
  Index: XMLDTDLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDLoader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLDTDLoader.java	16 Jan 2003 23:03:08 -0000	1.7
  +++ XMLDTDLoader.java	14 Sep 2003 04:31:04 -0000	1.8
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -61,6 +61,7 @@
   import org.apache.xerces.impl.XMLDTDScannerImpl;
   import org.apache.xerces.impl.XMLErrorReporter;
   import org.apache.xerces.impl.XMLEntityManager;
  +import org.apache.xerces.impl.msg.XMLMessageFormatter;
   
   import org.apache.xerces.util.SymbolTable;
   import org.apache.xerces.util.DefaultErrorHandler;
  @@ -80,7 +81,7 @@
   
   /**
    * The DTD loader. The loader knows how to build grammars from XMLInputSources.
  - * It extends the dTD processor in order to do this; it's
  + * It extends the DTD processor in order to do this; it's
    * a separate class because DTD processors don't need to know how
    * to talk to the outside world in their role as instance-document
    * helpers.
  @@ -184,6 +185,12 @@
               errorReporter.setProperty(ERROR_HANDLER, new DefaultErrorHandler());
           }
           fErrorReporter = errorReporter;
  +        // Add XML message formatter if there isn't one.
  +        if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
  +            XMLMessageFormatter xmft = new XMLMessageFormatter();
  +            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
  +            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
  +        }
           fEntityResolver = entityResolver;
           if(fEntityResolver instanceof XMLEntityManager) {
               fEntityManager = (XMLEntityManager)fEntityResolver;
  @@ -286,6 +293,12 @@
               fEntityManager.setProperty(propertyId, value);
           } else if(propertyId.equals( ERROR_REPORTER)) {
               fErrorReporter = (XMLErrorReporter)value;
  +            // Add XML message formatter if there isn't one.
  +            if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
  +                XMLMessageFormatter xmft = new XMLMessageFormatter();
  +                fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
  +                fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
  +            }
               fDTDScanner.setProperty(propertyId, value);
               fEntityManager.setProperty(propertyId, value);
           } else if(propertyId.equals( ERROR_HANDLER)) {
  @@ -404,6 +417,7 @@
           super.reset();
           fDTDScanner.reset();
           fEntityManager.reset();
  +        fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner());
       }
   
   } // class XMLDTDLoader
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org