Вопрос

I need to parse an atom document, where entry links point to other related entries. For example, an entry contains information about an electric meter, and a link points to another entry which contains readings made by that meter. Exact structure is:

https://collaborate.nist.gov/twiki-sggrid/pub/SmartGrid/GreenButtonSDK/ESPISchemaOverview.png

Can anyone give me a tip/starting point? I know basics about XML parsing in Java but navigating between entries using links just boggles my mind.

Это было полезно?

Решение

Using something like ROME to parse the feed would give you the feed as a collection of Entry objects. Each Entry has a collection of Links, including possible a link to itself (rel='self') to assign a permalink.

Navigating between entries may well involve iterating over all the entries to find the target, or you could build your own Map. This doesn't take care of the logic of making the appropriate connections due to the links but it does get you the data in terms of identifiers and links.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top