1
我試圖查詢此XML文件的第11行上的codebase屬性。我如何XPath屬性的名稱空間不同於其祖先的
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<assemblyIdentity name="VcilApp.application" version="0.0.0.0" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
<description asmv2:publisher="VCIL" asmv2:product="VcilApp" xmlns="urn:schemas-microsoft-com:asm.v1" />
<deployment install="true" minimumRequiredVersion="0.0.0.0" co.v1:createDesktopShortcut="true">
<subscription>
<update>
<beforeApplicationStartup />
</update>
</subscription>
<deploymentProvider codebase="file://vandc/vcfileshare/VC Apps/Dialler/VcilApp.application" />
</deployment>
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
<framework targetVersion="4.5" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>
<dependency>
<dependentAssembly dependencyType="install" codebase="Application Files\VcilApp_3_0_9_2705\VcilApp.exe.manifest" size="26738">
<assemblyIdentity name="VcilApp.exe" version="0.0.0.0" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>7ikkD3Ls5FCfLulntbYd54jZwk/4L5dnNZ4rGBZELB8=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
</asmv1:assembly>
它需要沿着/組裝/部署/ deploymentProvider/@代碼庫的線,但空間前綴需要考慮的東西。部署元素可能會導致問題,因爲它不在asmv1名稱空間中,就像它的祖先一樣。
任何人都可以提供xpath到codebase屬性嗎?
如果您可以製作更易於理解的XML樣本來演示問題,那就太好了。 – 2013-05-09 16:42:53
@Lev對不起,我正在努力做到SO編輯器。我已經在這裏上傳了https://dl.dropboxusercontent.com/u/635601/VcilApp.application – gilles27 2013-05-09 16:44:38
您必須將所有來自xml的命名空間添加到您的樣式表中,並使用您分配給它們的前綴(可能與xml不同)。 – 2013-05-09 16:51:55