python - 如何获取同级别的下一个直接xml节点
问题描述
我正在使用 ElementTree 在 python 中解析这个 XML 文件。
<?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>
我需要紧邻节点的节点,但该节点必须是 Spring Webflow 状态节点,<on-start>
即 a或等。如何使用 ElementTree 执行此操作?<view-state>
<action-state>
<decision-state>
解决方案
推荐阅读
- jquery - 标题的间距不正确
- r - R中的单个整数
- matlab - 当我们在数组内部使用波浪号时,Matlab 中的波浪号有什么用
- c# - Xamarin.iOS 底部视图部分超出视口,直到滚动(LargeTitle、SearchBar、ListView 和 BoxView 组合)
- c++ - 如何在文件仍然打开时删除文本文件的内容(不重新打开文件)?
- python - 如何将不同的函数分配给一个变量,以便根据条件使用不同的函数
- c++ - 程序因 While 循环而崩溃
- keras - 如何在模型创建期间在 keras/tensorflow 中执行层的笛卡尔积?
- java - 断开连接后重试 AWS IoT 作业执行
- java - 我的 JavaFx 应用程序在 jdk 8 和 Mac OSX 中随机冻结