JAXB: Nillable elements present in mashalled output

Hi!
I'm using JAXB to generate java objects and marshal them into XML.
My schema contains various elements declared as nillable:
<xs:element name="element1" type="xs:string" nillable="true">
<xs:element name="element2" type="xs:string" nillable="true">
<xs:element name="element3" type="xs:string" nillable="true">
When I try to marshal the corresponding object using JAXB API I get the following XML:
<element1 ns1:nil="true" xmlns:ns1="http://www.w3.org/2001/XMLSchema-instance"/>
<element2 ns2:nil="true" xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance"/>
<element3>ABCD</element3>
Is there anyway I can get the output with onely element3 and suppress the null values of element1 and element2 from the output XML so that it only looks like:
<element3>ABCD</element3>
Any help will be really appreciated!
- Raj

Instaed nillable=true in schema please use minOccurs=0 JAXB will take care of it then. When you specify nillable=true it implements that the element is requred but it can be null so for the jaxb to not generate those field you need to change the schema to minOccurs = 0 and if it can appear more than once maxOccurs=unbounded.

Similar Messages

  • Error in web service creation : java.io.IOException: Non nillable element

    hi,
    i am new to web service, and i have to create web service.
    i have wsdl file and i have to develop web service using that file only.
    i am using eclipse 3.2 WTP, and apache tomcat server.
    After importing file, when i am cretaing web service, i am getting msg,
    "could not retrieve the WSDL file
    file:/D/Test/sample.wsdl Do u want to contiue to wait for this file? "
    after that when i am creating web service client, using wsdl file, which is in Webcontent/wsdl/SampleWS.wsdl, i am getting same msg.
    and when i am executing that i am getting error :
    - Exception:
    java.io.IOException: Non nillable element 'serialID' is null.
         at org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:215)
         at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1502)
         at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:978)
         at org.apache.axis.encoding.SerializationContext.outputMultiRefs(SerializationContext.java:1053)
         at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:145)
         at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
         at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
         at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
         at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
         at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
         at org.apache.axis.SOAPPart.getContentLength(SOAPPart.java:229)
         at org.apache.axis.Message.getContentLength(Message.java:510)
         at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:371)
         at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
         at org.apache.axis.client.Call.invoke(Call.java:2767)
         at org.apache.axis.client.Call.invoke(Call.java:2443)
         at org.apache.axis.client.Call.invoke(Call.java:2366)
         at org.apache.axis.client.Call.invoke(Call.java:1812)
         at com.innotrac.INOC_ATS_LOreal_inbound_servicesBindingStub.captureOrder(INOC_ATS_LOreal_inbound_servicesBindingStub.java:362)
         at com.innotrac.INOC_ATS_LOreal_inbound_servicesPortTypeProxy.captureOrder(INOC_ATS_LOreal_inbound_servicesPortTypeProxy.java:45)
         at org.apache.jsp.sampleINOC_005fATS_005fLOreal_005finbound_005fservicesPortTypeProxy.Result_jsp._jspService(Result_jsp.java:166)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
         at java.lang.Thread.run(Unknown Source)
    so, what is the error ?
    error is in wsdl file..?
    pls, help me...
    its urgent...

    Melanie_Green wrote:
    Thank him with duke stars :)The old dangling-dukes problems. While I really don't care about them, I think it's unfair to promise something and then not go along with the promise ...
    Give them to Mel ;-)

  • CommandButton actions not getting called when "disabled" element present

    MyObjectForm.jsp contains commandButtons for "add", "update" and "delete" that are enabled/disabled according to the value of the bound id field.
    MyObjectForm.jsp
    <html>
    <body>
    <f:view>
    <h:form id="create">
    <h:inputHidden id="id" value="#{myObjectBean.id}" />
    <h:panelGrid columns="3" border="0">
    Name: <h:inputText id="name"
    requiredMessage="*"
    value="#{myObjectBean.name}"
    required="true"/>
    <h:message for="name"/>
    // other fields
    <h:commandButton id="add"
    value="Add" disabled="#{myObjectBean.id!=0}"
    action="#{myObjectBean.add}"/>
    <h:commandButton id="update"
    value="Update" disabled="#{myObjectBean.id==0}"
    action="#{myObjectBean.update}"/>
    <h:commandButton id="delete"
    value="Delete" disabled="#{myObjectBean.id==0}"
    action="#{myObjectBean.delete}"/>
    <h:commandButton id="delete2"
    value="Delete (no disabled element)"
    action="#{myObjectBean.delete}"/>
    </h:form>
    </f:view>
    </body>
    </html>In its managed bean, MyObjectBean, if an id parameter is found in the request, the record is read from the database and the form is populated accordingly in an annotated @PostConstruct method:-
    MyObjectBean.java
    public class MyObjectBean {
    private int id;
    /** other properties removed for brevity **/
    public MyObjectBean() {
    LOG.debug("creating object!");
    @PostConstruct
    public void init() {
    String paramId = FacesUtils.getRequestParameter("id");
    if(paramId!=null && !paramId.equals("")){
    getById(Integer.parseInt(paramId));
    LOG.debug("init id:"+id);
    }else{
    public String delete(){
    LOG.debug("delete:"+id);
    MyObjectVO myObjectVO = new MyObjectVO();
    ModelUtils.copyProperties(this, myObjectVO);
    myObjectService.removeMyObjectVO(myObjectVO);
    return "";
    public String add(){
    LOG.debug("add");
    MyObjectVO myObjectVO = new MyObjectVO();
    ModelUtils.copyProperties(this, myObjectVO);
    myObjectService.insertMyObjectVO(myObjectVO);
    return "";
    public String update(){
    LOG.debug("update:"+id);
    MyObjectVO myObjectVO = new MyObjectVO();
    ModelUtils.copyProperties(this, myObjectVO);
    myObjectService.updateMyObjectVO(myObjectVO);
    return "";
    public void getById(int id){
    MyObjectVO myObjectVO= myObjectService.findMyObjectById(id);
    ModelUtils.copyProperties(myObjectVO, this);
    /** property accessors removed for brevity **/
    }When no parameter is passed, id is zero, MyObjectForm.jsp fields are empty with the "add" button enabled and the "update" and "delete" buttons disabled.
    Completing the form and clicking the "add" button calls the add() method in MyObjectBean.java which inserts a record in the database. A navigation rule takes us to ViewAllMyObjects.jsp to view a list of all objects. Selecting an item from the ViewAllMyObjects.jsp list, adds the selected id to the request as a paramter and a navigation rule returns us to MyObjectForm.jsp, populated as expected. The "add" button is now disabled and the "update" and "delete" buttons are enabled (id is no longer equal to zero).
    Action methods not getting called
    This is the problem I come to the forum with: the action methods of commandButtons "update" and "delete" are not getting called.
    I added an extra commandButton "delete2" to the form with no "disabled" element set and onclick its action method is called as expected:-
    commandButton "delete2" (no disabled element) - works
    <h:commandButton id="delete2"
    value="Delete (no disabled element)"
    action="#{myObjectBean.delete}"/>Why would "delete2" work but "delete", not?
    commandButton "delete" (disabled when id is zero) - doesn't work
    <h:commandButton id="delete"
    value="Delete" disabled="#{myObjectBean.id==0}"
    action="#{myObjectBean.delete}"/>The obvious difference is the "disabled" element present in one but not the other but neither render a disabled element in the generated html.
    Am I missing something in my understanding of the JSF lifecycle? I really want to understand why this doesn't work.
    Thanks in advance.
    Edited by: petecknight on Jan 2, 2009 1:18 AM

    Ah, I see (I think). Is the request-scoped MyObjectBean instantiated in the Update Models phase? If so then the id property will not be populated at the Apply Request Values phase which happens before this, making the commandButton's disabled attribute evaluate to true.
    Confusingly for me, during the Render Response phase, the id property is+ set, so the expression is false (not disabled) giving the impression that the "enabled" buttons would work.
    So, is this an flaw in my parameter passing and processing code or do you see a work around?

  • AC power present and standby outputs on????

    A new client has an Xserve RAID that we just updated to firmware rev 1.5. It had not been connected to the UPS via the UPS Inteface Port. A few days ago, the local power went out overnight. When my client returned in the morning, the Xserve RAID was not running. The following morning, my client started up the Xserve RAID, and observed a red power supply indicator on the front panel, and a blinking green light on the right-hand Power supply. According to the Xserver RAID User's Guide, this indicates, "AC power present and standby outputs on." What does this mean in (plain) English, and what do we need to do to fix it?

    The blinking green LED indicates that the unit has power, but that the unit isn't powered up (it is, however, available on the network so you can start it up via RAID admin). This is normal.
    The red LED, however, is a problem. This indicates that there's no power coming through the relevant PSU. Either the power feed to the PSU is dead, or the power supply unit itself has failed. Check the cable connection to the power supply and check whether it's live.

  • Product for presenting ABAP report output in Dashboard Presentation

    <u>Background</u>
    Monash University environment is SAP ERP  ECC6 - no BW. The University has undertaken considerable analysis of spend as part of developing a strategic approach to procurement.  The data used to undertake this analysis was extracted from SAP MM and FI using a developed ABAP report which collates, categorizes and consolidates all spend information from MM (for our Purchase Order based commitment and expenditure) and FI (for direct invoices and  Corporate Credit Card expenditure).  This information  is then currently exported to MS-Excel to produce a report containing graphs, pie charts etc.
    <u>Requirement</u>
    To present output from our Spend Analysis Report  in a more readable dashboard type presentation. This facility should allow easy manipulation (slice and dice) and drill down of the data..  Our requirement is to have something operating within a very short time-frame, say within a month or two. Although you might suggest Web Dynpro Business Graphic or SEM /BW (as the optimal solution) we understand the  set up time for either of these solutions is prohibitive.  Visual Composer has been suggested as another option but we have no in-house expertise to determine if this is a viable solution.   
    Some colleagues visited a  conference a couple of weeks ago and saw a demonstration of a product call XenoCube  http://www.inlogik.com/downloads/XenoCube_Brochure.pdf
    which was proposed as a quick way to present SAP 'raw' report output in a more readable form.  Other solutions in this space that have been suggested include:-
    Zycus - Actionable Spend Analysis – Zycus.com
    Emptoris Spend Analysis  - emptoris.com
    ONIQUA Enterprise Analytics– oniqua.com.au
    Ariba Buyer – ariba.com
    SAS Spend Analysis – sas.com
    Etesius – SpendGuardian  etesius.com
    Can anyone provide advice as to their experience of SAP solution, integrated partner products or any of the about products to satisfy a similar requirement to that which I have outlined?  The main selection criteria will include a product which is:
    a) quick & easy to implement,
    b)  presentation and manipulation of ABAP extracted data
    c) is scalable and
    d)  is reasonably priced.
    Grateful for any advice regarding a solution .
    Thank-you

    Hi,
      This development writes to mapped network drive in Unix. The concept will be similar.
    [http://wiki.sdn.sap.com/wiki/display/SCM/APOtoMappedNetworkDrive]
    cheers
    Aveek

  • Dynamic layout elements determination logic for output of Pro-Forma Invoice

    This is my requirement below. Please give the suggestion    
    Business requires output to be generated in name of the client, with client logo and scenario specific data elements. To do this in Standard SAP will require to define hundreds and hundreds of layouts. By making most of the client/scenario elements on the layout we can greatly reduce the number of required layouts and reduce implementatuion effort and lead-time.
         The goal is to define a generic table that will hold most of the dynamic layout elements for different document types and countries, including logo, sender address etc.
          For this we will create Z-versions of the output types BA00 ( Order Confirmation, ZPRI (Pro-Forma Invoice) and RD00 (ZD00 Invoice).The layout text blocks will be permanently fixed.The print Program user-exit should call the Z-table that holds the dynamic layout elements and retrieve these elements and merge them with the matching layout text block.
    Message was edited by: janardhan b

    Hi Janardhan,
       Even I have faced the similar situation.but what we have done is instead of calling the dynamic text elements..Why don't we call the text elements based on the required condition ,Then u dont have to maintain all the text elements required in the table.In the table we can only have the doumnent type,client name,logo name and address.
    In the print program if u r using script layout then call the required text elements (write_text) based on the client name and document type that is fetched from the Z-table,Otherwise if u r going for smartforms then with in the layout give the condition under the conditions node of the window or the text.

  • JAXB - nested elements of same name

    Hi
    I have a schema which can represent elements with identical nested names like this:
    <Simple>
    <Strong>
    <Simple/>
    </Strong>
    </Strong>
    The nesting is not recursive. i.e. the two 'Simple' elements are not actually identical. Unfortunately when I bind the schema to java using JAXB, the generated code won't compile and i get error due to name collision:
    "Nested type SimpleType hides an enclosing type"
    Can external binding fix this problem? I have already tried it but without success because there doesn't seem to be a way to bind the 'SimpleType' to another name. I can only change the interface name, but i need to change the type interface as well.
    I am tearing my hair about it and only solution i can see is that i use XSLT to transfrom the names before reading the XMl files in and writing them out. I can not change the original schema unfortunately.
    Any clues will be much appreciated, Martin.

    Hi everybody
    In the interest of anyone having similar problem, i have discovered that if i used a schema which used complex types explicitly (as generated by XmlSpy for me) the problem went away. This is probably because the nesting becomes irrelevant. My original schema contained only one element with all the types being anonymous and nested within that element.
    Regards, Martin.

  • JAXB unmarshalling elements with xs:type explicitly set

    I am working with XML content where the XSD defines an element as being of a complexType (say "ParentType") but the content explicitly sets the element's xs:type attribute to an extension of that complexType (say "ChildType").
    As far as I can tell the XML is valid, but JAXB issues the following when unmarshalling:
    DefaultValidationEventHandler: [ERROR]: Unexpected element {}:child1
    javax.xml.bind.UnmarshalException: Unexpected element {}:child1
    Where <child1> is added via the extension.
    Is this a problem with JAXB or my XSD?
    (XSD and XML enclosed below)
    XSD ------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:complexType name="ParentType">
    <xs:sequence>
    <xs:element name="parent1" type="xs:string"/>
    <xs:element name="parent2" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="ChildType">
    <xs:complexContent>
    <xs:extension base="ParentType">
    <xs:sequence>
    <xs:element name="child1" type="xs:string"/>
    </xs:sequence>
    </xs:extension>
    </xs:complexContent>
    </xs:complexType>
    <xs:element name="root">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="child" type="ParentType"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    XML -----------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="problem.xsd">
    <child xsi:type="ChildType">
    <parent1/>
    <parent2/>
    <child1/>
    </child>
    </root>

    JAXB doesn't handle OO schema design. I tried to do something similar where I defined a type called base and then defined that my document contained 1 or more base elements. Then I tried to unmarshall a document that contained elements that were of types extending from base. I ended up with the same issue.
    It seems that when the xjc compiler defines the classes it isn't smart enough to realize the element defined as parent could also contain a child element since child extends parent. Your XSD and XML are valid.
    I would think that JAXB should identify that because there is a type the extends the defined type, that an element of the sub-type might be subsituted i.e. check the actual type of the element in the XML before attempting to unmarshall it as the default type. It doesn't do that. I am not sure if this is as desinged, or a flaw in the implementation.

  • JAXB: Unexpected element

    Hi there,
    I am using JAXB.
    I have generated java classes by use of xjc. Let's say I have configured to generate the files in the java package "some.package". I use the classes in the following code snipped:
    JAXBContext jc = JAXBContext.newInstance(
         "some.package.simpson.bart:"+
         "some.package.simpson.lisa");
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    Data data= (Data) unmarshaller.unmarshal(new File("c:\\test.xml"));When I try to unmarshall an xml document I get the following error/exception:
    DefaultValidationEventHandler: [ERROR]: Unexpected element {simpson:bart}:Data
    Location: line xx of file:/c:/test.xml
    javax.xml.bind.UnmarshalException: Unexpected element {simpson:bart}:Data
    Can you help me?
    Niko
    I have two related DTDs:
    <xs:schema targetNamespace="simpson:bart" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="simpson:bart" elementFormDefault="qualified">
        <xs:element name="DataType" type="xs:string"/>
    </xs:schema>
    <xs:schema targetNamespace="simpson:lisa" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="simpson:lisa" elementFormDefault="qualified">
         <xs:element name="Data" type="xs:string"/>
    </xs:schema>My test.xml looks like this:
    <Data xmlns="simpson:lisa">
         <DataType xmlns="simpson:bart">someValue</DataType>
    <Data>

    Your schema tells me that the content of elements named "Data" should be of type "xs:string" and thus your instance document is not valid while it contains a nested element named "DataType".
    In order to parse your instance document, you need a schema that defines a complex type for the Data element that allows a nested DataType element... something like this:
    <xs:schema targetNamespace="simpson:lisa" xmlns:bart="simpson:bart" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="simpson:lisa" elementFormDefault="qualified">
      <xs:import namespace="simpson:bart" schemaLocation="bart.xsd"/>
      <xs:element name="Data">
        <xs:complexType>
          <xs:sequence>
            <xs:element ref="bart:DataType"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

  • Photoshop 7 Element keep stopping during output process why?

    Photoshop element 7 keep stopping while in output phase, it get up to 70% then it stop. The slideshow about 39min-40 sec, the file size is 4752x 3168 pixels for each pictures, I removed all other software that deals with dvd making and it still stops, What do I do now ?

    try to remove all devices connected to a USB port on your computer besides keyboard and mouse.
    - try to create a new admin account and work from there.
    hope this helps!
    -mike cutie

  • Elements 9 slide show output freezes

    I have Photoshop Elements 9 running on  system 7. It ran fine for a year but now started giving me 3 problems. (1) every time I open my catalog it begins "Updating' which ends in a freeze. (2) I make slide shows with this s/w often and every time I output to create a VCD it says it doesn't recognize the blank CD-R, why? (3) If I ask to download a wav file for my slide show, it starts and freezes about 30% into the download, why ? Help. Tks, Jerry

      Are you able to drag the wav file to the audio sound track line? Can you then save and output to wmv file or DVD?
     

  • JAXB duplicates database records in the output XML file

    I am trying to export a database through XML file using JAXB. But i get an XML file having my records with the @XMLElement name i gave it (SMS_Database) and also another one following it with <list/> as the RootElement name. I don't know where it's coming from. Here is the code:
    import java.io.*;
    import java.sql.*;
    import java.util.ArrayList;
    import javax.xml.bind.*;
    public class Parse2Xml {
      static final String XMLBASE = "./SMS_Database.xml";
      static ArrayList<Intermed> dataList = new ArrayList<Intermed>();
      static Connection con = null;
      static PreparedStatement ps = null;
      static ResultSet rs = null;
      public static void main(String[] args) throws JAXBException, IOException {
            con = getConnection();
            try{
              ps = con.prepareStatement("SELECT * FROM SMS_Log");
              rs = ps.executeQuery();
              while (rs.next()) {
                  dataList.add(getData(rs));
              rs.close();
              ps.close();
              con.close();
            } catch (SQLException ex) {
                ex.printStackTrace();
            DataStore SMS_Database = new DataStore();
            SMS_Database.setList(dataList);
            JAXBContext context = JAXBContext.newInstance(DataStore.class);
         Marshaller m = context.createMarshaller();
         m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
         Writer w = null;
         try {
              w = new FileWriter(XMLBASE);
              m.marshal(SMS_Database, w);
         } finally {
              try {
                   w.close();
              } catch (Exception e) {
        static Connection getConnection(){
            String sqlURL = "jdbc:mysql://localhost:3306/SMSDB";
            String username = "SUNNYBEN";
            String password = "drowssap";
            try {
                try {
                    Class.forName("com.mysql.jdbc.Driver").newInstance();
                } catch (InstantiationException ex) {
                    ex.printStackTrace();
                } catch (IllegalAccessException ex) {
                    ex.printStackTrace();
            } catch (ClassNotFoundException ex) {
                ex.printStackTrace();
            try {
                con = DriverManager.getConnection(sqlURL, username, password);
            } catch (SQLException ex) {
               ex.printStackTrace();
            return con;
        static Intermed getData(ResultSet rs) throws SQLException {
                Intermed mediator = new Intermed();
                mediator.setSms_id(rs.getString("sms_id"));
                mediator.setSender_id(rs.getString("sender_id"));
                mediator.setMessage(rs.getString("message"));
                mediator.setPhone_no(rs.getString("phone_no"));
                mediator.setDate_sent(rs.getString("date_sent"));
                mediator.setSchedule_date(rs.getString("schedule_date"));
                mediator.setUsername(rs.getString("username"));
                mediator.setResponse(rs.getString("response"));
                return mediator;
    import java.util.ArrayList;
    import javax.xml.bind.annotation.XmlElement;
    import javax.xml.bind.annotation.XmlRootElement;
    @XmlRootElement(namespace = "SMS_Database")
    class DataStore {
        @XmlElement(name = "SMS_Log")
        ArrayList<Intermed> dataList = new ArrayList<Intermed>();
        public ArrayList<Intermed> getList() {
            return dataList;
        public void setList(ArrayList<Intermed> dataList) {
            this.dataList = dataList;
    import javax.xml.bind.annotation.*;
    @XmlRootElement(name = "SMS_Log")
    @XmlType(propOrder = {"sms_id", "sender_id", "message", "phone_no", "date_sent", "schedule_date", "username", "response"})
    public class Intermed {
        private String sms_id;
        private String sender_id;
        private String message;
        private String phone_no;
        private String date_sent;
        private String schedule_date;
        private String username;
        private String response;
        public String getSms_id() {
            return sms_id;
        public void setSms_id(String sms_id) {
            this.sms_id = sms_id;
        public String getSender_id() {
            return sender_id;
        public void setSender_id(String sender_id) {
            this.sender_id = sender_id;
        public String getMessage() {
            return message;
        public void setMessage(String message) {
            this.message = message;
        public String getPhone_no() {
            return phone_no;
        public void setPhone_no(String phone_no) {
            this.phone_no = phone_no;
        public String getDate_sent() {
            return date_sent;
        public void setDate_sent(String date_sent) {
            this.date_sent = date_sent;
        public String getSchedule_date() {
            return schedule_date;
        public void setSchedule_date(String schedule_date) {
            this.schedule_date = schedule_date;
        public String getUsername() {
            return username;
        public void setUsername(String username) {
            this.username = username;
        public String getResponse() {
            return response;
        public void setResponse(String response) {
            this.response = response;
    }

    Dear All
    my requirement is to generate an xml file which looks similar to
    <?xml version="1.0" encoding="UTF-8"?>
    <?TestLine?>
    <test_mt>
    <field1>123</field1>
    <field2>234</field2>
    </test_mt>
    how to add <?TestLine?>  tag?
    Hi shabrasish and rajashekar
    i am new to java and xslt mapping can you guide me  or give me links which are similar to my requirement how to proceed with this kind of mapping
    thanks
    uday

  • Elements 8 -help with outputting slide shows to File?

    Can anyone help with saving a slide show in created in Elements to a file on my laptop? I know a WMV file is created, which option should I select to save in UK widescreen format 16:9?

    Bob, thanks for prompt answer.
    I am ultimately going to write the file to a DVD using Windows DVD Maker. Is the 16:9 format the DVD-PAL 720x576 option, or the High 1024x768 option?

  • JAXB - Unrecognised Element Name Exception

    I am not quite sure what is wrong here.
    I have got a dtd file that has the following specification:
    <!ELEMENT SomeElement (A,B?)>
    <!ELEMENT AnotherElement (C | B)>
    <!ELEMENT A(#PCDATA)>
    <!ELEMENT C(#PCDATA)>
    <!ELEMENT B (x,y,z)>
    <!ELEMENT x(#PCDATA)>
    <!ELEMENT y(#PCDATA)>
    <!ELEMENT z(#PCDATA)>
    And assume default binding schema.
    I wrote a XML file based on the dtd and a java app to access the data.
    The XML file
    <SomeElement>
    <A>Some Sentence</A>
    <B>
    <x>1</x>
    <y>2</y>
    <z>3</z>
    </B>
    </SomeElement>
    <AnotherElement>
    <C>123</C>
    </AnotherElement>
    During unmarshalling, it throws an UnrecognisedElementNameException: x
    It seems that it cannot recognised element x, y and z.
    I am pretty sure I have it defined in the dtd file so why is it complaining?
    Can anyone shed some light on this for me?
    Thanks

    Let me attached the files. Perhaps that will ilustrate the problem better.
    The dtd file
    <!ELEMENT test (precondition, step+)>
    <!ELEMENT precondition (description, include?)>
    <!ELEMENT step (input|include)>
    <!ELEMENT input (#PCDATA)>
    <!ELEMENT include (testcaseid, scenarioid, (from, to?)?)>
    <!ELEMENT description (#PCDATA)>
    <!ELEMENT testcaseid (#PCDATA)>
    <!ELEMENT scenarioid (#PCDATA)>
    <!ELEMENT from (#PCDATA)>
    <!ELEMENT to (#PCDATA)>
    The xml file
    <?xml version="1.0"?>
    <!DOCTYPE test SYSTEM "abc.dtd">
    <test>
    <precondition>
    <description>NONE</description>
    </precondition>
    <step>
    <include>
    <testcaseid>TID</testcaseid>
    <scenarioid>SID</scenarioid>
    <from>F</from>
    <to>T</to>
    </include>
    </step>
    </test>
    The application file
    import java.util.*;
    import java.io.*;
    import javax.xml.bind.*;
    import javax.xml.marshal.*;
    public class testABC {
    /** Creates new testABC */
    public testABC() {
    * @param args the command line arguments
    public static void main (String args[]) {
    try{
    File sFile = new File("abcfile.xml");
    FileInputStream sis = new FileInputStream(sFile);
    try{
    Test t = Test.unmarshal(sis);
    System.out.println("Completed");
    }finally{
    sis.close();
    }catch(Exception e){
    e.printStackTrace();
    Assume default schema binding
    The error:
    Cannot recognised the element testcaseid when try to unmarshall include element
    Thanks :-)

  • To know how to add the elements present in the particular column

    I have created the ALV report with two columns namely vbeln and ntgew.In that i want to add the values of ntgew column.plz provide the query to do that.
    Edited by: Philip Eller on Jun 18, 2008 9:12 AM

    hi vivek,
    You posted the question in wrong forum.
    There is a forum seperately for ABAP.
    Jeyakanthan

Maybe you are looking for