xml - 检查XPath中属性的默认值

标签 xml xpath

我有XML模式:

<xsd:complexType name="contactsType">
  <xsd:sequence>
    <xsd:element name="contact" type="contactType" minOccurs="0" maxOccurs="unbounded"/>
  </xsd:sequence>
  <xsd:attribute name="visible" type="xsd:boolean" default="true"/>
</xsd:complexType>


我想找到所有具有@ visible = true的联系人,

//contacts[@visible='true']


但是此表达式不会返回没有设置@visible的节点,如下所示:

<contacts />


所以我想知道XPath中是否有任何函数还返回属性的默认值

谢谢

一月

最佳答案

您需要像Saxon-EE这样的模式感知处理器。

关于xml - 检查XPath中属性的默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2625226/

相关文章:

无序列和多次出现的 XML 模式

Android Eclipse > 图形布局 : How to Set Default Layout = Nexus 7 or Not 2 for every XML layout I open to look same in IDE and Device

java - 如何删除soap header 和附加标签以检索所需的xml?

PHP/XPath : find text node that "starts with" a particular string?

php - 如何从 XML 标签中取出元素存储到 PHP 数组中?

python - 如何通过 Python 使用 Selenium 在 https ://www. costcobusinessdelivery.com 网站上获得点击

python - ElementNotInteractableException : Message: Element is not reachable by keyboard error sending text to input field using Selenium and Python

xml - 使用 XSL 进行解析

java - 字符串不能包含两个 '%'

xml - Android:使用 ISO-8859-1 编码的 SaxParser 问题