I have some xml files that will be read-only that I need to access on a random basis. They are xml files that contain user data I need to开发者_JAVA百科 merge with rtf documents.
There will probably be less than 10 files, but more than 5. As I loop through a list of documents I will have to select the correct xml file for the merge. I have a cross mapping file that links the document name to the xml file, so I know which one I need as I loop, but I need all of them available as I will be switching constantly between the xml files during the looping process.
Is there a simple solution for this rather than using some open source cache?
Thanks,
James
If you're reading the XML in as DOM, then you can put the Document
into your map instead of the file or file name.
EDIT: I just realized you said "mapping file", not "map" as in java.util.Map
. That would be your first step - processing your mapping file and generating that Map of names -> Documents.
java.util.Map
is your friend when you don't need a full-grown cache.
精彩评论