Creating XML from XSD, Only create The First Element

Hi,
I create a XML File from a xsd schema by this way:
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          factory.setNamespaceAware(true);
          factory.setValidating(true);
               factory.setAttribute(JAXP_SCHEMA_LANGUAGE,W3C_XML_SCHEMA);
               factory.setAttribute(JAXP_SCHEMA_SOURCE, new File(MY_SCHEMA));   
                DocumentBuilder documentBuilder =factory.newDocumentBuilder();
          documentBuilder.setErrorHandler(new SimpleDOMHandler());
          Document parse = documentBuilder.parse(new File(MY_XML));The first lines of the schema:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     targetNamespace="http://gencat.net/scsp/esquemes/peticion"
     elementFormDefault="qualified" attributeFormDefault="unqualified"
     id="Peticio" xmlns:p="http://gencat.net/scsp/esquemes/peticion">
     <xs:element name="Apellido1">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:maxLength value="40" />
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="Apellido2">
        .............................The problem is that the created document only have the first element "Apellido1". I dont know if it is a wrong xsd, or i'm using a bad way to do it.
Thanks a lot, and apologize for my english

Hi,
Is it possible to create and populate XML from an XSD
without knowing what the XSD elements are beforehand
(all the examples appear to know what the input XSD
will be, and therefore know what the set and get
methods should be called)? I think it is possible--you would have to recompile each time (unless you can dynamically recompile, which would be neat), but using the classes getMethod() function, you can list all the methods. You would then have to do some tricky logic to determine which of the getMethods you want (for example NOT getClass()), and you can basically call them in sequence. You also need to worry about handling lists & recursively call xxxType classes.
I'm experimenting with this, and it can get a little frustrating because there are a lot of odd cases to handle (for example, while setting the elements of a list, you need to actually get the list & add elements to it), but I think it's possible.
>
Can a user browse for an xsd to input, and the java
will dynamically create the get methods, and be able
to create instances and populate variables before
converting to XML?
What I'm puzzled about is where you'd get the data to populate the variables? Perhaps a database, or a bean? If you just want to make a test xml file, then it doesn't matter, but with real data, I think you'd still have to change how you actually get the variables you want to populate the xml file with, right? In other words, if your schema changed, the parameters you're passing to the set methods would change as well.
Maybe we'll see some more packages in the future to make this task easier.

