È necessario utilizzare java xpath per restituire da id un elemento xml come stringa.Java xpath per restituire un intero elemento come stringa
proposta ...
<svg>
<g id="Background">
</g>
<g id="Outline">
<polygon fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points=" 119.813,57.875 119.188,57.87" />
</g>
<g id="Base_Colour" transform="matrix(0.25 0 0 0.25 0 0)">
<path fill="#ADB1AF" d="M112.25,208l-8,20.25l-0.5-1.75l0.75-0.5v-1.5l0.75-0.5v-1.5L106,222v-1.5l0.75-0.5v-1.5l0.75-0.5v-1.5"/>
<path fill="#625595" d="M112.25,208l5.25-14.5l30-30.25l2.25-1.5l41.5-20.5l49.75-9.5h4.25l49,3l48.75"/>
</g>
</svg>
il valore restituito necessità di essere ...
<g id="Outline">
<polygon fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points=" 119.813,57.875 119.188,57.87" />
</g>
Googled ampiamente e niente che abbiamo provato è stato in grado di restituire l'intero elemento. Xpath è desiderato perché voglio interrogare i tag g a qualsiasi livello tramite id.
Forse usare regex? http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags –
Tees - l'elaborazione di xml con regex è opera del diavolo. – jeremyjjbrown