Monday, 15 March 2010

dynamic - generated XML through eclipse moxy doesnt contain Root element -


I am generating an XML via Eclipse Moxie and do not have the original element in XML, There are elements.

I am adding xsd, code and XML. I want the root element of the part of the generated XML.

I'm new to Eclipse Mox Please help solve this problem Thanks in advance.

& lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Xs: schema target = target = "example" xmlns: myns = "example" xmlns: xs = "http://www.w3.org/2001/XMLSchema" attributeFormat = Default "= Eligible" elementDefault = "Qualified" & gt; & Lt; Xs: element name = "root" type = "myns: root" /> & Lt; X: complex type name = "root" & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "HEADERDATA" type = "money: headcard" /> & Lt; Xs: element name = "product" type = "money: product" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; X: complex type name = "PRODUCTS" & gt; & Lt; XS: Sequence & gt; & Lt ;! - Here's the minimum / maximum tag for multiple nodes - & gt; & Lt; Xs: element name = "PRODUCT" type = "money: product" minOccurs = "0" maxOccurs = "unbounded" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; X: complex type name = "headcard" & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "source" type = "x: string" /> & Lt; Xs: element name = "target" type = "x: string" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; X: complex type name = "PRODUCT" & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "LASTUPDATED" type = "xs: string" /> & Lt; Xs: element name = "TYPE" type = "xs: string" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; / Xs: schema & gt;
   

  dynamic jacaccco context = dynamic jxcctextfactorCreativecontactFrom SSD ( Xsin inputstream, empty, empty, blank); DynamicTitType = context. HDDonientity ("root"); Dynamic Entity HeadDataInti = Reference. Nevidentity ("Header Data"); HeaderDataEntity.set ("source", "source"); HeaderDataEntity.set ("target", "target"); RootEntity.set ("HEADERDATA" .toLowerCase (), Header DataType); Dynamic Entity Product Entity = Reference. Innovation ("products"); ArrayList productList = new ArrayList (); Dynamic Entente Product Entity = Reference. NYSE ("PRODUCT"); ProductEntity.set ("Last Date", "Latched"); ProductEntity.set ("Type", "Type"); ProductList.add (productEntity); ProductsEntity.set ("PRODUCT" .toLowerCase (), productList); RootEntity.set ("PRODUCTS" .toLowerCase (), productsEntity); JAXBMarshaller marshaller = context.createMarshaller (); Marshaller.setProperty (Marshaler. JAXB_FORMATTED_OUTPUT, true); Marshaller.marshal (rootEntity, System.out);  

generated XML:

   

Mox's dynamic JACAB One Creates a model that is equivalent to a static that will be generated. The Route unit matches the nominated complex type. Like a stable model, you need to wrap it to give it the original component name of JAXBElement .


No comments:

Post a Comment