Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35368
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: XML |
| Date | 2016-08-16 17:04 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <novv42$12m6$1@gioia.aioe.org> (permalink) |
| References | (12 earlier) <00fae8a8-dc01-435f-9f33-e5a5055d93df@googlegroups.com> <nonsuv$425$1@gioia.aioe.org> <9c174795-1c98-46f0-bbac-179581cd39a2@googlegroups.com> <novr71$8j0$1@dont-email.me> <6eae6f69-b51d-4e1a-9308-fb68fc735db8@googlegroups.com> |
On 8/16/2016 4:20 PM, Eric Douglas wrote:
> Yeah I got a test program working using the XMLStreams. It looks
> like that could be optimal on my previously mentioned XML format only
> if I need to read and write a single DataRecord each time, creating a
> new DataFile instead of reconstructing the DataFile object that is
> the root of the file.
>
> Arne's example appears to be reconstructing the entire DataFile,
> storing the DataRecords in List form, and searching the entire List
> for records. I don't know how efficient that is with the stream().
> It sounds like a lot of overhead. I have another working option to
> store the DataRecords in a TreeMap and write that to the XML with an
> XMLAdapter so I can find an individual record with a key value and
> traverse the map to return a range of values. I normally only get a
> specific value or all values from a map but it looks like the
> higherEntry() method will handle that. The downside is I need
> multiple key maps set up linking all records if I need to return a
> range on different keys ie a list of Customers by Name, or by State,
> with the key field(s) hard coded while the stream() method appears
> more dynamic.
You need to separate issues.
1) Do you want to read/write all data from/to disk every time?
Yes => XML is fine, but no matter what you do then that is how XML
works (well - unless you do some very nasty things with
RandomAccessFIle)
No => do not use XML, use a database of some sort
2) Assuming XML what API do you want to read and write using?
You have an object model and you want everything in memory at
the same time and you want to write as little code as
possible => use JAXB
Other criteria could lead to other XML API's (DOM, StAX, SAX etc.).
3) Assuming you want an object model with everything in memory
(fastest if data will fit in memory) how do you want to
organize data in memory?
No special requirements => List<X> is a simple choice
Special requirements => pick something else
Note that you can convert data to a TreeMap using streams
and lambdas if you really need fast lookup by key.
Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
XML Eric Douglas <e.d.programmer@gmail.com> - 2016-07-29 13:25 -0700
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-07-29 19:46 -0400
Re: XML Roedy Green <inquiry@mindprod.com> - 2016-07-30 17:09 -0700
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-07-30 21:49 -0400
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-07-30 22:35 -0400
Re: XML Roedy Green <inquiry@mindprod.com> - 2016-07-31 21:39 -0700
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-01 05:19 -0700
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-01 08:51 -0400
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-05 06:07 -0700
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-05 10:17 -0700
Re: XML Stanimir Stamenkov <s7an10@netscape.net> - 2016-08-07 19:04 +0300
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-08 05:38 -0700
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-08 07:19 -0700
Re: XML Stanimir Stamenkov <s7an10@netscape.net> - 2016-08-09 23:57 +0300
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-10 05:37 -0700
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-10 10:39 -0700
Re: XML Stanimir Stamenkov <s7an10@netscape.net> - 2016-08-10 22:05 +0300
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-10 13:29 -0700
Re: XML Stanimir Stamenkov <s7an10@netscape.net> - 2016-08-11 02:18 +0300
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-11 05:15 -0700
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-11 05:50 -0700
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-11 12:24 -0700
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-13 15:38 -0400
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-16 11:49 -0700
Re: XML Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-16 15:57 -0400
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-16 13:20 -0700
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 17:04 -0400
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 21:37 -0400
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-17 05:22 -0700
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-17 05:21 -0700
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 16:13 -0400
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-16 13:22 -0700
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 16:53 -0400
Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-16 13:32 -0700
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 16:47 -0400
Re: XML Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-16 16:59 -0400
Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-01 08:46 -0400
csiph-web