Changeset 1585 for trunk/docx4j/src/main


Ignore:
Timestamp:
07/03/11 08:47:39 (11 months ago)
Author:
jharrop
Message:

Some XPath debug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/src/main/java/org/docx4j/XmlUtils.java

    r1579 r1585  
    8181        private static Logger log = Logger.getLogger(XmlUtils.class);    
    8282                 
     83        // See http://www.edankert.com/jaxpimplementations.html for 
     84        // a helpful list. 
    8385         
    8486        public static String TRANSFORMER_FACTORY_ORIGINAL; 
     
    864866        for( Node n : xpath(node, xpathExpr) ) { 
    865867                Object o = binder.getJAXBNode(n); 
    866                 if (o==null)  
    867                         System.out.println("no association"); 
    868                 else resultList.add(o); 
     868                if (o==null) { 
     869                        log.warn("no object association for xpath result!"); 
     870                } else { 
     871                        if (o instanceof javax.xml.bind.JAXBElement) { 
     872                                log.warn("added " + JAXBElementDebug((JAXBElement)o) ); 
     873                        } else { 
     874                                log.warn("added " + o.getClass().getName() );                            
     875                        } 
     876                        resultList.add(o);                       
     877                } 
    869878        } 
    870879        return resultList; 
     
    882891 
    883892    public static List<Node> xpath(Node node, String xpathExpression, NamespaceContext nsContext) { 
     893         
     894//      log.info("Using XPathFactory: " + XPathFactory.DEFAULT_PROPERTY_NAME + ": "  
     895//                      + System.getProperty(XPathFactory.DEFAULT_PROPERTY_NAME));     
     896//        System.setProperty(XPathFactory.DEFAULT_PROPERTY_NAME,  
     897//                      "org.apache.xpath.jaxp.XPathFactoryImpl"); 
     898         
    884899        // create XPath 
    885900        XPathFactory xpf = XPathFactory.newInstance(); 
     
    891906            List<Node> result = new ArrayList<Node>(); 
    892907            NodeList nl = (NodeList) xpath.evaluate(xpathExpression, node, XPathConstants.NODESET); 
    893             for( int i=0; i<nl.getLength(); i++ ) 
     908            log.warn("evaluate returned " + nl.getLength() ); 
     909            for( int i=0; i<nl.getLength(); i++ ) { 
    894910                result.add(nl.item(i)); 
     911            } 
    895912            return result; 
    896913        } catch (XPathExpressionException e) { 
Note: See TracChangeset for help on using the changeset viewer.