开发者

Check for default value of attribute in XPath

开发者 https://www.devze.com 2022-12-26 08:08 出处:网络
i have XML schema: <xsd:complexType nam开发者_如何学JAVAe=\"contactsType\"> <xsd:sequence>

i have XML schema:

<xsd:complexType nam开发者_如何学JAVAe="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>

and i want to find all contacts which have @visible=true,

//contacts[@visible='true']

but this expression doesn' t return nodes without set @visible like this:

<contacts />

so i want to know if there is any function in XPath which returns also default values of attributes

Thanks

Jan


You need a schema-aware processor like Saxon-EE.

0

精彩评论

暂无评论...
验证码 换一张
取 消