我正在尝试获取信息<l7:Name>
并对应所有<l7:IssuerName>
<?xml version="1.0" encoding="UTF-8"?>
<l7:List xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
<l7:Item>
<l7:Name>services.company.int</l7:Name>
<l7:Id>00000000000000000000000000000004:-services.company.int</l7:Id>
<l7:Type>SSG_KEY_ENTRY</l7:Type>
<l7:TimeStamp>2018-08-28T10:25:04.615-05:00</l7:TimeStamp>
<l7:Link rel="self" uri="https://10.154.244.13:443/restman/1.0/privateKeys/00000000000000000000000000000004:-services.company.int"/>
<l7:Resource>
<l7:PrivateKey alias="-services.company.int" keystoreId="00000000000000000000000000000004" id="00000000000000000000000000000004:-services.company.int">
<l7:CertificateChain>
<l7:CertificateData>
<l7:IssuerName>CN=MC Access Management sub CA,OU=Global Information Security,O=company WorldWide,DC=company,DC=net</l7:IssuerName>
<l7:SerialNumber>83060681499471284401614700485002472352</l7:SerialNumber>
<l7:SubjectName>DC=net,DC=company,O=company WorldWide - CentralAuth,OU=xmlgw-auth-client,CN=services.company.int</l7:SubjectName>
</l7:CertificateData>
<l7:CertificateData>
<l7:IssuerName>CN=Access Management root CA,OU=Global Information Security,O=company WorldWide,DC=company,DC=net</l7:IssuerName>
</l7:CertificateData>
<l7:CertificateData>
<l7:IssuerName>CN=Access Management root CA,OU=Global Information Security,O=company WorldWide,DC=company,DC=net</l7:IssuerName>
</l7:CertificateData>
</l7:CertificateChain>
<l7:Properties>
<l7:Property key="keyAlgorithm">
<l7:StringValue>RSA</l7:StringValue>
</l7:Property>
</l7:Properties>
</l7:PrivateKey>
</l7:Resource>
</l7:Item>
<l7:Item>
<l7:Name>directory-company-com</l7:Name>
<l7:Id>00000000000000000000000000000004:--directory-company-com</l7:Id>
<l7:Type>SSG_KEY_ENTRY</l7:Type>
<l7:TimeStamp>2018-08-28T10:25:04.615-05:00</l7:TimeStamp>
<l7:Resource>
<l7:PrivateKey alias="--directory-company-com" keystoreId="00000000000000000000000000000004" id="00000000000000000000000000000004:--directory-company-com">
<l7:CertificateChain>
<l7:CertificateData>
<l7:IssuerName>CN=PRD company 3DS1 Issuer Sub CA,OU=company Identity Check Gen 3,O=company,C=US</l7:IssuerName>
<l7:SubjectName>CN=.directory.company.com,OU=gateway-signing,O=company Worldwide,C=US</l7:SubjectName>
</l7:CertificateData>
<l7:CertificateData>
<l7:IssuerName>CN=PRD company Identity Check Root CA,OU=company Identity Check Gen 3,O=company,C=US</l7:IssuerName>
<l7:SerialNumber>231453887433606512122984068379445229638</l7:SerialNumber>
<l7:SubjectName>CN=PRD company 3DS1 Issuer Sub CA,OU=company Identity Check Gen 3,O=company,C=US</l7:SubjectName>
</l7:CertificateData>
<l7:CertificateData>
<l7:IssuerName>CN=PRD company Identity Check Root CA,OU=company Identity Check Gen 3,O=company,C=US</l7:IssuerName>
<l7:SubjectName>CN=PRD company Identity Check Root CA,OU=company Identity Check Gen 3,O=company,C=US</l7:SubjectName>
</l7:CertificateData>
</l7:CertificateChain>
<l7:Properties>
<l7:Property key="keyAlgorithm">
<l7:StringValue>RSA</l7:StringValue>
</l7:Property>
</l7:Properties>
</l7:PrivateKey>
</l7:Resource>
</l7:Item>
</l7:List>
我已经尝试过此/l7:List/l7:Item/l7:Resource/l7:PrivateKey/l7:CertificateChain/l7:CertificateData/l7:IssuerName
和/l7:List/l7:Item/l7:Name
。
我正在努力将两者关联起来。
任何建议都会有所帮助。
期望输出
<l7:Name>services.company.int</l7:Name>
<l7:IssuerName>CN=MC Access Management sub CA,OU=Global Information Security,O=company WorldWide,DC=company,DC=net</l7:IssuerName>
<l7:IssuerName>CN=Access Management root CA,OU=Global Information Security,O=company WorldWide,DC=company,DC=net</l7:IssuerName>
答案 0 :(得分:1)
那不是属性,那是名称空间。查找xpath和名称空间。
这里是至少可以找到“ l7:issuername”的快速代码:
//*[name()='l7:issuername']
找到6,将它们放入数组中,并对它们进行所需的操作。
祝你好运!
如kjhughes所述,您也可以这样做。
//*[name()='l7:IssuerName' or name()='l7:Name']
答案 1 :(得分:1)
此XPath,
/l7:List/l7:Item//*[self::l7:Name or self::l7:IssuerName]
将选择
<l7:Name>services.company.int</l7:Name>
<l7:IssuerName>CN=MC Access Management sub CA,OU=Global Information Security,O=company WorldWide,DC=company,DC=net</l7:IssuerName>
<l7:IssuerName>CN=Access Management root CA,OU=Global Information Security,O=company WorldWide,DC=company,DC=net</l7:IssuerName>
<l7:IssuerName>CN=Access Management root CA,OU=Global Information Security,O=company WorldWide,DC=company,DC=net</l7:IssuerName>
<l7:Name>directory-company-com</l7:Name>
<l7:IssuerName>CN=PRD company 3DS1 Issuer Sub CA,OU=company Identity Check Gen 3,O=company,C=US</l7:IssuerName>
<l7:IssuerName>CN=PRD company Identity Check Root CA,OU=company Identity Check Gen 3,O=company,C=US</l7:IssuerName>
<l7:IssuerName>CN=PRD company Identity Check Root CA,OU=company Identity Check Gen 3,O=company,C=US</l7:IssuerName>
我相信它可以满足您的要求
信息
<l7:Name>
及其对应的所有<l7:IssuerName>