0

I am parsing this XML file in python using ElementTree.

<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
    http://www.springframework.org/schema/webflow
    http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">

<secured attributes="ROLE_USER" />

<input name="hotelId" required="true" />

<on-start>
    <evaluate expression="bookingService.createBooking(hotelId, currentUser.name)" result="flowScope.booking" />
</on-start>

<view-state id="enterBookingDetails" model="booking">
    <transition on="proceed" to="reviewBooking" />
    <transition on="cancel" to="bookingCancelled" bind="false" />
</view-state>

<view-state id="reviewBooking">
    <transition on="confirm" to="bookingConfirmed">
        <evaluate expression="bookingService.persistBooking(booking)" />
    </transition>
    <transition on="revise" to="enterBookingDetails" />
    <transition on="cancel" to="bookingCancelled" />
</view-state>

<end-state id="bookingConfirmed" />

<end-state id="bookingCancelled" />

</flow>

I need the node immediately next to <on-start> node, but that node has to be a Spring Webflow state node i.e, either a <view-state>, <action-state> or <decision-state> etc. How can I do this using ElementTree?

mzjn
  • 48,958
  • 13
  • 128
  • 248
shweta
  • 107
  • 2
  • 14
  • 1
    Can you please provide with the code you've written so far? – Johan Sep 28 '18 at 08:45
  • An element at index `ix` in a list of sibling elements will have its first following sibling at index `ix + 1`. See my answer to this similar question: https://stackoverflow.com/q/51626950/407651. – mzjn Sep 30 '18 at 07:27

0 Answers0