ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml ElementHandler.java ParseContext.java
Date Fri, 14 Jun 2002 06:36:51 GMT
conor       2002/06/13 23:36:51

  Modified:    proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml
                        ElementHandler.java ParseContext.java
  Added:       proposal/mutant/lib/parser xercesImpl.jar xml-apis.jar
  Removed:     proposal/mutant/lib/parser crimson.jar jaxp.jar
  Log:
  Move to Xerces parser - needs some context loader setup
  
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/mutant/lib/parser/xercesImpl.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-ant/proposal/mutant/lib/parser/xml-apis.jar
  
  	<<Binary file>>
  
  
  1.8       +9 -4      jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ElementHandler.java
  
  Index: ElementHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ElementHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -w -u -r1.7 -r1.8
  --- ElementHandler.java	13 Jun 2002 15:47:55 -0000	1.7
  +++ ElementHandler.java	14 Jun 2002 06:36:51 -0000	1.8
  @@ -341,10 +341,15 @@
               }
               String localName = attributes.getLocalName(i);
               String qName = attributes.getQName(i);
  -            if (uri == null && qName.indexOf(":") != -1) {
  +            
  +            if (uri == null) {
  +                if (qName.indexOf(":") != -1) {
                   // try to resolve through known namespaces
                   uri = context.resolveNamespace(qName);
                   localName = qName.substring(qName.indexOf(":") + 1);
  +                } else {
  +                    localName = qName;
  +                }
               }
   
               String attributeValue = attributes.getValue(i);
  
  
  
  1.8       +24 -2     jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ParseContext.java
  
  Index: ParseContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ParseContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -w -u -r1.7 -r1.8
  --- ParseContext.java	13 Jun 2002 15:47:55 -0000	1.7
  +++ ParseContext.java	14 Jun 2002 06:36:51 -0000	1.8
  @@ -86,8 +86,19 @@
            = new CircularDependencyChecker("parsing XML");
   
       /** The factory used to create SAX parsers. */
  -    private SAXParserFactory parserFactory = SAXParserFactory.newInstance();
  +    private SAXParserFactory parserFactory;
   
  +    public ParseContext() {
  +        Thread thread = Thread.currentThread();
  +        ClassLoader currentContextLoader = thread.getContextClassLoader();
  +        try {
  +            ClassLoader thisLoader = this.getClass().getClassLoader();
  +            thread.setContextClassLoader(thisLoader);
  +            parserFactory = SAXParserFactory.newInstance();
  +        } finally {
  +            thread.setContextClassLoader(currentContextLoader);
  +        }
  +    }
   
       /**
        * Parse a URL using the given root handler
  @@ -119,7 +130,18 @@
               checker.visitNode(source);
   
               // create a parser for this source
  -            SAXParser saxParser = parserFactory.newSAXParser();
  +            SAXParser saxParser = null;
  +            
  +            Thread thread = Thread.currentThread();
  +            ClassLoader currentContextLoader = thread.getContextClassLoader();
  +            try {
  +                ClassLoader thisLoader = this.getClass().getClassLoader();
  +                thread.setContextClassLoader(thisLoader);
  +                saxParser = parserFactory.newSAXParser();
  +            } finally {
  +                thread.setContextClassLoader(currentContextLoader);
  +            }
  +            
               XMLReader xmlReader = saxParser.getXMLReader();
   
               // create a root handler for this
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message