Creating an XML instance from an XML Schema

Hello,
Does anyone know how to create a skeleton XML instance from the mandatory fields taken from an XML Schema?
There might be a way with XSLT, however I cannot find the relevant tutorials for this issue.
Can you please help me out?
Thanks.

Of course I meant how to achieve this "on the fly" using XSLT and Java.

Similar Messages

  • Generate XML instance from a given XSD schema

    Is there an Oracle XDK Java API, which given an XSD as input, will
    generate a sample XML instance corresponding to that XSD.
    XMLSpy Tool can do this.
    I know JAXB can be used to generate Java Classes, which can then be used programmatically to generate XML Instances.
    I am looking for a solution other than JAXB where Java classes does not need to be generated.

    In JDeveloper an XML document instance may be generated from an XML Schema.
    Select File>New>General>XML. Select XML Document from XML Schema in Items listed. Click on OK button. The Create XML Document from XML Schema wizard gets started. Click on Next button. In File Location frame, specify XML file name. Select Use Registered Schemas, to create an XML document from a registered schema. Click on Next button. In Options frame, select Root Element and click on Next button. In the Finish frame, click on Finish button. An XML document instance gets added. The XML document has all of the elements defined in the XML Schema from which the XML document is instantiated.

  • Generating XML instance from XSD

    Hi,
    I want to know ( java program etc ) to generate XML instance from XSD. How tools ( XML Spy, Oxygen ) generate sample XML file from XSD. What APIs can be used for generating XML from XSD and what APIs are used for checking If XML instance conforms to a XSD? Is it big deal to implement it?
    Thanks in advance
    Sandeep

    To validate xml against XSD , I found I can use the existing parsers( using JAXP which has SAX and DOM APIs ) in current JDKs and validate. I still did not find the best way to generate xml from XSD and how tools like xml spy and oxygen generates sample xml file from xsd.
    Thanks
    Sandeep

  • Loading an xml file from an xml file

    I'm trying to load an xml file from an xml file, but I'm
    having problems. My first xml file is really simple - it only
    contains one attribute with the name of another xml file in it
    (eventually I will have multiple xml files in here and run a loop
    on them...this is why I want to load an xml file from an xml file).
    Currently, with the code below, I can get the main xml file
    to load ("main.xml"), but I cannot get the secondary xml files to
    load FROM the main.xml.
    I want to then take childNode values from the secondary xml
    file and use them within my .swf in text boxes and whatnot.
    Any guidance? I think I'm going wrong on the line where I'm
    saying "i.newxml.load(i.attributes.location);"
    - How can I get this to work?

    johnypeter:
    I tried changing the code inside the loop to use just
    "newxml" instead of "i.newxml", and I declared with "var newxml =
    new XML();" - was this what you were thinking?
    kglad:
    The reason I tried to use the loadXML() function in the loop
    was so that for each node in my "main.xml" it would load the new
    xml file listed - this is a no-no? Do you have any ideas as to what
    I could do?
    For the for-loop, what should I change in it? I'm not great
    with loops so I tried to modify some code from another loop I found
    in another forum thread - not the right way to do it here?
    Also, what should I trace? The value of the _root.address, or
    i.attributes.location? I have created dynamic text boxes on my
    stage to see if the correct value from the xml file loads (ie. the
    name of the xml file within the xml file) and it does, but now I
    don't know how to put that information into ANOTHER loadXML()
    function and get the node information from it - does that make
    sense???
    Below are the examples of the xml files I am using. In the
    first one, main.xml, I will have a list of multiple xml files, each
    with the same nodes and elements as in the details.xml file
    (different values, of course).
    This is just to give you an example of what I'm trying to
    accomplish - pulling ALL the addresses and phone numbers from
    multiple xml files. I cannot manually collect this information, as
    it is dynamic, and will be updated in each individual details.xml.
    I was hoping to collect the information by simply adding to and
    updating ONE xml file - main.xml.
    Do you think this can be done? Am I going about it the wrong
    way? I'm quite limited in AS knowledge, which is why I'm piecing
    together code from other posts!

  • How to create an XML fril from an XML instance

    i have already created an instance of the xml using the classes generated from
    the SCHEMA, how will i generate an xml file from the instance i have? is it the
    same like the marshalling/unmarshalling Castor is doing? help please!!!

    It worked, Thanks so much!
    "Steve Traut" <[email protected]> wrote:
    Manuel -- If you simply want to write out the XML you've created, you
    can
    use one of the save methods exposed by your generated XMLBeans types.
    For
    example, to write the XML out to a file, you might do this:
    File myFile = new File("c:/myXml.xml");
    try
    myNewXmlDoc.save(myFile);
    catch (java.io.IOException ioe)
    System.out.println("Error while writing my XML file");
    Note that other save methods are available to write to other formats.
    Steve
    "Manuel Pantaleon" <[email protected]> wrote in message
    news:3f9f9312$[email protected]..
    i have already created an instance of the xml using the classes generatedfrom
    the SCHEMA, how will i generate an xml file from the instance i have?is
    it the
    same like the marshalling/unmarshalling Castor is doing? help please!!!

  • Is there a way to run a script to create an RPD file from MDS XML files

    We would be interested in using the MDS XML format for the RPD file in saving it in our Subversion source code control system, and I have seen how to do this in the User documentation.
    Our question is whether or not there is a way to use a command line tool to recreate the rpd file without having to use the Admin tool, so that we can automate the deployment of the RPD file from source code control to QA and Production environments.
    If we check in the RPD file directly, then there is a way to automate the process, but we would prefer to use the MDS XML format since this allows us to save changes in text format, not binary, but we still need to be able to automate the process.
    In the Oracle Fusion Middleware XML Schema Reference for Oracle Business Intelligence Enterprise Edition document, I have found that there is a way to automate the creation of the MDS XML files from an RPD file using this command:
    biserverxmlgen -M -R repository_pathname [-P password] -D output_directory [-8] [-N] [-Q|-S]
    So my question is basically is there a way to reverse this process, to use some command line tool (or Weblogic Scripting or some other mechanism) to create the RPD file from the MDS XML files? Are there options on the biserverxmlexec command that will do what I am asking?

    Hey dmfairley,
    Thanks for the question. You can absolutely export the project as .mp3, as outlined in this resource:
    GarageBand Help: Export songs to disk
    http://help.apple.com/garageband/mac/10.0/#gbnd7cbf5ed9
    Export songs to disk
    You can export a project to your computer as a stereo audio file.
    Exported files can be reused in GarageBand to save processing resources by replacing or bypassing multiple regions, instruments, and effects. They can also be used with other music applications and devices, posted on the Internet (on a webpage, or in the iTunes Store, for example), added to an iTunes playlist, or uploaded to a mobile device such as iPhone or iPad.
    1. Choose Share > Export Song to Disk.
    2. To rename the exported file, select the name in the Save As field, then enter a new name.
    3. Choose a location to save the exported file from the Where pop-up menu.
    4. Select the format for the exported file (AAC, MP3, or AIFF).
    5. Choose the quality setting for the exported file from the Quality pop-up menu.
    6. Click Export.
    Thanks,
    Matt M.

  • XML instance validation against XML schema

    How can I get a reference on the error node object after
    validation against an XML schema ?
    Ex. :
    DOMParser domP = new DOMParser();
    domP.setXMLSchema(schemaDoc); // schemaDoc = ref. on an XMLSchema
    domP.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    domP.parse(reader); // reader contains the XML instance data
    If an error occurred, I only get a message string. What I need is to get a reference on the node object which contains the error in order to retrieve its properties to the schema.
    I could then alert the user with a message such as :
    "Data xxx is not valid ; it must be comprised between yy and zz...".
    Did somebody solve this problem ? May I use the XMLError class to do this ?
    Thank you

    Hi Ray,
    Were you able to resolve this issue? I am encountering a very similar problem where I am not connected to the internet and it fails during the newSchema method on javax.xml.validation.SchemaFactory. I have attempted to implement the suggestions of ExtremeGardener and vidyut with no luck.
    Per ExtremeGardener's suggestion of replacing xmlns:xs="http://www.w3.org/2001/XMLSchema" with xmlns:xs="XMLSchema.xsd" and storing it locally, it gave me an error for trying to set the "xs" or "xsd" prefixes to anything other than "http://www.w3.org/2001/XMLSchema." I forget the exact error. I also tried to use my own prefix and it did not like that either.
    Per vidyut's suggestion of using a catalog resolver, I believe that I have tried that too (if I understand correctly). I created an LSResourceResolver and tied it to the SchemaFactory. I can invoke it for a namespace but that did not resolve the issue because it only invokes the resolver on an import, include, or redefine. I believe that it is trying to reach the internet due to the xmlns:xs="http://www.w3.org/2001/XMLSchema" attribute within the top-level schema element in the XSD and I know of no way to invoke it for that.
    I also created an ErrorHandler and tied it to the SchemaFactory. That shows me the errors and they are all related to the standard XML data types defined in XMLSchema.xsd. The errors that I am seeing are all of this form: "UndeclaredPrefix: Cannot resolve 'xs:string' as a QName: the prefix 'xs' is not declared."
    I am currently using the SchemaFactory in Java 1.5, but I am thinking about trying the Xerces SchemaFactory since they are not exactly the same implementation.
    Does anyone have any other suggestions? Any help you can provide would be greatly appreciated!
    Thanks,
    betzro1

  • How to generate a XML file from a XML schema...?

    Hi guys...!
    I have a XML schema and I want to write a XML file based on that schema. I have heard about this feature that eclipse has, which given a XML schema, can generate a XML file for you.
    Does anyone of you know about this feature? or is there another way to do it. The schema that I have is very huge...
    I will really appreciate any help from you guys...
    Thank...you..
    --- Spirit Away...

    don't cross post
    http://forum.java.sun.com/thread.jspa?threadID=649205&tstart=10

  • Create Value node instance from structure at runtime

    Hi,
    I have a requirement where an internal table is given with some details.
    Now I need to add each row of this internal table as one entity into a collection.
    For this I need to create value node instance for each entry of the table and then
    lr_collection->if_bol_bo_col~add( lr_entity ).
    this to add to the collection.
    Please tell me how to convert this one row of this table into entity.
    Regards,
    pooja

    Try it like this:
    DATA: lt_data type table of ty_line.
    DATA: ls_data type ty_line.
    For the value nodes we need an data object
    DATA: lr_line_ref type ref to ty_line.
    The value node which should be added
    DATA: lr_value_node type ref to cl_bsp_wd_value_node.
    First create the reference structure
    CREATE DATA lr_line_ref.
    *Loop over you itab
    LOOP AT lt_data into ls_data.
    Create the value node based on the ref line
    CREATE OBJECT lr_value_node
    EXPORTING iv_data_ref = lr_line_ref.
    Now set the data from the internal table
    lr_value_node->set_properties( ls_data ).
    Now add the created value node to the collection
    lr_collection->if_bol_bo_col~add( lr_value_node ).
    ENDLOOP.

  • How to extract a set of XML elements from an XML element

    My XML, stored in a variable called v_XML_input, is as follows:
    <Root>
      <PackageName>MY_PKG</PackageName>
      <ProcedureName>SAVE_ADJ_VALUES</ProcedureName>
        <Parameters> 
          <Parameter>
              <Name>p_xml_string</Name>
              <Value><DocumentElement>
                       <tblAdjustments>
                         <EmpID>41439</EmpID>
                         <UserNTID>APPUSER</UserNTID>
                         <Comment>TEST RECORD</Comment>
                         <Amount>2000</Amount>
                         <RecordType>R</RecordType> 
                       </tblAdjustments>
                      </DocumentElement>
              </Value>
          </Parameter>
        </Parameters>
    </Root>I want to extract only whatever is between <Value> and </Value>. In this case just this:
                    <DocumentElement>
                       <tblAdjustments>
                         <EmpID>41439</EmpID>
                         <UserNTID>APPUSER</UserNTID>
                         <Comment>TEST RECORD</Comment>
                         <Amount>2000</Amount>
                         <RecordType>R</RecordType> 
                       </tblAdjustments>
                      </DocumentElement>The actual values between the <Value> and </Value> may not always be these same elements; they may be strings, numerical values, or other XML values.
    I've tried the following in a LOOP, and it works for other strings and numerical values, but I get a ORA-30625: method dispatch on NULL SELF argument is disallowed when trying to extract an XML value as a string.
    v_sql_str := v_XML_input .extract('//Parameters/Parameter[position() = '||i||']/Value/text()') .getstringVal()||'''';Any help is appreciated...TIA!

    Not sure what you are actually trying to accomplish.
    What's wrong with
    SQL> SELECT xmlserialize(content XMLTYPE
              ('<Root>
      <PackageName>MY_PKG</PackageName>
      <ProcedureName>SAVE_ADJ_VALUES</ProcedureName>
        <Parameters> 
          <Parameter>
              <Name>p_xml_string</Name>
              <Value><DocumentElement>
                       <tblAdjustments>
                         <EmpID>41439</EmpID>
                         <UserNTID>APPUSER</UserNTID>
                         <Comment>TEST RECORD</Comment>
                         <Amount>2000</Amount>
                         <RecordType>R</RecordType> 
                       </tblAdjustments>
                      </DocumentElement>
              </Value>
          </Parameter>
        </Parameters>
    </Root>'
              ).extract('//Value/*') indent)xml
      FROM DUAL
    XML                                                                                                                                                                                                                                                                                                        
    <DocumentElement>                                                                                                                                                                                                                                                                                          
      <tblAdjustments>                                                                                                                                                                                                                                                                                         
        <EmpID>41439</EmpID>                                                                                                                                                                                                                                                                                   
        <UserNTID>APPUSER</UserNTID>                                                                                                                                                                                                                                                                           
        <Comment>TEST RECORD</Comment>                                                                                                                                                                                                                                                                         
        <Amount>2000</Amount>                                                                                                                                                                                                                                                                                  
        <RecordType>R</RecordType>                                                                                                                                                                                                                                                                             
      </tblAdjustments>                                                                                                                                                                                                                                                                                        
    </DocumentElement> ?
    Note: xmlserialize is not necessary and is there just for pretty printing the result.

  • Using REGEXP_REPLACE to remove XML data from between XML tags

    Hello there,
    I am trying to use the REGEXP_REPLACE SQL function on a piece of XML, to remove the actual XML data from the elements. My end goal is to end up with a comma-delimited list of XML element names. As part of the first step, I just want to rip out all the actual data.
    I tested the following query, and it initially appeared to work:
    SELECT REGEXP_REPLACE('&gt;THIS IS A TEST&lt;',
                          '&gt;([[:alnum:]]\s|\S)*&lt;',
                          '&gt;&lt;' ) AS test_result
      FROM dual;Unfortunately, when I applied this to a full XML string, it didn't work. Here is the test query I used:
    SELECT REGEXP_REPLACE('&lt;ROW&gt;&lt;TEST_ELEMENT1&gt;123&lt;/TEST_ELEMENT1&gt;&lt;TEST_ELEMENT2&gt;THIS IS A TEST!&lt;/TEST_ELEMENT2&gt;&lt;/ROW&gt;',
                          '&gt;([[:alnum:]]\s|\S)*&lt;',
                          '&gt;&lt;') AS test_result
      FROM dual;I ended up with the following output:
    *&lt;ROW&gt;&lt;/ROW&gt;*
    What I was trying for was:
    *&lt;ROW&gt;&lt;TEST_ELEMENT1&gt;&lt;/TEST_ELEMENT1&gt;&lt;TEST_ELEMENT2&gt;&lt;/TEST_ELEMENT2&gt;&lt;/ROW&gt;*
    If you're reading this and you're a Posix RegExp Guru, please could you let me know exactly where I'm going wrong? RegExps are not my strong point, but I'd like to get better at them.

    jmcnaug2 wrote:
    Just out of interest, how would you go about writing the XQuery function so that it returns the actual XML Element values in comma-delimited form (This is Oracle Canonical XML, so has a very basic layout)? ;)Do you mean like this ?
    SQL> SELECT xmlquery(
      2    'for $i in $d/ROWSET/ROW
      3     return string-join($i/*, ",")'
      4    passing dbms_xmlgen.getXMLType('SELECT employee_id, last_name, first_name FROM employees WHERE rownum < 10') as "d"
      5    returning content
      6  ).getClobVal() as csv
      7  FROM dual;
    CSV
    100,King,Steven
    101,Kochhar,Neena
    102,De Haan,Lex
    103,Hunold,Alexander
    104,Ernst,Bruce
    105,Austin,David
    106,Pataballa,Valli
    107,Lorentz,Diana
    108,Greenberg,Nancy
    SQL>

  • Xml import from mutlitple xml files

    Is it possible to import different xml files for different locations within the same InDesign document?
    For example a single page has two text boxes. Text Box 1 needs to import data from File1.xml, Text Box 2 needs to import data from File2.xml, etc. Is this possible or will File1.xml and File2.xml need to be merged into one xml file?

    TurtleCruiser,
    One of the problems I have had is that I want the data to update through linking, but I've only managed to get one text box to update while the data in the other box disappeared. Since posting I have managed to achieve the desired result using InDesign Tagged Text. Ideally, I would like to use xml so I will see if I can achieve the same result with your method.
    Many thanks for your reply.

  • Read xml-structure from a xml-document stored in a xmltype-column?

    Hello,
    I have several xml-documents stored in a table with a xmltype-column.
    Is it possible to read the structure of one xml-document? I need to know what data are exists in the xml-documents.
    I had read some hours here, but I dont find a suitable solution for that.
    To make a example, what I need:
    I have stored the following xml-document in the table:
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="6">
    <EMPLOYEE_ID>105</EMPLOYEE_ID>
    <FIRST_NAME>David</FIRST_NAME>
    <LAST_NAME>Austin</LAST_NAME>
    <EMAIL>DAUSTIN</EMAIL>
    <PHONE_NUMBER>590.423.4569</PHONE_NUMBER>
    <HIRE_DATE>6/25/1997 0:0:0</HIRE_DATE>
    <JOB_ID>IT_PROG</JOB_ID>
    <SALARY>4800</SALARY>
    <MANAGER_ID>103</MANAGER_ID>
    <DEPARTMENT_ID>60</DEPARTMENT_ID>
    </ROW>
    </ROWSET>
    I need to return the following:
    ROWSET
    ...ROW
    ......EMPLOYEE NUMBER
    ......FIRST_NAME VARCHAR2
    ......DEPARTMENT_ID NUMBER
    Regards,
    Mark

    Hi,
    I was on a wrong way. The datatype is not stored in xml, this was a mistake from me.
    I needed something to printout some values from a xml-file. This xml-file was generated bei MS Excel. The data are in /Workbook/Worksheet/Table/Cell and I didnt know how to access it.
    I write for that the following:
    DECLARE
    v_xml XMLType;
    v_doc dbms_xmldom.DOMDocument;
    v_node dbms_xmldom.DOMNode;
    type t_values is table of varchar2(2000) index by binary_integer;
    v_values t_values;
    type t_table is table of t_values index by binary_integer;
    v_table t_table;
    procedure node_output (v_node in out dbms_xmldom.DOMNode)
    is
    v_nodelist1 DBMS_XMLDOM.DOMNodeList;
    v_nodelist2 DBMS_XMLDOM.DOMNodeList;
    v_anzahlnodes number;
    v_anzahlrows number;
    v_node_c dbms_xmldom.DOMNode;
    v_xmlmitarbeiterid number;
    begin
    v_nodelist1 := dbms_xmldom.GETCHILDNODES(v_node);
    v_anzahlrows := DBMS_XMLDOM.GETLENGTH(v_nodelist1);
    if v_anzahlrows = 0 or DBMS_XMLDOM.GETNODENAME(v_node) = 'Table'
    then
    if v_anzahlrows > 0
    then
    for i1 in 0..v_anzahlrows - 1
    loop
    v_node := dbms_xmldom.Item(v_nodelist1,i1);
    v_nodelist2 := dbms_xmldom.GETCHILDNODES(v_node);
    v_anzahlnodes := DBMS_XMLDOM.GETLENGTH(v_nodelist2);
    for i2 in 0..v_anzahlnodes - 1
    loop
    v_node := dbms_xmldom.Item(v_nodelist2,i2);
    v_node_c := dbms_xmldom.GETFIRSTCHILD(v_node);
    v_node_c := dbms_xmldom.GETFIRSTCHILD(v_node_c);
    v_values(i2) := DBMS_XMLDOM.GETNODEVALUE(v_node_c);
    end loop;
    v_table(i1) := v_values;
    end loop;
    for i1 in 1..v_anzahlrows - 1
    loop
    select SEQ_XMLMITARBEITER.nextval into v_xmlmitarbeiterid from dual;
    for i2 in 1..v_table(i1).count - 1
    loop
    dbms_output.put_line(v_table(i1)(i2));
    end loop;
    end loop;
    end if;
    else
    v_node := dbms_xmldom.GETFIRSTCHILD(v_node);
    for i in 0..v_anzahlrows - 1
    loop
    v_node := dbms_xmldom.Item(v_nodelist1,i);
    node_output(v_node);
    end loop;
    end if;
    end;
    BEGIN
    select inhalt into v_xml FROM xmlimport WHERE name = 'F23973/mitarbeiter.xml';
    v_doc := dbms_xmldom.newDOMDocument(v_xml);
    v_node:= dbms_xmldom.makeNode(dbms_xmldom.getDocumentElement(v_doc));
    node_output(v_node);
    END;
    This gives me all data from a xml-Excel-file. Is there a better way to do that? I have Oracle 10.2.
    Regards,
    Mark

  • How to create resized image instance from an existing image

    It looks like the image class does not provide a possibility to create a resized instance. Image#impl_getURL() would be good enough to create a resized instance of an existing image - but could be removed in a future release. So what's the preferred way if I have an image object only - there's no information about the based image resource.

    You can resize an image on loading using one of the constructors that takes requestedWidth and requestedHeight parameters. This is useful for preserving memory when (for example) needing to display a large number of thumbnails.
    Additionally, the ImageView class defines resizing functionality for the view of an Image. So you can load the full Image, then display one or more resized versions in ImageView(s).
    If you need, you can retrieve an Image object representing the ImageView by calling snapshot(...) on the ImageView; for most use cases the ImageView itself will be all you need.

  • How to create a java file from an xml file

    anybody who can help me? i'm really trying to get this job in a hurry..thanks

    wondering if velocity template engine can help.
    a. parse XML
    b. construct bean (will XMLBeans help?)
    c. write java files (velocity may have helped here) from predefined template.
    Looking forward to other suitable solution.
    JSP to servlet is, I guess, such example.

Maybe you are looking for

  • How can I upload a pdf file?

    I am trying to set up an informational business site in which folks can hit a hyperlink and it automatically downloads a pdf, page or word file onto their screen. I want to have a page that is referencing several papers with brief descriptions of eac

  • Saprfc version for php 5.2.1

    Hi all   Can anyone pls tell me the version of saprfc to be installed for php version 5.2.1 Thanks in advance

  • Zen Extra harddisk prob

    My Zen Extra will only go into rescue mode when turned on. If I then proceed to try a "Format All" or a "Reload OS" it says I have a harddisk problem. I have tried to "Clean Up" but it doesnt do anything, it just sits there in recovery mode. I have t

  • Making my external not able to spin-down

    Hey all, I've got a portable hard drive that's kinda screwed up, and won't spin up correctly 95% of times I try to start it (I've sat there for hours trying to get it to start powering on and off). I need to get it replaced, but until then... Anyways

  • Getting rid of white download icons

    This may seem like a stupid question, but I can't seem to solve it. Whenever I download something, it creates a white zip disk like icon on my desktop. When I'm done installing the program, I "eject" the icon. But when I open that program, the icon r