問題タブ [node-set]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
r - R: Extract data from specific XML nodeset
I am trying to extract some values from an XML file. This XML contains multiple 'spreekbeurten' (speaches) from members of the parliament. Each 'spreekbeurt' has a speaker (member of parliament) and 'partij' (party of the member). It could be that speaker is not party member; so than there is no party. This specific XML files has 105 'spreekbeurten'. So my objective is to retrieve the following values for each 'spreekbeurt':
See further below for snippet of XML file
Per 'spreekbeurt' I would like to extract the values. The reason for extracting the values per spreekbeurt one by one, is for the reason that I would like to add NA for 'politiek' in case it is missing.
R-Code
- xml_find_first return the first one in the nodeset even if I apply on spreekbeurt[2]
- xml_find_all returns all of the nodeset.
How could I retrieve the values for only the second nodeset as coded in R above?
Other info:
Result for spreekbeurt:
XML file snippet: