使用Java检索XML文件中的XSL URL和名称
我有一个简单的XML文件,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="01C3_OIZODEMO_certificato_v1.0.xsl"?>
<Certificato>
<TD:Global xmlns:TD="http://www.xxxx.org/TD_tags">
<TD:XSL_Def>
<TD:orig>http://www.xxxx.com/xsl/</TD:orig>
</TD:XSL_Def>
</TD:Global>
<TipoCert>Stato civile</TipoCert>
<Nominativo>Fenil Postume</Nominativo>
<DatiNascita>
<DataNas>01/01/2099</DataNas>
<Luogo>Perengana</Luogo>
<Atto>Atto n. 735 p.1 s.A u. 1</Atto>
</DatiNascita>
<Indirizzo>
<Via>Via Perengana</Via>
<NumeroCivico>0</NumeroCivico>
<Cap>99999</Cap>
<Frazione>NA</Frazione>
</Indirizzo>
<Testo>TEST</Testo>
<Data>22/12/2010</Data>
<Ora>10:48:00</Ora>
</Certificato>
如何使用Java中的xml API检索文件名“01C3_OIZODEMO_certificato_v1.0.xsl”
非常感谢
# 1 楼答案
使用正则表达式
<\?xml-stylesheet type="text/xsl" href="(.*?)"\?>