XML : XML parsing without POJO

my XML looks like so:

  <services namespace="services.financial.commodity.oil">      <service id="buy">          This is some description          which contains line break          and any other free-text characters          may also contains characters from non-English language          like Chinese or Russian Cyrillic      </service>      <service id="sell">          This is some description          of yet another service      </service>      <service id="others">          you get the picture, right?      </service>  </services>    <services namespace="services.financial.commodity.coffee">      <service id="buy">          This is some description          which contains line break          and any other free-text characters          may also contains characters from non-English language          like Chinese or Russian Cyrillic      </service>      <service id="sell">          This is some description          of yet another service      </service>      <service id="others">          you get the picture, right?      </service>  </services>    <services namespace="services.financial.cash">      <service id="transfer-iban">          This is some description          which contains line break          and any other free-text characters          may also contains characters from non-English language          like Chinese or Russian Cyrillic      </service>      <service id="transfer-swift">          This is some description          of yet another service      </service>      <service id="others">          you get the picture, right?      </service>  </services>    

What I want to do is get the text inside elements, no need to convert to POJO. Right now, I only need to read once, save the text and use the text throughout the application lifecycle. so, the read only needs to occur once when app is starting up, or perhaps even better, during first request of that text. What's the best method to do this? DOM? SAX? Stax? JAXB?

No comments:

Post a Comment