지정한 태그가 포함 된 XML 파일의 모든 섹션을 추출하려고합니다. 나는 웹을 검색하고 이것이 작동하는 것을 발견했다.xmllint를 사용하여 여러 결과 반환
xmllint --xpath "/all/string(//title)"
그러나 첫 번째 결과 만 반환합니다. 어떻게 모든 결과를 찾을 수 있습니까? 감사!
샘플 XML
<programme start="20170913125500 +0100" stop="20170913144500 +0100" channel="3b6963d34ba31ea21db5c3aee8e3b26f">
<title lang="eng">Yangtse Incident</title>
<sub-title lang="eng">(1957) Michael Anderson's drama, starring Richard Todd and William Hartnell, tells the true story of HMS Amethyst, a British frigate captured by Chinese communists during Mao's revolution. [AD,S]</sub-title>
</programme>
<programme start="20170913144500 +0100" stop="20170913165500 +0100" channel="3b6963d34ba31ea21db5c3aee8e3b26f">
<title lang="eng">The Comancheros</title>
<sub-title lang="eng">(1961) Western starring John Wayne and Stuart Whitman. A Texas Ranger is forced to team up with his prisoner while he's on a covert mission to take on a band of thieves and gunrunners. [S]</sub-title>
</programme>
<programme start="20170913165500 +0100" stop="20170913185500 +0100" channel="3b6963d34ba31ea21db5c3aee8e3b26f">
<title lang="eng">The Cockleshell Heroes</title>
<sub-title lang="eng">(1955) World War II drama. In a true-life tale of incredible bravery, ten marines try to break the blockade of Bordeaux. With José Ferrer, Trevor Howard, Victor Maddern and Anthony Newley. [S]</sub-title>
</programme>
<programme start="20170913185500 +0100" stop="20170913190500 +0100" channel="3b6963d34ba31ea21db5c3aee8e3b26f">
<title lang="eng">Dunkirk Interview Special</title>
<sub-title lang="eng">Stars Harry Styles, Mark Rylance, Jack Lowden, Fionn Whitehead and Tom Glynn-Carney talk about making director Christopher Nolan's intense Second World War dramatic thriller. [S]</sub-title>
</programme>
결과 나는 그것이 당신이 그것을 원하는 방식으로 단지 xmllint가 함께 작동하도록 얻을 수 없었다
Yangtse Incident
The Comancheros
The Cockleshell Heroes
Dunkirk Interview Special
는 당신이에 시도하는 샘플'XML'를 제공 할 수 사용할 수 있습니다? – Inian
샘플 XML을 원래 게시물에 추가 했으므로 코멘트로 추가 할 문자가 너무 많습니다. – user2679016