XML/XPath: Difference between revisions
Content added Content deleted
Line 329: | Line 329: | ||
=={{header|CoffeeScript}}== |
=={{header|CoffeeScript}}== |
||
<div class='mw-collapsible'> |
<div class='mw-collapsible mw-collapsed'> |
||
<lang coffeescript> |
<lang coffeescript> |
||
doc = new DOMParser().parseFromString ' |
doc = new DOMParser().parseFromString ' |
||
Line 359: | Line 359: | ||
</inventory> |
</inventory> |
||
', 'text/xml' |
', 'text/xml' |
||
⚫ | |||
</div> |
|||
<nowiki>#</nowiki> "doc" is the xml as a Document object. Click expand to see parsing code ⇒ |
|||
<lang coffeescript> |
|||
# Retrieve the first "item" element |
# Retrieve the first "item" element |
||
doc.evaluate('//item', doc, {}, 7, {}).snapshotItem 0 |
doc.evaluate('//item', doc, {}, 7, {}).snapshotItem 0 |
||
Line 373: | Line 377: | ||
names.snapshotItem i |
names.snapshotItem i |
||
</lang> |
</lang> |
||
⚫ | |||
=={{header|ColdFusion}}== |
=={{header|ColdFusion}}== |