如何从包含句点的标记名称的XML文件中提取数据
大家好,
我有一个文件,似乎它包含网站的标签(意大利语和英语两种语言)。基本上,该文件包含我的报告的所有查找。该文件没有结构,因为所有内容都在一个级别上。
Hi all,
I have a file where it seems that it contains labels for a website (into two languages Italian and English). Basically, the file contains all the look ups for my report. The file has no structure since everything is on one level.
<labels>
<ULOCALI.DESCR.AA lang="IT">AZIENDA AGRICOLA</ULOCALI.DESCR.AA>
<ULOCALI.DESCR.AA lang="EN">FARM</ULOCALI.DESCR.AA>
<ULOCALI.DESCR.ACL lang="IT">STUDIO DIAGNOSTICA E ANALISI CLINICHE</ULOCALI.DESCR.ACL>
<ULOCALI.DESCR.ACL lang="EN">DIAGNOSTICS AND CLINICAL ANALYSIS STUDY</ULOCALI.DESCR.ACL>
<ULOCALI.DESCR.AD lang="IT">ALBERGO DIURNO</ULOCALI.DESCR.AD>
<ULOCALI.DESCR.AD lang="EN">DAY TIME HOTEL</ULOCALI.DESCR.AD>
<CARICA.ACP lang="IT">AMMINISTRATORE CON POSTILLA</CARICA.ACP>
<CARICA.ACP lang="EN">ADMINISTRATOR (AMMINISTRATORE CON POSTILLA)</CARICA.ACP>
<CARICA.ACR lang="IT">AMMINISTRATORE CON REQUISITI</CARICA.ACR>
<CARICA.ACR lang="EN">ADMINISTRATOR (AMMINISTRATORE CON REQISITI)</CARICA.ACR>
</labels>
<tipoUnitaLocale>
<codiceAttivitaUnitaLocale>ACL</codiceAttivitaUnitaLocale>
</tipoUnitaLocale>
现在当我得到下面的XML时,我需要从标签'< codiceAttivitaUnitaLocale>'中提取值,然后尝试从中获取值XML查找文件,包含在'< ULOCALI.DESCR.ACL lang =" EN"> DIAGNOSTICS AND CLINICAL ANALYSIS STUDY< /ULOCALI.DESCR.ACL>'。
如何做我实现了这一点?我是否首先需要通过'document()'方法加载XML查找文件然后搜索?如何处理带有句点的XML元素名称,它们是否与其他标签相同?
Now when I get the XML below I need to pull the value from the tag '<codiceAttivitaUnitaLocale>' and then try to get the value from the XML lookup file, which is contained in '<ULOCALI.DESCR.ACL lang="EN">DIAGNOSTICS AND CLINICAL ANALYSIS STUDY</ULOCALI.DESCR.ACL>'.
How do I achieve this? Do I firstly need to load in the XML look up file via the 'document()' method and then search that? How do I deal with XML element names with periods in them, are they the same as any other tag?
<xsl:variable name="LookupData" select="document('reportLookup.xml')" />
如果我加载了XML查找文件,那么我是否需要针对'LookupData'变量运行XPath语句?
谢谢
尝试
If I loaded the XML look up file, would i then need to run XPath statements against the 'LookupData' variable?
Thanks
Tryst
对不起,在我的问题中,当我说'现在当我得到下面的XML时......'这是下面的XML ...
Sorry, in my question, when I say 'Now when I get the XML below...' This is the XML that is meant to be below...
<tipoUnitaLocale>
<codiceAttivitaUnitaLocale>ACL</codiceAttivitaUnitaLocale>
</tipoUnitaLocale>
(我试过编辑但是搞乱了XML格式化)
(I tried editting it but it messed up the XML formatting)