Is there a way to create a schema for this simple XML?

Hi! A simple question. Suppose we have a XML that looks like that (simplified)
<documents>
  <total>2</total>
  <doc_1>
    <name>My document</name>
    <code>1234</code>
  </doc_1>
  <doc_2>
    <name>Another document</name>
    <code>5678</code>
  </doc_2>
</documents>In this simple example, if the tag <total> had a numer of three, there would be a <doc_3> tag.
Is it posible to create a XSD to this XML? And is it posible for JAXB to process that XSD?
Thank you in advance

There are some tools around to generate XML Schemas from instance documents, but I don't know if they are too smart. For example, XMLSPY created the following Schema from your sample:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
     <xs:element name="code">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:enumeration value="1234"/>
                    <xs:enumeration value="5678"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="doc_1">
          <xs:complexType>
               <xs:sequence>
                    <xs:element ref="name"/>
                    <xs:element ref="code"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="doc_2">
          <xs:complexType>
               <xs:sequence>
                    <xs:element ref="name"/>
                    <xs:element ref="code"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="documents">
          <xs:complexType>
               <xs:sequence>
                    <xs:element ref="total"/>
                    <xs:element ref="doc_1"/>
                    <xs:element ref="doc_2"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="name">
          <xs:simpleType>
               <xs:restriction base="xs:string">
                    <xs:enumeration value="Another document"/>
                    <xs:enumeration value="My document"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
     <xs:element name="total">
          <xs:simpleType>
               <xs:restriction base="xs:byte">
                    <xs:enumeration value="2"/>
               </xs:restriction>
          </xs:simpleType>
     </xs:element>
</xs:schema>XMLSPY has done its best but this Schema could certainly be cleaned up and made more efficient. If your instance documents aren't going to be too complex, it's probably best to have a tool like XMLSPY start you off, then you can go in by hand.
But, once you have the Schema in hand, you're ready to get started with JAXB.

