Ideally, what I would like to be able to do is:
cat xhtmlfile.xhtml |
getElementViaXPath --path=\'/html/head/title\' |
sed -e \'s%(^|
Yuzem's method can be improved by inversing the order of the <
and >
signs in the rdom
function and the variable assignments, so that:
rdom () { local IFS=\> ; read -d \< E C ;}
becomes:
rdom () { local IFS=\< ; read -d \> C E ;}
If the parsing is not done like this, the last tag in the XML file is never reached. This can be problematic if you intend to output another XML file at the end of the while
loop.