Similar Messages

  • BindAggregation only returning the first element from a XML node

    hello everyone,
    investigating on this issue since fiew hours, I need your help (did not find a similar issue).
    here is an xml sample:
    <users>
         <user active="true">
              <reference/>
              <name>
                   <prefix/>
                   <first>first</first>
                   <middle/>
                   <last>last</last>
              </name>
              <location></location>
              <identifier>
                   <domain>mydomain</domain>
                   <login>flast</login>
              </identifier>
              <email>
                   <address>[email protected]</address>
                   <type>text</type>
              </email>
              <roles>
                   <role name="A"/>
                   <role name="B"/>
                   <role name="C"/>
                   <role name="D"/>
                   <role name="E"/>
                   <role name="F"/>
                   <role name="G"/>
              </roles>
              <groups>
                   <group name="A1"/>
                   <group name="A2"/>
              </groups>
         </user>
    </users>
    After having set the data in the table:
    oModel.setData(data);               
    oTable.setModel(oModel);
    oTable.bindRows("/user");
    I am able to bind correctly properties like first name & last name in my table... but I am not able to do a bindAggregate on roles !
    When I do this, only the first role is returned everytime for each row.
    With the example above,
    It displays, : first as firstname, last as lastname, & only role A instead of displaying all roles from A to G as above in the xml.
    Here is the bindAggregation:
    oTable.addColumn( new sap.ui.table.Column({
         label: new sap.ui.commons.Label({text: "Roles"}),
         template: new sap.ui.commons.ListBox({  
              "items": {     
                   path: "roles",
                   template: new sap.ui.core.ListItem({text: "{role/@name}",})
    Where is my misunderstanding/mistake ? or how should I deal for having all roles displayed correctly in the listbox of this column ?
    No proposal ?
    Files (javascript & data) for reproducing this behavior are attached below,
    Really thank's in advance to each of you for your coming help,
    Best Regards

    hello everyone,
    investigating on this issue since fiew hours, I need your help (did not find a similar issue).
    here is an xml sample:
    <users>
         <user active="true">
              <reference/>
              <name>
                   <prefix/>
                   <first>first</first>
                   <middle/>
                   <last>last</last>
              </name>
              <location></location>
              <identifier>
                   <domain>mydomain</domain>
                   <login>flast</login>
              </identifier>
              <email>
                   <address>[email protected]</address>
                   <type>text</type>
              </email>
              <roles>
                   <role name="A"/>
                   <role name="B"/>
                   <role name="C"/>
                   <role name="D"/>
                   <role name="E"/>
                   <role name="F"/>
                   <role name="G"/>
              </roles>
              <groups>
                   <group name="A1"/>
                   <group name="A2"/>
              </groups>
         </user>
    </users>
    After having set the data in the table:
    oModel.setData(data);               
    oTable.setModel(oModel);
    oTable.bindRows("/user");
    I am able to bind correctly properties like first name & last name in my table... but I am not able to do a bindAggregate on roles !
    When I do this, only the first role is returned everytime for each row.
    With the example above,
    It displays, : first as firstname, last as lastname, & only role A instead of displaying all roles from A to G as above in the xml.
    Here is the bindAggregation:
    oTable.addColumn( new sap.ui.table.Column({
         label: new sap.ui.commons.Label({text: "Roles"}),
         template: new sap.ui.commons.ListBox({  
              "items": {     
                   path: "roles",
                   template: new sap.ui.core.ListItem({text: "{role/@name}",})
    Where is my misunderstanding/mistake ? or how should I deal for having all roles displayed correctly in the listbox of this column ?
    No proposal ?
    Files (javascript & data) for reproducing this behavior are attached below,
    Really thank's in advance to each of you for your coming help,
    Best Regards

  • Creating PDFs using Adobe Acrobat 9 Pro and can only see the first 10 pages in PDF even when the page numbers on bottom state 10 of 13 (or any number greater than 10).

    PDFs create great, unless they should be over 10 pages and then it appears the data was converted to PDF by viewing the page numbers at the bottom of the PDF but you can only view the first 10 pages in the pdf file.

    Hi stephaniec0103,
    Could you please let me know what exact dot version of Acrobat 9 and OS you are using.
    Have you tried repairing Acrobat from the Help menu?
    Acrobat 9 is an older version and incompatible with new OS versions, so I would suggest you to try using Acrobat XI (latest version) and check for the same.
    You may download a 30-day free trial version of Acrobat from the below mentioned link:
    Download Adobe Acrobat free trial | Acrobat XI Professional
    Let me know how it goes.
    Regards,
    Anubha

  • Is there a way to create a fade only for the first loop?

    I have a loop (Modern Guitar Rock 04), which I've extended out so it repeats four times. I select the Fade Tool and X-Fade for drag. I then drag just in front of the loop and onto it, which creates a fade. However, this also creates fades at the beginning of the repeating loops. Is there a way to create a fade only for the first loop?

    The loop function always repeats the same region so of course the fade is also copied. So option+drag the original region to make a (non clone) copy, fade the first region and loop the second one (which you just copied).

  • When exporting 708 captions from Premiere Pro CC I only see the first 708 caption. Help?

    Hi, our company just switched from Final Cut Pro 7 to Premiere Pro CC and we went from macs to PCs. I use the CaptionMaker program to create .mcc 608/708 caption files that I import into premiere, and I'm having a problem with the 708 captions. I embed the 708 captions in an mxf op1a file (I'm attaching a screen grab of my sequence and export settings) that I then copy to an XDCam disc, but when I play the disc back and check captions through our QC monitor I only see the first 708 caption and then the rest never appear. The 608 captions are there, but just the first 708 shows up. I've also had this problem when I print to video and when I create the captions in premiere instead of importing a caption file from CaptionMaker. And I was able to see 708 captions on a source that was captioned out of house so I know my QC monitor is working properly. Anyone have any ideas or suggestions for me to try? Thanks for your time.

    I am not sure what product the dubbing house is using to master the tape.  I will try to find out.  As far as the file creation, I am using MacCaption to create the 608 & 708 .mcc file.  Bringing this in to Premiere and exporting out the MXF file.  I have contacted Telestream, the owner of MacCaption, there head of support says that other customers have had the same problem exporting out of Premiere.  They have tested caption files and the files are fine that this is a problem in Premiere.

  • Report from SQL Query -Excel format only show the first page

    Hi,
    I have some Reports from SQL Query. In the display options, I choose Excel as default format. The Excel documents only show the first page. If I choose HTML as default format, it shows every rows.
    Please advise on how to have a complete Excel document as HTML format does.
    Thanks a lot.
    Lina Han

    I beleive when you export Oracle reports to Excel it is the Data that is transferred along with Column Names.
    You cannot export the variables defined on the report.
    Hence you will not be able to export the Footer to excel. (Still looking into it will let you know if i find anything interesting)
    Regards,
    Bhushan Salgar

  • I am trying to copy and paste a story from a blog.  I can only view the first page on the Pages app.  How do I see the rest of the pages?

    I am trying to copy and paste a story from a blog.  I can only view the first page on the Pages app.  How do I see the rest of the pages?

    Thank you.  That helped in the first step.  I was able to copy text onto multiple pages.
    Now I can't get the pictures to copy.  How do I get my pictures to copy?
    Also once the blog page is on pages, how do i make changes to it?
    This my story and the page I am trying to copy.
    http://www.city-data.com/forum/tennessee/359683-going-off-grid-east-tennessee.ht ml
    Thanks so much
    Lisa(writing) and Mike trying to get it right.

  • PDF sent from SAP 4.6C only shows the first 10 pages

    Since a few weeks a spoolrequest that is produced by a job contains more than 10 pages. This report is automatically converted to pdf and mailed to an external recipient, but the pdf only contains the first 10 pages.
    When I look into this spool request in SAP, I can see all pages.
    Does anyone know how to include all pages in the PDF?
    thanks in advance,
    Maarten Ettema

    hi,
    by default only the first 10 pages of spool are being saved (or converted to pdf in another way). you can change this settings. here i'll show you the way :
    - goto SP02 or SP01, input suitable parameters
    - select your spool request
    - press F6 to display the content
    - navigate to : goto >> display request >> setting
    - from popup window, on "Display Area" section, you can set the page settings for your spool. the default value is only from page 1 to 10, you can set it as you need (in example from page 1 to 100), but beware, setting it too high in some case will cause memory issue.
    hope it helps you.
    rgds
    alfonsus guritno

  • Applications are mentioned free, but when we start downloading one dollar is charged in my credit card, but only for the first time when i switch on and use it for the first time one dollar is charged. and from next application it is free. why?

    Applications are mentioned free, but when we start downloading one dollar is charged in my credit card, but only for the first time when i switch on and use it for the first time one dollar is charged. and from next application it is free. why?

    Kindly inform any email id or toll free number to contact apple for your below answer, Mr.King_Penguin
    About receiving my credit card being debited for Free App Store Application downloads,
    It should be within a few days, but it might vary a bit by bank/provider :
    I am in India, if the bank don't refunds , what to do?
    Rajagopal.pngr :-  It is only a holding charge, it is not a permanent charge. If it isn't refunded within a few days or so (and it quite possibly won't be over a weekend) then you can query the charge with Apple.

  • I'm trying to print out a credit card statement from my iPad, it only prints the first page not 4pages, please help

    I'm trying to print out a credit card statement from my iPad, it only prints the first page not the 4 pages, please help

    I read your first post when I was posing a separate question on the Mac Pro board.  I now see that we may be talking about printing from an iPad with Airprint instead!!!!!  I very much suspect the print command and settings are different for Airprint but I have never used it to be able to offer concrete advice.  I think the setting choices could be different even with Airprint on the laptop and further that you may not even be using Safari but some special app???
    I've not heard or seen the term "frame" in the context of printing before except perhaps in the context of a screen shot.  Is the credit card statement a "pop-up" of some kind rather than a webpage or pdf?

  • My printer will only print the first page of a doc from "Pages" in good quality.

    I've tried reloading drivers etc. Nothing works. My printer prints everything just fine EXCEPT for when I try to print a doc from the PAGES app. Then it only prints the first page (technically the last one prints first) and then all subsequnt pages are very poor quality.
    Lexmark tech support says the problem is not with their drivers.
    Any thoughts as to what the problem might be ??
    THANKS for any help !

    Then use the latest solution!
    Which doesn't need specifying either.
    Peter

  • HT3204 i bought and downloaded a song from itunes store and it said it was complete but will only play the first 14 seconds of the song then it cuts off. what should i do to retrieve the rest of the song?

    I bought a song from the itunes store and downloaded it and it said download was complete but when i go to play the song it will only play the first 14seconds of it then it cuts off. what should I do to retrieve the rest of the song?

    If you live in a Region that allows re-downloading Music...
    Delete the Song(s) and re-download...
    See Here  >  Download Past Purchases
    http://support.apple.com/kb/HT2519
    If not... Contact iTunes Customer Service
    Apple  Support  iTunes Store  Contact Us

  • Why can I only hear the first 1:29 seconds of songs I have purchased? from iTunes?

    Why can I only hear the first 1:29 seconds of songs I have purchased? from iTunes?

    Could be corrupt downloads...
    johnfwhite wrote:
    Why can I only hear the first 1:29 seconds of songs I have purchased? from iTunes?
    If you live in a Region that allows re-downloading Music...
    Delete the Song(s) and re-download...
    See Here  >  Download Past Purchases
    http://support.apple.com/kb/HT2519
    If not... Contact iTunes Customer Service
    Apple  Support  iTunes Store  Contact Us

  • System only loading the first column from csv

    Trying to load data from Excel saved as csv, but the preview and PSA shows data loaded only for the first column from the csv file. All other columns are not loaded from the csv. Changed the lengths of the fields from the datasource to match the ones in the csv to 8, but it only seems to load the first column. What could be the cause?

    Hi
    Check the file format once and general tab in Data source(make sour you selected comma separated file and symbol)
    check below link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/01ed2fe3811a77e10000000a422035/frameset.htm
    Regards,
    Venkatesh

  • I uploaded 3 audiobooks from iTunes to my iPhone 5 with the latest ios7 on it. Each of them only plays the first 15 mins of the playback and then silence, the bar shows the book is still playing but no sound, any ideas? Thanks

    I uploaded 3 audiobooks from iTunes to my iPhone 5 with the latest ios7 on it. Each of them only plays the first 15 mins of the playback and then silence, the bar shows the book is still playing but no sound, any ideas? Thanks

    What happens when playing the same books in iTunes. Is there sound after 15 min?
    If also silent in iTunes, check the info tab where you can see the item is an audiobook, etc. Check the volume bar, this normally is on the zero point.
    When an audio book is really low in audio, I tend to move this to the plus side (+1=max), but for some strange reason this bar was at -1 in some books I had and they also seemed to play in absolute silence.

Maybe you are looking for

  • 12/03/2013 - Beta - AIR 4.0.1240 Runtime and SDK

    Adobe AIR Beta Channel Update This beta release provides access to the latest AIR runtime and SDK (with compiler) for Windows, Mac OS, iOS and Android. With this release, we are introducing a new numbering scheme for our product versions. Adopting th

  • How to configure Oracle VM(Xen) bridge networking?

    Hi, I have installed Oracle VM (Xen) and within it 2 VM Templates: One for Oracle 11g DB and the other with Siebel App. RHEL5.3 x86 The problem is that I cannot get the xen network bridge to work properly and get no ping to the gateway or any other i

  • Replace multiple space characters with a single space

    Hi, Oracle 11g R2. Looking for a way to replace multiple space characters in a row with a single space. For example, the text "abc abc" should look like "abc abc". I tried toying with replace, but it only works for the case of 2 spaces. Need a soluti

  • Error in searching field value by pressing enter

    Hi all, I am able to get a pop up with the values of the field and select in that pop up to the main screen on pressing enter. But i get all the values of the column present in the table and not the one which i want to search. Also the main screen gi

  • Slow response when using Xcelsius web service connection witn input values

    We've been very successful in using the Xcelsius Web Service Connection. We've recently moved forward toward using input values when calling a web service and having issues with response time. Without input values, it takes 3 - 6 seconds to retrieve