I have this piece of xml string.
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:libraries="http://www.ibm.com/websphere/appserver/schemas/5.0/libraries.xmi">
<libraries:Library xmi:id="Library_1382473016602" name="sfi_lib" isolatedClassLoader="false">
<classPath>${HOME_SFI_LIB}/sfi_com_sqw_java.jar</classPath>
</libraries:Library>
<libraries:Library xmi:id="Library_1528914932212" name="sfi_lib_server" isolatedClassLoader="false">
<classPath>${HOME_SFI_LIB}/jasper/jasperreports-5.6.0.jar</classPath>
<classPath>${HOME_SFI_LIB}/jasper/jasperreports-fonts-3.7.4.jar</classPath>
<classPath>${HOME_SFI_LIB}/commons/commons-beanutils-1.8.2.jar</classPath>
<classPath>${HOME_SFI_LIB}/commons/commons-collections-3.2.1.jar</classPath>
<classPath>${HOME_SFI_LIB}/commons/commons-digester-2.1.jar</classPath>
<classPath>${HOME_SFI_LIB}/commons/commons-discovery-0.2.jar</classPath>
<classPath>${HOME_SFI_LIB}/commons/commons-logging-1.1.1.jar</classPath>
<classPath>${HOME_SFI_LIB}/commons/xml-apis.jar</classPath>
<classPath>${HOME_SFI_LIB}/commons/iText-2.1.7.jar</classPath>
<classPath>${HOME_SFI_LIB}/jasper/barbecue-1.5-beta1.jar</classPath>
<classPath>${HOME_SFI_LIB}/bouncycastle/bcprov-jdk15-1.45.jar</classPath>
<classPath>${HOME_SFI_LIB}/bouncycastle/bcmail-jdk15-1.45.jar</classPath>
<classPath>${HOME_SFI_LIB}/bouncycastle/bctsp-jdk14-1.45.jar</classPath>
<classPath>${HOME_SFI}/sfi_arquivos/templates</classPath>
<classPath>${HOME_SFI_LIB}/sfi_framework_java.jar</classPath>
<classPath>${HOME_SFI_LIB}/sfi_adm_ama_java.jar</classPath>
<classPath>${HOME_SFI_LIB}/sfi_adm_gce_java.jar</classPath>
<classPath>${HOME_SFI_LIB}/sfi_adm_gdl_java.jar</classPath>
<classPath>${HOME_SFI_LIB}/sfi_adm_prt_java.jar</classPath>
<classPath>${HOME_SFI_LIB}/sfi_com_acg_java.jar</classPath>
<classPath>${HOME_SFI_LIB}/sfi_com_sca_java.jar</classPath>
<classPath>${HOME_SFI_LIB}/sfi_com_tge_java.jar</classPath>
<classPath>${HOME_SFI_LIB}/sfi_com_utl_java.jar</classPath>
<classPath>${HOME_SFI_LIB}/sfi_ext_sge_java.jar</classPath>
</libraries:Library>
</xmi:XMI>
What I'm trying to do is get the values of the elements that starts with ${HOME_SFI_LIB}/sfi_
.
I'm using re
python's module to do the work. My current code is filtering only by tag classPath
, but is not enough. The regular expression I'm currently using:
re.findall('<classPath>(.*?)</classPath>', xml)
Can someone help me to improve my RE in order to filter the elements that starts with ${HOME_SFI_LIB}/sfi_
, like the node <classPath>${HOME_SFI_LIB}/sfi_adm_gce_java.jar</classPath>
?