Easy. The Document Object needs the Type object added to it. From there, you can post the Document instead of the type. I ran into this problem on more than one occasion in the beginnning with xmlbeans. Document == Top Level object. Type == Document Payload (fragment). It's a little strange, but the document is structured that way for some reason. Cheers! --Joey
________________________________ From: riya [mailto:[email protected]] Sent: Thu 2/19/2009 11:37 AM To: [email protected] Subject: Re: <xml-fragment> Issues Hi, Thanks for replying. Here is my code based on Jar I generated from the xsd I mentioned: ADDRVALIDREQUESTDocument addDoc = ADDRVALIDREQUESTDocument.Factory.newInstance(); ADDRVALIDREQUESTType newObj = addDoc.addNewADDRVALIDREQUEST(); HEADERType newHeader= newObj.addNewHEADER(); newHeader.setAPPLICATIONID(appID); newHeader.setIBPASSWORD(pwd); newHeader.setLANGUAGECD((String)addressMap.get("strLang")); newObj.setDSID((String)addressMap.get("strID")); newObj.setCOUNTRY((String)addressMap.get("strCountry")); newObj.setADDRESS1((String)addressMap.get("address1")); newObj.setADDRESS2((String)addressMap.get("address2")); newObj.setADDRESS3((String)addressMap.get("address3")); newObj.setADDRESS4((String)addressMap.get("address4")); newObj.setCITY((String)addressMap.get("city")); newObj.setSTATE((String)addressMap.get("stateCode")); newObj.setCOUNTY((String)addressMap.get("strCounty")); newObj.setPOSTAL((String)addressMap.get("postalCode")); Now log.info("XML Request" + newObj.toString()); prints xml with <xml-fragment> as top node. Jacob Danner-2 wrote: > > Can you post a snippet of code? > -jacobd > > On Tue, Feb 17, 2009 at 5:19 PM, riya <[email protected]> wrote: >> >> Hi, >> >> I generated xsd using inst2xsd provided with xmlbeans. >> >> command: >> inst2xsd rd Address_Valid_Request.xml >> >> Following is the xsd I got: >> <?xml version="1.0" encoding="UTF-8"?> >> <xs:schema attributeFormDefault="unqualified" >> elementFormDefault="qualified" >> xmlns:xs="http://www.w3.org/2001/XMLSchema"> >> <xs:element name="ADDR_VALID_REQUEST" type="ADDR_VALID_REQUESTType"/> >> <xs:complexType name="HEADERType"> >> <xs:sequence> >> <xs:element type="xs:string" name="APPLICATION_ID"/> >> <xs:element type="xs:string" name="IBPASSWORD"/> >> <xs:element type="xs:string" name="LANGUAGE_CD"/> >> </xs:sequence> >> </xs:complexType> >> <xs:complexType name="ADDR_VALID_REQUESTType"> >> <xs:sequence> >> <xs:element type="HEADERType" name="HEADER"/> >> <xs:element type="xs:int" name="DSID"/> >> <xs:element type="xs:string" name="COUNTRY"/> >> <xs:element type="xs:string" name="ADDRESS1"/> >> <xs:element type="xs:string" name="ADDRESS2"/> >> <xs:element type="xs:string" name="ADDRESS3"/> >> <xs:element type="xs:string" name="ADDRESS4"/> >> <xs:element type="xs:string" name="CITY"/> >> <xs:element type="xs:string" name="STATE"/> >> <xs:element type="xs:string" name="COUNTY"/> >> <xs:element type="xs:int" name="POSTAL"/> >> </xs:sequence> >> </xs:complexType> >> </xs:schema> >> >> Now when I try to generate a xml based on jar generated from above xsd, >> I >> get following: >> >> <xml-fragment> >> <HEADER> >> <APPLICATION_ID>USER</APPLICATION_ID> >> <IBPASSWORD>xyz</IBPASSWORD> >> <LANGUAGE_CD>ENG</LANGUAGE_CD> >> </HEADER> >> <DSID>45454545</DSID> >> <COUNTRY>USA</COUNTRY> >> <ADDRESS1>s</ADDRESS1> >> <ADDRESS2>s</ADDRESS2> >> <ADDRESS3/> >> <ADDRESS4/> >> <CITY>s</CITY> >> <STATE>CA</STATE> >> <COUNTY/> >> <POSTAL>95014</POSTAL> >> </xml-fragment> >> >> The xml as you can see is mostly fine, except for the top node which is >> </xml-fragment>. >> >> Can some one please tell me how to correct this? >> >> Thanks in advance! >> riya >> -- >> View this message in context: >> http://www.nabble.com/%3Cxml-fragment%3E-Issues-tp22070264p22070264.html >> Sent from the Xml Beans - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > -- View this message in context: http://www.nabble.com/%3Cxml-fragment%3E-Issues-tp22070264p22106941.html Sent from the Xml Beans - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
<<winmail.dat>>
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

