Programming/xml2019. 9. 29. 23:03

boolean() 으로 특정 element를 조회하면 될 듯?

 

[링크 : https://stackoverflow.com/questions/5689966/how-to-check-if-an-element-exists-in-the-xml-using-xpath]

 

+

2019.12.17

옛날 글이라 그런가 링크가 깨졌네

The boolean function converts its argument to a boolean as follows:

  • a number is true if and only if it is neither positive or negative zero nor NaN

  • a node-set is true if and only if it is non-empty

  • a string is true if and only if its length is non-zero

  • an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type

[링크 : https://stackoverflow.com/questions/5689966/how-to-check-if-an-element-exists-in-the-xml-using-xpath]

[링크 : http://www.w3.org/TR/xpath/#function-boolean] << 옛날 링크

 

Rules

The function computes the effective boolean value of a sequence, defined according to the following rules. See also Section 2.4.3 Effective Boolean Value XP31.

  • If $arg is the empty sequence, fn:boolean returns false.

  • If $arg is a sequence whose first item is a node, fn:boolean returns true.

  • If $arg is a singleton value of type xs:boolean or a derived from xs:boolean, fn:boolean returns $arg.

  • If $arg is a singleton value of type xs:string or a type derived from xs:string, xs:anyURI or a type derived from xs:anyURI, or xs:untypedAtomic, fn:boolean returns false if the operand value has zero length; otherwise it returns true.

  • If $arg is a singleton value of any numeric type or a type derived from a numeric type, fn:boolean returns false if the operand value is NaN or is numerically equal to zero; otherwise it returns true.

[링크 : https://www.w3.org/TR/xpath-functions-31/#func-boolean] << 새로운 링크?

 

'Programming > xml' 카테고리의 다른 글

XML DOM과 SAX  (0) 2019.12.01
xpath 복수개의 attribute 동시에 만족하는 항목 찾기  (0) 2019.09.14
xsd minOccurs, maxOccurs  (0) 2019.09.11
xpath count()  (0) 2019.09.09
xpath xsi  (0) 2019.08.12
Posted by 구차니