The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 XML Manipulation using XMLTask
Subject:  XmlTask (com.oopsconsultancy.xmltask.ant.XmlTask) bug with attributes within node
Date:  2008-01-09 20:29:08
From:  zhkl0228
Response to: XmlTask (com.oopsconsultancy.xmltask.ant.XmlTask) bug with attributes within node


update the com.oopsconsultancy.xmltask.jdk15.XPathAnalyser15.analyse method to follow:

public int analyse(Node node, String xpath) throws Exception { int count = 0; Document document = null; if(node instanceof Document) { document = (Document) node; } else { document = node.getOwnerDocument(); } PrefixResolver resolver = new PrefixResolverDefault(document.getDocumentElement()); XObject result = XPathAPI.eval(node, xpath, resolver); if (result instanceof XNodeSet) { NodeIterator nl = result.nodeset(); Node n; while ((n = nl.nextNode()) != null) { client.applyNode(n, callback); count++; } } else if (result instanceof XBoolean || result instanceof XNumber || result instanceof XString) { String str = result.str(); client.applyNode(str, callback); count++; } return count; }
then renew the xmltask-v1.15.1.jar. for the source:

<?xml version="1.0" encoding="UTF-8"?> <ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"> <display-name>lwm.mss.process.transferEJB</display-name> <enterprise-beans> <session id="Module"> <description>Module</description> <ejb-name>Module</ejb-name> <local-home>com.ibm.wsspi.sca.ejb.module.ServiceLocalHome</local-home> <local>com.ibm.wsspi.sca.ejb.module.ServiceLocal</local> <ejb-class>com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <ejb-ref id="import.ImportLDAPIntf"> <description>sca/import/ImportLDAPIntf</description> <ejb-ref-name>sca/import/ImportLDAPIntf</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>com.ibm.wsspi.sca.ejb.module.ServiceHome</home> <remote>com.ibm.wsspi.sca.ejb.module.ServiceRemote</remote> </ejb-ref> <ejb-ref id="import.ImportBRIntf"> <description>sca/import/ImportBRIntf</description> <ejb-ref-name>sca/import/ImportBRIntf</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>com.ibm.wsspi.sca.ejb.module.ServiceHome</home> <remote>com.ibm.wsspi.sca.ejb.module.ServiceRemote</remote> </ejb-ref> <!-- extension-point service-ref --> <!-- extension-point resource-ref --> </session> </ejb-jar>
your display name xpath will look like "/:ejb-jar/:display-name/text()"






 Feed java.net RSS Feeds