5 Matching Annotations
  1. Jan 2022
    1. although if you are using XMLDOM with JavaScript you can code something like var n1 = uXmlDoc.selectSingleNode("//bookstore/book[1]/title/@lang"); and n1.text will give you the value "eng"
      • TEST, value: "selected".text
    2. @KorayTugay, No, the first expression selects, doesn't "return" -- a set of nodes, and this set of nodes is not a string. A node is not a string -- a node is a node in a tree. An XML document is a tree of nodes. lang="eng" is just one of many textual representations of an attribute node that has a name "lang", doesn't belong to a namespace, and has a string value the string "eng" – Dimitre Novatchev Oct 22 '14 at
      • OK: select, not value
    1. //Parent[@id='1']/Children/child/@name will only output the name attribute of the 4 child nodes belonging to the Parent specified by its predicate [@id=1]. You'll then need to change the predicate to [@id=2] to get the set of child nodes for the next Parent. However, if you ignore the Parent node altogether and use: //child/@name you can select name attribute of all child nodes in one go.
      • OK, select ALL
    2. //Parent[@id='1']/Children/child/@name Your original child[@name] means an element child which has an attribute name. You want child/@name.
      • OK: /@name
    3. So far I have this XPath string: //Parent[@id='1']/Children/child[@name]
      • [@name] NO SELECCIONA, sino que FILTRA!
      • ver respuesta "382"