[jdom-interest] Error in parsing wsdl file using jdom
Paul Libbrecht
paul at activemath.org
Tue Aug 9 05:09:38 PDT 2005
(please keep the subject right!)
How about:
org.jdom.xpath.XPath xp = org.jdom.xpath.XPath.newInstance("wsdl:path");
xp.addNamespace("wsdl","http://w3.org/1974/wsdl");
xp.selectNodes(elt);
The jaxen doc might help you maybe as well in case.
paul
Le 9 août 05, à 13:21, Madhuraj S V a écrit :
> Hi paul,
> thanks for the reply.
> But can u please give an example of how to add namespace prefix to the
> Xpath.
> An example would be of great help.
>
> Awaiting ur response
>
>
>>
>> Aren't you missing namespace prefixes in your XPath expression ?
>>
>> paul
>>
>>
>> Le 8 août 05, à 14:56, Madhuraj S V a écrit :
>>
>> > Hi,
>> >
>> > Iam a newbie to JDom.
>> >
>> > Iam trying a parse a wsdl file named CalculatorService to get the
>> > value of the message attribute of input element which happens to be
>> > the child of operation element.
>> > i created a Xpath instance for /definitions/portType/operation[@name
>> > ="add"]
>> > but when i say xpath.selectNodes() it returns empty list even though
>> > it has element with the given value
>> >
>> >
>> > please find the code snippet i used
>> >
>> > StringBuffer sb = new StringBuffer();
>> > sb.append("/definitions/portType/operation[@name = \"");
>> > sb.append("add").append("\"]");
>> > Document doc = builder.build(new File(" CalculatorService.wsdl"));
>> > Namespace ns = Namespace.getNamespace("wsdl",
>> > "http://schemas.xmlsoap.org/wsdl/") ;
>> > XPath xp = XPath.newInstance(sb.toString ());
>> > xp.addNamespace(ns);
>> > List ele = xp.selectNodes(doc);
>> > System.out.println(" the list is "+ele);
>> >
>> > anyhelp please in getting the correct values
>> >
>> >
>> > Awaiting ur response
>> >
>> > --
>>
>> --
>> Regards
>> Madhu Raj
>> svmadhuraj at gmail.com _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
More information about the jdom-interest
mailing list