简体   繁体   中英

How to navigate / process atom entry links in Java?

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 Link s, 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM