Received: by 10.66.73.1 with SMTP id h1mr340961pav.0.1353392816522; Mon, 19 Nov 2012 22:26:56 -0800 (PST) Received: by 10.50.193.198 with SMTP id hq6mr3351449igc.10.1353392816464; Mon, 19 Nov 2012 22:26:56 -0800 (PST) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!newsfeed.news.ucla.edu!usenet.stanford.edu!kr7no821795pbb.0!news-out.google.com!s9ni313pbb.0!nntp.google.com!kt20no808744pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.programmer Date: Mon, 19 Nov 2012 22:26:56 -0800 (PST) In-Reply-To: <7ioqs.49297$c16.19500@newsfe10.iad> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=148.87.67.207; posting-account=BE4JzgoAAACLX-aQYawit5MkTNnptKNs NNTP-Posting-Host: 148.87.67.207 References: <7e1a4b59-0c97-40ca-af6e-22277f62b469@googlegroups.com> <7ioqs.49297$c16.19500@newsfe10.iad> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: How to convert Map to xml based on Schema. From: Mausam Injection-Date: Tue, 20 Nov 2012 06:26:56 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.lang.java.programmer:19825 On Monday, November 19, 2012 4:29:15 PM UTC+5:30, Arved Sandstrom wrote: > On 11/17/2012 02:52 AM, Mausam wrote: > > > Hello, > > > > > > I have a Map (it can be nested map, containing of maps) and a schema. Keys in Map represent element/attribute name of the schema and an entry in Map will be at same depth as an element defined in schema > > > > > > I need help in generating xml from the map as per the schema provided, without generating new files (as e.g Jaxb would require) Sample schema/map provided below > > > > > > e.g Map = [dept=[deptno="10",dname="ABC",loc="XYZ",emps=[[empno=1000,ename="Albert"],[empno=2000,ename="John"]]]] and schema will be > > > > > > e.g Schema > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -Many thanks > > > > > One question I have is, how and when is the generation supposed to occur? > > > > IOW, what is the environment? > > > > And where did the Map come from? If, as you replied to Arne, your schema > > can change, what process is responsible for creating new Maps that are > > relevant for updated schemas? There is an upstream process that does that. Such a map, after all, should be a Java > > analog of an XML instance for the target schema, You are correct. The map is Java analog of an XML Instance of the target schema. And I don't need a schema at this point but for two reasons: 1) Map does not tell me if an single Entry is either an attribute in XML or Simple element. 2) Map does not tell me the order of siblings (e.g sequence) you don't need the > > schema at that point to generate a valid XML. > > > > AHS