• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

has anyone encountered this problem when using xpath

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have run into a problem with part of my code ie. where I use XPath. For some reason its returning the portion of the node tree from where I make my request. eg.
Document dom = createDomFromXML(notificationXML);
String notificationBatchXPath = notifications/notification[@name='BATCH_NOTIFICATION'];
//notifications/notification[@name='BATCH_NOTIFICATION']
Node nodeBatch = XPathAPI.selectSingleNode((Node)dom, notificationBatchXPath);
where notificationXML is notifications.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<notifications>

<notification name='BATCH_NOTIFICATION'>
<columns>
<column>field_id</column>
<column>old_value</column>
<column>new_value</column>
</columns>
</notification>

<notification name='NEXT_WORKFLOW'>
<columns>
<column>field_id</column>
<column>old_value</column>
</columns>
</notification>

<notification name='HISTORY_WORKFLOW'>
<columns>
<column>field_id</column>
</columns>
</notification>
</notifications>
so in this request I would expect
<columns>
<column>field_id</column>
<column>old_value</column>
<column>new_value</column>
</columns>
but I get
<columns>
<column>field_id</column>
<column>old_value</column>
<column>new_value</column>
</columns>
<columns>
<column>field_id</column>
<column>old_value</column>
</columns>
<columns>
<column>field_id</column>
</columns>
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic