Create XML File from a specified XSD file

Hi,
I'd like to create an XML document with java. BUT How can we "bind" this creation with a XSD file. Hence, the creation may fail if the XSD binded file is not respected.
So I know how to create XML file but not bind to this creation my proper XSD file (XML schema). With which tool can I do this ?
Thanks.

Hi,
I'd like to create an XML document with java. BUT How can we "bind" this creation with a XSD file. Hence, the creation may fail if the XSD binded file is not respected.
So I know how to create XML file but not bind to this creation my proper XSD file (XML schema). With which tool can I do this ?
Thanks.

Similar Messages

  • HT1550 Exactly how does iTunes create an AIFF file from an Apple Lossless File?

    Exactly how does iTunes create an AIFF file from an Apple Lossless File?

    Paste the email address into any text field and drag it to the desktop.
    (52616)

  • 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.

  • Heap space error while creating XML document from Resultset

    I am getting Heap space error while creating XML document from Resultset.
    It was working fine from small result set object but when the size of resultset was more than 25,000, heap space error
    I am already using -Xms32m -Xmx1024m
    Is there a way to directly write to xml file from resultset instead of creating the whole document first and then writing it to file? Code examples please?
    here is my code:
    stmt = conn.prepareStatement(sql);
    result = stmt.executeQuery();
    result.setFetchSize(999);
    Document doc = JDBCUtil.toDocument(result, Application.BANK_ID, interfaceType, Application.VERSION);
    JDBCUtil.write(doc, fileName);
    public static Document toDocument(ResultSet rs, String bankId, String interfaceFileType, String version)
        throws ParserConfigurationException, SQLException {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.newDocument();
            Element results = doc.createElement("sims");
            results.setAttribute("bank", bankId);
            results.setAttribute("record_type", "HEADER");
            results.setAttribute("file_type", interfaceFileType);
            results.setAttribute("version", version);
            doc.appendChild(results);
            ResultSetMetaData rsmd = rs.getMetaData();
            int colCount = rsmd.getColumnCount();
            String columnName="";
            Object value;
            while (rs.next()) {
                Element row = doc.createElement("rec");
                results.appendChild(row);
                for (int i = 1; i <= colCount; i++) {
                    columnName = rsmd.getColumnLabel(i);
                    value = rs.getObject(i);
                    Element node = doc.createElement(columnName);
                    if(value != null)
                        node.appendChild(doc.createTextNode(value.toString()));
                    else
                        node.appendChild(doc.createTextNode(""));
                    row.appendChild(node);
            return doc;
    public static void write(Document document, String filename) {
            //long start = System.currentTimeMillis();
            // lets write to a file
            OutputFormat format = new OutputFormat(document); // Serialize DOM
            format.setIndent(2);
            format.setLineSeparator(System.getProperty("line.separator"));
            format.setLineWidth(80);
            try {
                FileWriter writer = new FileWriter(filename);
                BufferedWriter buf = new BufferedWriter(writer);
                XMLSerializer FileSerial = new XMLSerializer(writer, format);
                FileSerial.asDOMSerializer(); // As a DOM Serializer
                FileSerial.serialize(document);
                writer.close();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            //long end = System.currentTimeMillis();
            //System.err.println("W3C File write time :" + (end - start) + "  " + filename);
        }

    you can increase your heap size..... try setting this as your environment variable.....
    variable: JAVA_OPTS
    value: -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

  • Transfer excel files from iMac to excel file on ipad

    transfer excel files from iMac to excel file on iPad.  Using iTunes, I transfered files on my mac using Numbers and it worked fine, but trying the same method for an Excel file didn't work (i.e., the Excel file never showed up on my iPad.)
    Thanks for any help you can provide.
    LJ

    http://www.wondershare.com/pdf/transfer-pdf-to-ipad.html
    http://www.bythom.com/pdffaq.htm
    How to Transfer PDFs to an iPad
    http://www.dummies.com/how-to/content/how-to-transfer-pdfs-to-an-ipad.html
     Cheers, Tom

  • Read table data and fetch file from path specified in table column

    Hi,
    I have a situation where file path information is stored in database table along with other columns - I need to read data from SQL Server table row by row, go to the path identified by the record, check for existance of the file - if the file is available copy it to a staging area, then read the next record. Repeat this process until the last record is fetched from the table. At the end, zip all the files found and FTP to a different location. If the file is not found in the path specified, write the database record to a seperate text file.
    At end of the process, send an email with records for which files were not found at specified location.
    Thanks
    Edited by: user4566019 on Oct 5, 2008 4:32 AM

    Hi,
    That is not complex to solve at ODI.
    Try the following.
    1) Create a package
    2) create a variable to receive the path as parameter and drag and drop it at package as "Declared"
    3) drag and drop the ODI Tool "odiFileMove" using and let the variable as patch at ODI Tool parameter.
    Use the parameters -ACTION=MOVE -TIMEOUT=100 and -NOFILE_ERROR=NO (take a look at ODI Toos Reference for other parameters)
    3) Create a "KO" (error) flow to write the variable at a text file. That will allow the process knows what file is missing
    4) generate a scenario of this package
    5) create a procedure
    6) at first step, put the query from SQL Server (set the Logical Schema to the right connection)
    7) at Target tab, put the call to the scenario generated using the returned value from query parameter. Plus, let the -SYNC_MODE=1. That will call one scenario by time.
    8) create a new step to zip the files at stage directory
    9) create a step to make the ftp
    10) create a step to mail the txt generated with files not founded. If you wish, you can make a validation on the file to see if is necessary to send the mail, it means, if there is any file missing.
    Does it help you?

  • Converting XML file to DTD or XSD file

    Hi everyone,
    We're currently doing an IDOC to File. The file should be in XML format. Right now, we have a sample XML file. We need to convert the file to DTD or XSD and then upload this in XI to be able to get it structure. We've tried different conversion tools to do this, however, the converted DTD/XSD file still has errors when we load it to XI. What we're thinking is to create a data type to achieve this. These are some of the fields in the file.
    <messageHeader creationDate>
    <catellae:gTTSDataDelivery creationDate="X" (...)>
    */<catellae:(…)>/<txnId>
    */<catellae:(…)>/<items>/<item>/<quantity>
    */<catellae:(…)>/<items>/<item>/<unitOfMea>
    */<catellae:(…)>/<items>/<item>/<prodDesc>/<matType>
    */<catellae:(…)>/<shipToAddress>/<nameAndAddress>/<city>
    */<catellae:(…)>/<shipToAddress>/<contactInformation>/<communicationChannel (…)
    It seems that there are more than 3 nodes. And in XI, only three nodes are allowed. Could you tell us how should we create the data type for this? Thanks in advance!

    Hi Mariel,
              Refer to the below link for conversion of XML to Xsd using Altova XML Spy.
    Re: data type for xml file
    For altova free trial Download:
    http://www.altova.com/download.html
    Please let me know if u need furthur information.
    Thanks,
    Bhargav.
    Note:Award points if found useful

  • Can we create pdf files from oracle using UTL FILE

    i have sample code---
    create or replace procedure UTLTEST as
    f1 utl_file.file_type;
    begin
    -- Open a file in write mode
    f1 := utl_file.fopen('UTL_FILE_DIR1','NEWFILE.pdf','W');
    -- Write a line to a file
    utl_file.put_line(f1,'1. This is a test of UTL_FILE packages');
    utl_file.put_line(f1,'2. Oracle has added a new procedures in the package');
    utl_file.put_line(f1,'3. We will see all the procedure one by one');
    -- Close a file
    utl_file.fclose(f1);
    end;
    file is created but when i opened it ,it gives me error that file can not open
    is there any way to do it?

    Hi!
    you can see the following link ---
    http://forums.oracle.com/forums/search.jspa?threadID=&q=how+to+create+pdf+from+pl+sql&objID=f75&dateRange=all&userID=&numResults=15 .
    And also -- http://www.plpdf.com/ .
    Hope this will help u a bit.
    Regards.
    Satyaki De.

  • Creating PDF's from *.doc or *.docx file with fake security issue's ......

    Hi,
    We're trying the new 11 Pro and just patched it to:11.0.09 to try to fix this error below.
    When the user tries to create a PDF from the main menu that now says "Create PDF from File" instead of the old screen that said "Create PDF" ......
    If I start the process with a *.docx file I get the " can't open the file because of rights "  error and it was doing the same thing in the old original installed
    version of 11 and also now this the new one I just updated now to try to fix it. 
    I also deleted the normal.doc templates in both his old MS Word 2003 program and also in the current copy he uses MS Word 2007.
    If I start the 11 Pro and pick the same document as the first one except for the fact that it has been re-saved in a *.doc MS Word 2003 format,
    the whole thing works perfectly.
    Any suggestions?
    Cheers'
    Dave

    Have you tried to open WORD and either print to the Adobe PDF printer or use the Acrobat icon (PDF Maker)? Try both. Do they work or not. PDF Maker has to work for the functionality of the create in Acrobat to work.

  • Create Class objects from an Array of File Objects

    Hi There,
    I'm having extreme difficulty in trying to convert an array of file objects to Class objects. My problem is as follows: I'm using Jfilechooser to select a directory and get an array of files of which are all .class files. I want to create Class objects from these .class files. Therefore, i can extract all the constructor, method and field information. I eventually want this class information to display in a JTree. Very similar to the explorer used in Netbeans. I've already created some code below, but it seems to be throwing a NoSuchMethodError exception. Can anyone please help??
    Thanks in advance,
    Vikash
    /* the following is the class im using */
    class FileClassLoader extends ClassLoader {
    private File file;
    public FileClassLoader (File ff) {
    this.file = ff;
    protected synchronized Class loadClass() throws ClassNotFoundException {
    Class c = null;
    try {
    // Get size of class file
    int size = (int)file.length();
    // Reserve space to read
    byte buff[] = new byte[size];
    // Get stream to read from
    FileInputStream fis = new FileInputStream(file);
    DataInputStream dis = new DataInputStream (fis);
    // Read in data
    dis.readFully (buff);
    // close stream
    dis.close();
    // get class name and remove ".class"
    String classname = null;
    String filename = file.getName();
    int i = filename.lastIndexOf('.');
    if(i>0 && i<filename.length()-1) {
    classname = filename.substring(0,i);
    // create class object from bytes
    c = defineClass (classname, buff, 0, buff.length);
    resolveClass (c);
    } catch (java.io.IOException e) {
    e.printStackTrace();
    return c;
    } // end of method loadClass
    } // end of class FileClassLoader
    /* The above class is used in the following button action in my gui */
    /* At the moment im trying to output the data to standard output */
    private void SelectPackage_but2ActionPerformed(java.awt.event.ActionEvent evt) {
    final JFileChooser f = new JFileChooser();
    f.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    int rVal = f.showOpenDialog(Remedy.this);
    // selects directory
    File dir = f.getSelectedFile();
    // gets a list of files within the directory
    File[] allfiles = dir.listFiles();
    // for loop to filter out all the .class files
    for (int k=0; k < allfiles.length; k++) {
    if (allfiles[k].getName().endsWith(".class")) {
    try {
    System.out.println("File name: " + allfiles[k].getName()); // used for debugging
    FileClassLoader loader = new FileClassLoader(allfiles[k]);
    Class cl = loader.loadClass();
    //Class cl = null;
    Class[] interfaces = cl.getInterfaces();
    java.lang.reflect.Method[] methods = cl.getDeclaredMethods();
    java.lang.reflect.Field[] fields = cl.getDeclaredFields();
    System.out.println("Class Name: " + cl.getName());
    //print out methods
    for (int m=0; m < methods.length; m++) {
    System.out.println("Method: " + methods[m].getName());
    // print out fields
    for (int fld=0; fld < fields.length; fld++) {
    System.out.println("Field: " + fields[fld].getName());
    } catch (Exception e) {
    e.printStackTrace();
    } // end of if loop
    } // end of for loop
    packageName2.setText(dir.getPath());
    }

    It's throwing the exeption on the line:
    FileClassLoader loader = new FileClassLoader(allfiles[k]);
    I'm sure its something to do with the extended class i've created. but i cant seem to figure it out..
    Thanks if you can figure it out

  • How do I create a pdf from a large jpeg file

    I am trying to convert a 20MB jpeg file into PDF using acrobat but I get an error that says the file is either not supported or is a corrupted/damaged file. However, I can open the jpeg in windows image viewer and photoshop.
    Why not convert it in photoshop you ask? This is because every time I try to save a large file as pdf in photoshop, I get a corrupted file. I get the error "out of memory" when I try to open the file.
    The 20MB jpeg file was originally a psd file, saved as jpeg and now being converted to pdf. Questions:
    Is there a file size limit to convert to pdf in acrobat?
    Why are my pdf files saved from photoshop saying 'out of memory'?

    Hello,
    I was able to receive help from Adobe chat and resolve the issue. I did not get any answers as to why I was getting the error message. But to get around the error message, these are the steps:
    1. Save image as Jpeg (in photoshop or whatever)
    2. In windows explorer, right-click on jpeg file and click "open file with" and choose Adobe Acrobat
    3. Once the file is open in Acrobat, File > Save (not save as) then save in desired file name.
    This is another option to save jpegs as PDFs. An even better option for saving images into PDFs is to save the file as Photoshop EPS format in photoshop, you can then open it in Acrobat to save as a PDF. While saving as Jpeg and converting to pdf yielded a ~15mb file, saving the files as a PhotoshopEPS first then converting it to PDF yields a smaller file, at ~9mb. Still the same quality.

  • Wrong settings when create a sequence from an AVCHD (.mts) file from canon xa20. Adobe premiere sets as AVC-intra 100 1080i

    I don't know why Adobe premiere CC automatically adjust an .mts file from my canon XA20 (AVCHD based on h264 1920x1080 25p) like an AVC-intra 100 1080i. While editing it appears crispy and noisy. Im editing in a windows 7 64 bits plattform. Must I install de properly codec on my machine ¿?
    Any suggestion ¿?

    Yes it does that. AVCintra is just a name for a preset. Set the preview codec to i frame mpeg only
    And no, dont install any codec.
    You can alsway select a AVCHD preset from the list.

  • Create a pfd file from a word 2004 file containing multiple Sections.

    I just got a macbook pro, installed office 2004 and acrobat pro 8.1. However, when I want to print - using PDF 8.9 printer driver - a word file with multiple sections in it, I cannot get the full document in the pdf file but only the last Section.
    Some sections are portraits and others are landscapes.
    Any idea what is happening? Tried to play with various set-up but nothing works...... Help!

    Thanks, however, I tried and it does not work. Also I correct the printer driver is 8.0 not 8.9. I tried both ways you mentionned but I get the pdf files in multiple sections (one file per section), cannot get a full file with all sections at once.

  • How do I create a PDF file from a word document file?

    How do I create  PDF document from a word document

    Acrobat Pro will do this. See: http://www.adobe.com/products/acrobat/word-to-pdf-converter.html
    Hope that helps,
    Brian

  • Problem with import tag in xsl files and include in xsd files

    Hello,
    I've been developing an application using JBoss as server. Then, i created an especific path for xsd and another path for xsl files. In both cases, i created a main file that include (xsd) or import (xsl) the other files. My problem is that i have to specify the exactly path where the imported xsl or the included xsd files are, even though they are in the same path as the main file. What i want to know is how i say that the other xsd and xsl files are in the same path that the main file that is importing them?
    here's an example of my import and include declarations:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:import href="../server/jboss/deploy/application.ear/pack.jar/xsl/transformer1.xsl"/>
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              elementFormDefault="qualified">
         <xsd:include schemaLocation="../server/jboss/deploy/application.ear/pack.jar/xsd/schema1.xsd"/>
    thanks for your help

    yes, thats not the value returned of
    URL url = this.getClass().
                        getResource("/xsl//transformer.xsl");the expression i posted is an string i'm using to test.... but i think it's not incorrect, because if the files i'm trying to open are not in the path, he throws the following exception:
    java.io.FileNotFoundException: C:\cpqd\isp\tools\third-party\jboss\server\jbossISP1\deploy\cpqd-ispeng-EngEJB-3.3.0.0.ear\cpqd-ispinv-ServiceEJB.jar\xsl\isp_transformer_manufacturer.xsl
        at org.jboss.net.protocol.file.FileURLConnection.connect(FileURLConnection.java:80)
        at org.jboss.net.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:89)
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
        at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xalan.processor.ProcessorInclude.parse(ProcessorInclude.java:323)
        at org.apache.xalan.processor.ProcessorInclude.startElement(ProcessorInclude.java:192)
        at org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:668)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:972)
        at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:788)
        at br.com.cpqd.oss.isp.service.adapter.FrameworkAdapter.createExternalData(FrameworkAdapter.java:131)
        at br.com.cpqd.oss.isp.service.message.ExternalDataMDBBean.onMessage(ExternalDataMDBBean.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:458)
        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
        at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:62)
        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:284)
        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:150)
        at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:90)
        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
        at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:372)
        at org.jboss.ejb.Container.invoke(Container.java:709)
        at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:928)
        at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1205)
        at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:276)
        at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)
        at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159)
        at org.jboss.mq.SpySession.run(SpySession.java:351)
        at org.jboss.jms.asf.StdServerSession.run0(StdServerSession.java:200)
        at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
        at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
        at java.lang.Thread.run(Thread.java:534)and when the files are in the path, he throws the other exception... thats why i think the problem it's not the URL....

Maybe you are looking for

  • Linux 3.9.2-1 lockups (nVidia + nouveau)

    With the recent update from Linux 3.8.11-1 to Linux 3.9.2-1, upon restart my computer would lock up after roughly 5 minutes and the CPU and/or GPU fan (couldn't tell which) started to spin up very fast a few seconds before hand. As soon as I downgrad

  • Proxy Object for external WSDL--Not using XI

    Dear Collegues, URL OF web service: <u>http://www.nanonull.com/TimeService/TimeService.asmx</u> I am trying to create proxy object from <b>se80->enterprise services->create proxy then is selecting url/http and giving the above address(url).</b> i get

  • DVI adapter crashes MacBook Pro

    Hello, I have a MacBook Pro with a DVI output, So I bought a DVI to HDMI adapter just like this one: http://www.sanace.com/IT/images/dvi-hdmi.jpg Whenever I plug the adapter into my MacBook Pro (with or without any HDMI cable) it crashes by shutting

  • Under reset subscriber services on the iPad, how do I learn the passcode when I never set one?

    Under reset subscriber services on the iPad, how do I learn the passcode when I never set one?

  • SETTING FIELD IN ANOTHER CLASS

    I have 3 classes: class1 extends Jpanel, class2 extends Jpanel, class3 extends JFrame. What I am trying to do is set the textfields in class1 from class2 according to user input: user enters an ID and presses a button (in another frame: class4) and d