Edwin,

Thanks, that fixes it! 

-Joe


On Sun, 16 Jan 2005 21:06:12 +0000, Edwin Dankert <[EMAIL PROTECTED]> wrote:
> The problem seems to be the default namespace problem.
> 
> The search '//Item' returns all 'Item' elements without a
> namespace.
> 
> To fix this, you could either prefix all your elements:
> <aws:ItemSearchResponse
> xmlns:aws="http://webservices.amazon.com/AWSECommerceService/2004-11-10";>
>  <aws:Items>
>    ...
>    <aws:Item>
>      ...
>    </aws:Item>
>    <aws:Item>
>      ...
>    </aws:Item>
>  </aws:Items>
> </aws:ItemSearchResponse>
> 
> and use the following XPath: //aws:Item
> 
> Or fix it using code by introducing a namespace-prefix mapping
> for your default namespace like this:
> 
> HashMap map = new HashMap();
> map.put( "aws", 
> "http://webservices.amazon.com/AWSECommerceService/2004-11-10";);
> DocumentFactory.getInstance().setXPathNamespaceURIs( map);
> 
> List nodes = document.selectNodes( "//aws:Item" );
> 
> Regards,
> Edwin
>


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to