Similar Messages

  • Is there a way to create a thumbnail for QuickTime videos on a PC?  All the videos currently have the same QuickTime logo as there thumbnail.

    Is there a way to create a thumbnail for QuickTime videos on a PC?  (Windows XP)  All the the videos currently have the same QuickTime logo as their thumbnail.

    Abdur,
    In the sheet :: table :: cell that is going to receive the data, type an equals sign, then click on the cell that the data will come from and press Return.
    This will require that you navigate to the origin cell by choosing the proper sheet.
    Jerry

  • Is there any way to create an installer for Mac OS and Linux OS once a stand alone application is created?

    Is there any way to create an installer for Mac OS and Linux OS once a stand alone application is created?  I have created an executable application that I want to distribute to Mac and Linux users (different applications were created in the respective OS).  I was wondering if there is any way to create an installer?  I think there probably isn't...  If the user were to simply download the Labview Run-time Engine from ni.com would they be able to run the application or is it more complicated than that?
    Thanks so much for your time.

    I think Shane tried to say, that it is on the Mac OS X installation DVD, NOT the LabVIEW for Mac OS X installation medium. And that could very well have changed in recent Mac OS X versions as well. They used to have Xcode on it too, but that seems gone as well.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Is there a way to create a password for Firefox so Firefox is denied access to the internet without this password?

    Is there a way to create a password for Firefox to deny Firefox access to the internet?

    There is the Profile Password extension, but it is easily bypassed by using the Firefox SafeMode.
    http://nic-nac-project.de/~kaosmos/profilepassword-en.html#PPFF
    Another thing you can do is to set your Homepage to a website that you have a password logon saved for and use the Master Password feature. It won't completely stop someone else from using the internet but it will slow them down or make it appear they need a password for access.
    https://support.mozilla.com/en-US/kb/Protecting+stored+passwords+using+a+master+password

  • Is there any way to create a reminder for "today"?

    Is there any way to create a reminder for "today" in the new Reminders app? I used to be able to pull up the "today" list and add things that would go to my default list but automatically show up for today but now it looks as though that option is gone.  Additionally, any way to get dates/times to show up with reminders in the Notification Center?

    Hey chewie314,
    Thanks for the question. From the information you provided, it sounds like you might be looking for the "Scheduled" view. This view will show all of your reminders that are scheduled in a list. To access the schedule view, click the icon:
    Reminders - iPhone User Guide
    http://help.apple.com/iphone/7/#/iph88463e18
    Thanks,
    Matt M.

  • Is there any way to create a book for ibookstore in windows pc?

    Is there any way to create a book for ibookstore in windows pc?

    Yes, you create in the .epub format with whatever Windows app you want to use for that and then use an Aggregator like SmashWords to upload the book to the iBookstore.  Direct upload is only possible from OS X.

  • I work for the County and we purchased a copy of Adobe Photoshop CS2 long ago.  The person that did the order is no longer here.  All I have is the CD Disk that is new but i did not know the key code is.  Is there a way to get the keycode for this?

    I work for the County and we purchased a copy of Adobe Photoshop CS2 long ago.  The person that did the order is no longer here.  All I have is the CD Disk that is new but i did not know the key code is.  Is there a way to get the keycode for this?

    It would not work anyway. The activation servers have been retired and Adobe has provided a new CS2 download along with a new serial number for CS2 owners.
    Download Acrobat 7 and CS2 products
    Gene

  • I have  license for Adobe Design Std CS6 6.0 MLP .Is there any way to get the installer for this?

    I have  license for Adobe Design Std CS6 6.0 MLP .Is there any way to get the installer for this?

    Download CS6 products
    Mylenium

  • Is there a way to create a shortcut for the 'copy unique selector' tool in Web Developer?

    Currently the only way to copy a unique selector is to either double click in the inspector tool, or access the popup bubble and click 'copy unique selector'. Is there a way to create a keyboard shortcut for that process?

    Hi Dubes,
    Thank you for your question. Maybe you can try the [https://addons.mozilla.org/en-US/firefox/addon/customizable-shortcuts/?src=search Customize shortcuts add on]

  • Is there a way to create a preset for drop shadows?

    I'm setting up a template for a new brochure that will need drop shadows on every product that is being placed. Is there a way to save a preset for a drop shadow so I need not have to recreate the shadow every time? Also this is being distributed to many people to work on and effects presets would be hugely beneficial-just not sure if that is possible? Although it is Indesign, and they are usually on the up and up for this kind of thing.
    Thanks!
    FF

    The Eyedropper Tool is a quick way of applying the same drop shadow to many objects
    But as peter says object styles is a much simplier way.

  • Is there a way to create separate PDFs for each layer in Indesign?

    I have a multi-layered InDesign file, and I would like to generate a PDF for each of the layers. I was able to create a LAYERED PDF file (one PDF page with layers), which is great, but I also need a multi-page PDF...one PDF page per layer.
    Is there a way to do this? Do I need a script? Or is there a way to extract the separate layers from the layered PDF?
    Any help would be much appreciated. Thank you.

    Check this script:
    http://indesignsecrets.com/page-exporter-utility-peu-5-script-updated-for-cs3.php
    Hope that helps.
    Marijan (tomaxxi)
    http://tomaxxi.com

  • Is there a way to create a button for the tool bar that will View a page in "No Style'?

    I guess what I'm asking is...Is there a way to make a customized button for the toolbar that will allow me to change the view on a webpage to 'No Style' as listed under the view menu. If so, How can I do this?

    Try this add-on: <br />
    https://addons.mozilla.org/en-US/firefox/addon/custom-buttons/

  • Is there a way to create new Barcodes for Adobe Printforms

    Hi All,
    As far I know there is currently no way to add new barcodes to the Adobe designer..SAP Note #430887 says the same..
    Can I get any exact SAP note which states that adding new barcodes is not currently possible..
    If there is any way we can do this please let me know..
    Appreciate your time..
    Thanks,
    Sethu

    Hi,
    I hope this will help you.
    MW6 Barcode DLL for SAP R/3 is compatible with SAPsprint and SAPlpd, it allows you to print 1D barcodes.
    Example:
    Code39, Code128, EAN13, EAN8, UPCA and UPCE,
    PDF417, DataMatrix, Aztec and QRCode virtually on any windows printer from SAP R/3 system.
    TBarCode/SAPwin is a Barcode DLL for SAP R/3, SAP ECC and mySAP ERP. This barcode DLL extends SAPsprint, SAPlpd and SAPWIN DLL with barcode printing features.
    TBarCode/SAPwin prints ALL common linear and 2D bar codes on all Windows printers.
    Costly barcode equipment like barcode cartridges, barcode fonts or barcode printers are avoided! TBarCode/SAPwin works with SAPscript, ABAP and SmartForms. All SAP-forms are supported without modification.
    Thanks

  • Is there a way to create a calendar for keynote that automatically updates to current month?

    I use keynote presentations for teaching foreign languages and wanted a calendar that updates automatically to current month everytime I present it rather than making it manually each month.  I'm wondering if it can be done using the keynote date/time functions?  Thank you.

    Creating a whole interactive calendar for a month in a table could be done I suppose, but it's an awful lot of work for something that might be solved more easily in other ways.
    IF you have a constant internet connection when you're teaching, create a Hyperlink on a blank Keynote slide to a web calendar, such as Google Calendar (or perhaps a school district calendar?) and enable it in the slide with Inspector, Hyperlink (blue circle with arrow icon 2nd from the right).
    If you don't have web access on your teaching computer while you're teaching, I'd still probably capture a screenshot of the each monthly calendar and use that, updating to the current slide once a month. If you're usually too busy to remember to capture a new calendar on the first of the month, create a whole year of screen captured calendars at one time, add them to separate Keynote slides, and then just 'Skip Slide' all the months you aren't using. Not cool and interactive, but it would solve the problem. You might want to rename the screen captures to the month name before adding them as slides for ease of locating them later.
    Since you're teaching foreign languages, in my sample below, I changed my default Google Calendar language to German. (Unfortunately, I left US Holidays enabled, so they aren't 'auf Deutsch', but you get the idea.) Understand that when you switch language in Google Calendar (or other Google app), it will switch ALL of your Google screens to that language, so be sure you remember which 'buttons' to push to change it back to English later!
    Bring up your calendar onscreen in your browser and use Command+Shift+3 to capture the whole screen or Command+Shift+4 to capture just a portion of the screen. Once saved, insert the saved calendar into a Keynote slide.
    Now, if that's more than you need, if you just want to display the date information in English as current weekday name, monthname, date number, and year, that's pretty simple.
    Use the now() or today() function, you can create a simple table and add the following functions in separate cells, beginning each cell entry with the = sign (so the table 'knows' it's a function, and not just text:
    =DAYNAME(NOW())
    =MONTHNAME(MONTH(NOW()))
    =DAY(NOW())
    =YEAR(NOW())
    And it displays like this on a slide:
    Hope that helps!
    Message was edited by: kostby

  • Is There A Way To Create Custom Presets For Sharing/Exporting?

    First-time iMovie users, long-time Mac enthusiast.
    VERY impressed with how easy this wonderful application is to learn, but the inability to save custom presets exporting to Quicktime is puzzling.
    iMovie6 does remember the settings I specified in "Expert Settings", but it'd be great to save it as "canned preset" that would show up w/all the other ones (Email, CD-Rom, Web, etc).
    Is this just another feature I've yet to discover, or is it possible at all? Or is it the first roadblock I've encountered where extra ca$h is needed for another product?
    many thank u's in advance.

    .. the key to using a Mac is to think less..
    this is EXACTLY the Mac-experience.. and that is, why PCusers often call us "computer illiterate" .. we don't want to know, what a bios is, a batch file, a bitrate..
    my father-in-law spends 90% of his time with re-installs, set-ups, drivers.. and in the meantime, I create movies and dvds ...
    maybe a bit of TOO much glory, but still saying it all:
    http://www.youtube.com/watch?v=No1MxAnHuJM
    come back here often, share your experiences, dare to ask any question.. there's no dumb question, just dumb answers
    have fun with iM and your Mac ...

Maybe you are looking for