Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35251

Re: XML

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Stanimir Stamenkov <s7an10@netscape.net>
Newsgroups comp.lang.java.programmer
Subject Re: XML
Date Thu, 11 Aug 2016 02:18:03 +0300
Organization A noiseless patient Spider
Lines 51
Message-ID <nogcna$ibo$1@dont-email.me> (permalink)
References <34f5f605-db80-441c-9730-ceecf445c1a8@googlegroups.com> <t9gqpb19cdmnl2sgformolvii8pe4et688@4ax.com> <nnjlfe$spe$1@gioia.aioe.org> <kvjtpblrc7j5i3u62ee6japlm9481ajavq@4ax.com> <0176078c-ab98-4e66-ba3e-b14ee88b58e0@googlegroups.com> <nnngk6$603$1@gioia.aioe.org> <d7e3e460-1025-4670-b425-672f4196d9e2@googlegroups.com> <no7m5v$f24$1@dont-email.me> <487a50aa-8e4b-460a-9824-bd23c26d4c02@googlegroups.com> <nodg3g$elh$1@dont-email.me> <de36e9b4-44de-44ba-835d-80e9dc80fa90@googlegroups.com> <nofttr$u80$1@dont-email.me> <00fae8a8-dc01-435f-9f33-e5a5055d93df@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Wed, 10 Aug 2016 23:18:02 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="393ac5151a804bf167102ce109f7f379"; logging-data="18808"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+yWmELfS860OO2wauQOQvd"
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40
In-Reply-To <00fae8a8-dc01-435f-9f33-e5a5055d93df@googlegroups.com>
X-Face "@)%Vlap6d%OVYDS}B4YUWE@yUy+^!w/+.q.,c5kjI#+uG?kYP&r/pTjNWgo:g[A,O=AL3/ j&4Le2cau$<e=FPq~GbeZ6DW1Grey[VHn8?ktzvoQtzlg;]&rh8g]CD+_BC7d[gW{Yx&_X*4Q$h&nJ l@t(|4R4:T='&]U#ui+z9OC$.~gJjU93kh:Ojc$Cz0n#I9!~!9ay?E<UlW&5,IFX1*KtA>MYEFst$y y"m]M7tq\S(>[a$x0x8%S
Cancel-Lock sha1:aHZ5Wi0Reg7xmpTwPrfnjydxWfc=
Xref csiph.com comp.lang.java.programmer:35251

Show key headers only | View raw


Wed, 10 Aug 2016 13:29:36 -0700 (PDT), Eric Douglas:

> I did manage to create and test a couple XSD files to 
> marshall/unmarshall DataFiles with DataRecords in them which 
> appear to be working fine...

Not sure if it could be of any help to you (I'm often using it), but 
you could look at the generated schema also:

         JAXBContext jaxbContext = ...;
         
         jaxbContext.generateSchema(new SchemaOutputResolver() {
             @Override
             public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException {
                 Result result = new StreamResult(System.out);
                 result.setSystemId(new java.io.File(suggestedFileName).toURI().toString());
                 return result;
             }
         });

and possibly find out if you've got your bindings as you would expect.

> Now, I'm not sure the best API to manage records. As the only 
> method I found for storing multiple records with JAXB is a List of 
> the DataRecord instances, how do I pass it a key value, get one or 
> more of these record objects, update a field (or fields), and 
> write it back out? This RMFID.xsd maps to an RMFID Java class 
> which gives me instances specific to this file name where I can 
> call it's setFILENAME(), getFILENAME() methods, but I don't see an 
> obvious way to get specific instances of the RMFID from the list 
> aside from customizing these classes further to map out what keys 
> I need and mapping them through the DataFile class.
> I'm wondering if it makes sense to keep going down this path or 
> try something else, like JiBX which claims to do all this 
> marshall/unmarshall stuff plus add code to the Java classes to 
> make everything more efficient and support XPath queries to find 
> records?

I have no experience with JiBX.  For more sophisticated needs 
there's XmlAdapter also:

http://blog.bdoughan.com/2010/07/xmladapter-jaxbs-secret-weapon.html

I guess you could have something like then:

     @XmlJavaTypeAdapter(MyIdMapAdapter.class)
     Map<Integer, DataRecord> records;

-- 
Stanimir

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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