mrglavas    2005/07/24 16:36:14

  Modified:    java/src/org/apache/xerces/jaxp/validation
                        StreamValidatorHelper.java
  Log:
  If the validator is reading from a StreamSource the messages
  for well-formedness errors weren't being formatted correctly.
  We need to register a message formatter. Should be fixed now.
  
  Revision  Changes    Path
  1.2       +11 -2     
xml-xerces/java/src/org/apache/xerces/jaxp/validation/StreamValidatorHelper.java
  
  Index: StreamValidatorHelper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/jaxp/validation/StreamValidatorHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StreamValidatorHelper.java        22 May 2005 20:12:47 -0000      1.1
  +++ StreamValidatorHelper.java        24 Jul 2005 23:36:14 -0000      1.2
  @@ -25,6 +25,8 @@
   import javax.xml.transform.stream.StreamSource;
   
   import org.apache.xerces.impl.Constants;
  +import org.apache.xerces.impl.XMLErrorReporter;
  +import org.apache.xerces.impl.msg.XMLMessageFormatter;
   import org.apache.xerces.parsers.XML11Configuration;
   import org.apache.xerces.xni.XNIException;
   import org.apache.xerces.xni.parser.XMLInputSource;
  @@ -134,7 +136,14 @@
           XML11Configuration config = new XML11Configuration();
           config.setProperty(ENTITY_RESOLVER, 
fComponentManager.getProperty(ENTITY_RESOLVER));
           config.setProperty(ERROR_HANDLER, 
fComponentManager.getProperty(ERROR_HANDLER));
  -        config.setProperty(ERROR_REPORTER, 
fComponentManager.getProperty(ERROR_REPORTER));
  +        XMLErrorReporter errorReporter = (XMLErrorReporter) 
fComponentManager.getProperty(ERROR_REPORTER);
  +        config.setProperty(ERROR_REPORTER, errorReporter);
  +        // add message formatters
  +        if 
(errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
  +            XMLMessageFormatter xmft = new XMLMessageFormatter();
  +            
errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
  +            
errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
  +        }
           config.setProperty(SYMBOL_TABLE, 
fComponentManager.getProperty(SYMBOL_TABLE));
           config.setProperty(VALIDATION_MANAGER, 
fComponentManager.getProperty(VALIDATION_MANAGER));
           config.setDocumentHandler(fSchemaValidator);
  
  
  

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

Reply via email to