Question about generate xml document

Hi, I'm new to xml can anyone introduce me some tools to generate xml documents? or some faster way to generate xml documents.

a good site for the info www.xml.com or www.oasis.org
xml-spy is a good tool

Similar Messages

  • Generate XML document

    Hi,
    My problem is about generating XML document. I'd like to be able to generate automaticaly (like what we can get at this kind of URL http://xdbserver:8080/oradb/USER/table_name) XML documents for any relational tables, I want the document being schema based and I want to store them in XDB in the repository.
    I do not really matter at the time the way the xml is generated (I just do not want that it takes hours). Is there a way to do that with PL/SQL package or with a java classes?
    Thanks in advance.
    Vlad

    1)I'm using this PL/SQL proc to create XML :
    (table_name in VARCHAR2)as --generation d'un fichier xml basé sur un schéma pour la table dont le nom est passé en paramètre
    qryCtx DBMS_XMLGEN.ctxHandle;
    result XMLType;
    begin
    qryCtx := dbms_xmlgen.newContext('SELECT * from VLAD.' || table_name);
    -- set the row header to be EMPLOYEE
    DBMS_XMLGEN.setRowTag(qryCtx, table_name);
    -- now get the result
    result := DBMS_XMLGEN.getXMLType(qryCtx,2); --2 for XMLSchema (1 for a DTD)
    --insertion de result dans la table tempo
    insert into tempo values(result);
    --close context
    DBMS_XMLGEN.closeContext(qryCtx);
    exception
    when others then
    dbms_output.put_line(TO_CHAR(sqlerrm));
    end;
    I saw in the doc that DBMS_XMLGEN.getXMLType(qryCtx,2) with the "2" was for schema but what does it do exactly, does it generate a schema against the table_name?
    2)I'd like to put the result which is XMLType in a XML file in the server, is there a way to do it with UTL FILE?
    Vlad

  • How to validate generated XML-Document in Memory by XML-Schema?

    Hi all!
    I have the following problem:
    I am generating a Document using the DOM delivered with Xerces 2.6.2.
    Before I'll send the generated xml-document through network to another system I have to check with my xml-schema if the document is correct.
    In the DOM-FAQ I found an "example" trying to explain how it should work. But with this example the problems begin.
    I am creating my document with this method:
         public void createDocument() {
              myDOM = DOMImplementationImpl.getDOMImplementation();
              doc = myDOM.createDocument("", "documentData", null);
              root = doc.getDocumentElement();
              root.setAttribute(
                   "xmlns:xsi",
                   "http://www.w3.org/2001/XMLSchema-instance");
              //          root.setAttribute("xsi:noNamespaceSchemaLocation", "myScheme.xsd");
              domConfig = ((DocumentImpl) doc).getDomConfig();
              domConfig.setParameter(
                   "schema-location",
                   "file:///d:/workspace/XMLProject/WebContent/WEB-INF/myScheme.xsd");
              domConfig.setParameter("error-handler", new EHandler());
              domConfig.setParameter("validate", Boolean.TRUE);
         }In the line getting the domConfig, it is getting differeing to the example: The example is like this:
    import org.w3c.dom.Document;
    import org.w3c.dom.DOMConfiguration;
    import org.w3c.dom.ls.LSParser;
    Document document = builder.parseURI("data/personal-schema.xml");
    DOMConfiguration config = document.getConfig();
    config.setParameter("error-handler",new MyErrorHandler());
    config.setParameter("validate", Boolean.TRUE);
    document.normalizeDocument();They get the DOM-Configuration from the document-Object, but my document-Object has no "getConfig()" and only after type-casting I get a getDomConfig()-Method to get the configuration.
    Then I fill my document and call                
    ((DocumentImpl) doc).normalizeDocument();When I run my Application I get the following error:
    org.w3c.dom.DOMException: FEATURE_NOT_SUPPORTED: The parameter schema-location is recognized but the requested value cannot be set.
         at org.apache.xerces.dom.DOMConfigurationImpl.setParameter(Unknown Source)
         at xmlProject.createDocument(Convert.java:63)
         at xmlProject.Convert.main(Convert.java:154)I tried several ways to get the validation without success.
    The next question is how I should refer to my xml-schema (which path) and where to place it relative to my jar I will generate, because I will have no webserver I could place it on.
    Has anyone any experience with validating a document created and not placed on disc?
    I have also another question to SAX: I read, that it is reading a document without saving it in the memory. I think this means that if I am validating it by SAX it will be read once and for parsing it will be read a second time. If I would transfer the document over an tcp-connection, I only have the document once in my inputstream and after validation it would be consumed I think. But what can I parse then? Or did I missed a detail with the function of the SAX?
    Thank you for your help!
    Yours
    Christian

    static final String schemaSource = argv[0];
    static final String JAXP_SCHEMA_SOURCE =
    "http://java.sun.com/xml/jaxp/properties/schemaSource";
    DocumentBuilderFactory factory =
    DocumentBuilderFactory.newInstance();
    factory.setAttribute(JAXP_SCHEMA_SOURCE,
    new File(schemaSource));

  • Generating XML Document by giving Object as input

    Hi all,
       I have to give some object as input for generating XML Document.Basing on the data in the object the XML file has to be generated.
    Please give me your guidance in this issue.
    Thanks&Regards
    Madhu

    Madhu,
    You may:
    1. Generate XML Document manually with DOM API
    2. Use some complex lib like implementation of <a href="http://java.sun.com/webservices/jaxb/">JAXB</a> with ad-hoc control over format.
    3. Use some simple library like <a href="http://xstream.codehaus.org/">XStream</a> with minimal format control.
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • Urgetnt:Generate XML Document from Oracle Tables.

    Environment is :9i Release 2
    Requirement : Generate XML document from the data which is vailable in Oracle tables at client location.
    Could some body help me on how to get ahead on this.
    Thanks in advance,
    Kumar.

    Implimentation in PowerBuilder7(Source is experimental.. need optimization):
    kml_store = create datastore
    selectblob kml into :kml_result from (select get_kml(:querry_type,:tmp_querry_value,1) as kml from dual) using sqlca;
    if sqlca.sqlcode=100 then
    MessageBox("INFO","No data found");
    return false;
    end if
    if sqlca.sqlcode = -1 then
         MessageBox("INFO","Error in generating KMl file");
         return false
    end if
    li_FileNum = FileOpen("test.kml",StreamMode!, Write!, LockWrite!, Replace!);
    b_len=Len(kml_result)
    b_len=64244;
    /*inserting in file :)*/
    DO WHILE b_pos<=b_len
         s_pipe=String(BlobMid(kml_result,b_pos,i_str_len))
         ret = FileWrite(li_FileNum,s_pipe);
         s_pipe="";
         b_pos=b_pos+i_str_len;
    LOOP
    FileClose(li_FileNum);
    Message was edited by:
    user601564

  • Content of generated XML document to variable - Oracle ...

    Hello everybody,
    here is sample code which generates XML document:
    * This is a sample application program which is built using the
    * classes generated by the XML DTD Class Generator. The External DTD
    * File "Widl.dtd" or the XML document which "Widl.xml" which is compliant
    * to Widl.dtd is used to generate the classes. The application
    * SampleMain.java is used to generate the classes which takes the DTD
    * or XML document as input parameters to generate classes.
    import oracle.xml.classgen.CGNode;
    import oracle.xml.classgen.CGDocument;
    import oracle.xml.classgen.DTDClassGenerator;
    import oracle.xml.classgen.InvalidContentException;
    import oracle.xml.parser.v2.DTD;
    public class TestWidl
    public static void main (String args[])
    try
    WIDL w1 = new WIDL();
    DTD dtd = w1.getDTDNode();
    w1.setNAME("WIDL1");
    w1.setVERSION(WIDL.VERSION_1_0);
    SERVICE s1 = new SERVICE("Service1", "Service_URL");
    s1.setINPUT("File");
    s1.setOUTPUT("File");
    BINDING b1 = new BINDING("Binding1");
    b1.setTYPE(BINDING.TYPE_INPUT);
    BINDING b2 = new BINDING("Binding2");
    b2.setTYPE(BINDING.TYPE_OUTPUT);
    VARIABLE v1 = new VARIABLE("Variable1", VARIABLE.NULLOK_FALSE);
    v1.setTYPE(VARIABLE.TYPE_STRING);
    v1.setUSAGE(VARIABLE.USAGE_INTERNAL);
    v1.setVALUE("value");
    VARIABLE v2 = new VARIABLE("Variable2", VARIABLE.NULLOK_TRUE);
    v2.setTYPE(VARIABLE.TYPE_STRING1);
    v2.setUSAGE(VARIABLE.USAGE_HEADER);
    VARIABLE v3 = new VARIABLE("Variable3", VARIABLE.NULLOK_FALSE);
    v3.setTYPE(VARIABLE.TYPE_STRING2);
    v3.setUSAGE(VARIABLE.USAGE_FUNCTION);
    v3.setMASK("mask");
    CONDITION c1 = new CONDITION("CRef1", "CMatch1");
    c1.setSERVICE("Service1");
    c1.setTYPE(CONDITION.TYPE_SUCCESS);
    CONDITION c2 = new CONDITION("CRef2", "CMatch2");
    c2.setTYPE(CONDITION.TYPE_RETRY);
    CONDITION c3 = new CONDITION("CRef3", "CMatch3");
    c3.setSERVICE("Service3");
    c3.setTYPE(CONDITION.TYPE_FAILURE);
    REGION r1 = new REGION("Region1", "Start", "End");
    b1.addNode(r1);
    b1.addNode(v1);
    b1.addNode(c1);
    b1.addNode(v2);
    b2.addNode(c2);
    b2.addNode(v3);
    w1.addNode(s1);
    w1.addNode(b1);
    w1.addNode(b2);
    w1.validateContent();
    w1.print(System.out);
    catch (Exception e)
    System.out.println(e.toString());
    e.printStackTrace();
    I see the method w1.print(System.out) which shows content of xml to console. But how can I store xml to some String variable? Thank you in advance.
    Jan :)

    If there is a version of the "print" method that can write to a Writer, then:StringWriter sw = new StringWriter();
    w1.print(sw);
    String result = sw.toString();But if you can only write to an OutputStream then:ByteArrayOutputStream baos = new ByteArrayOutputStream();
    w1.print(baos);
    String result = new String(baos.toByteArray(), encoding);where "encoding" is a string containing the name of the encoding used to write the XML. Possibly you can control that via "w1.setENCODING(something)" or some other way.

  • Generic question about generating & saving XML

    I need to write a process that will generate an invoice as XML, then store this entire XML document in a CLOB. I will have multiple stored functions and/or procedures that build various sections of the invoice. The process needs to be flexible enough to allow new functions to be added and old ones removed at any time with little impact.
    My question is, what is the best way to implement this? Is it possible to use XSQL pages and use the <xsql:ref-cursor-function> to retrieve each function's data then insert this in a table after applying a style-sheet? I need something that is fairly efficient. Also, it needs to be compatible with an 8.1.6 database. I'm fairly new to all this Oracle XML stuff, so any additional pointers would be appreciated. Thanks.
    Shane

    one solution i can think of is to use SQLX operator instead of dbms_xmlgen.
    here is a sample example.
    declare
      l_xmltype xmltype;
      l_deptno  emp.deptno%type;
    begin
      for i in (select * from emp order by deptno)
      loop
        select xmlconcat(
                    xmlelement("ename", i.ename)
                   ,xmlelement("sal", i.sal)
                   ,xmlelement("detpno", i.deptno))
          into l_xmltype from dual;
        dbms_output.put_line(l_xmltype.GetClobVal());
      end loop;
    end;
    /Now here you can open the query once, keep writing to the file till the deptno
    is same, when the deptno changes, close the file and open a new file with new
    deptno and start writing.
    Note : in this way you will have to add the xmlprolog manually to each of the file which should not be an issue. after opening the file add the prolog string manually.
    Hope this helps.

  • New to XML, need to generate XML document

    I have an existing application that uses an Oracle 9.2.0.3 database. An existing PL/SQL procedure generates a flat file interface using UTL_FILE. My task is to upgrade this procedure to generate an XML file and transform this XML file into different outputs (e.g. flat file interface, PDF file which I plan to use XSL Formatting Objects). My question is how should I generate the XML document from the PL/SQL procedure? Should I use the Oracle 9i SQL/XML capabilities? specifically xmlelement, etc? An if so should I also use UTL_FILE to generate the XML file? Your help will be appreciated.

    Williams,
    Do you want to generate an XML file from the data present in relational tables using PL/SQL ?
    In that case you can use XML SQL Utility(XSU).
    For more information on XSU click [url http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96621/adx23xsp.htm#1008317]here.
    Regards,
    Anupama
    [url http://otn.oracle.com/sample_code/]OTN Sample Code

  • Miscellanous questions about BDB XML

    Hi !
    I'm in search for a storage solution for a Matlab app that manipulates big volumes of datas (several Gb), and so can't load them fully in memory without crashing. I also can't load / unload them each time I need a bit of these data, since it is rather long to load a file in memory (about 0.12s). So I was thinking about using a DMB like BDB XML, and I have a few questions about it :
    <ul><li>What about performances to create a 3-5Gb database in a single batch ?</li>
    <li>What about performances to excecute a XQuery request on a db this large ? Longer or shorter than loadin directly the file in memory ? With an index or without ?
    </li>
    <li> No matlab integration is provided, so I have to way : use Matlab C integration to make an interface to use BDB XML, or using the shell via an exec like command to interact with BDB ? Is the shell trick performant ? Or does it spend a lot of time parsing the input ?</li>
    </ul>
    Thanks for those who will take a bit of their precious time to answer my questions !

    Hello,
    I'm in search for a storage solution for a Matlab app that manipulates big volumes of datas (several Gb), and so can't load them fully in memory without crashing. I also can't load / unload them each time I need a bit of these data, since it is rather long to load a file in memory (about 0.12s). So I was thinking about using a DMB like BDB XML, and I have a few questions about it :
    <ul><li>What about performances to create a 3-5Gb database in a single batch ?</li>It will take a while. If you bulk load you should avoid using transactions and sync/exit the environment when you are done. Note that you should determine what indexes you might want/need before doing the load and create them. Reindexing 5GB of data will take another really large chunk of time. I recommend experimentation with indexes, queries and a small representative subset of the data.
    Be sure to create a node storage container with nodes indexed.
    Is this one document or many? Many is better. One 5Gb document is less than ideal but will work.
    <li>What about performances to excecute a XQuery request on a db this large ? Longer or shorter than loadin directly the file in memory ? With an index or without ?You really need indexes. The query will likely succeed without indexes but depending on the query and the data could take a very long time. See above on experimentation first.
    </li>
    <li> No matlab integration is provided, so I have to way : use Matlab C integration to make an interface to use BDB XML, or using the shell via an exec like command to interact with BDB ? Is the shell trick performant ? Or does it spend a lot of time parsing the input ?</li>There is no C interface, just C++. I would not recommend using the dbxml shell for this although you could if you really need to.
    Let the group know how this turns out.
    Regards,
    George

  • Question about validating xml against schema

    Hi,
    I am new to JAXP. I try to validating a xml against a schema. I wrote following code:
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespace(true);
    spf.setValidating(true);
    SAXParser sp = spf.newSAXParser();
    sp.setProperty("http://java.sun.com/xml/properties/jaxp/schemaLanguage",
    "http://www.w3.org/2001/XMLSchema");
    sp.setProperty("http://java.sun.com/xml/properties/jaxp/schemaSource",
    "mySchema.xsd") ;
    sp.parse(<XML Document>, <ContentHandler);
    but when compile, it has error: can't resolve ""http://java.sun.com/xml/properties/jaxp/schemaLanguage", and
    "http://java.sun.com/xml/properties/jaxp/schemaSource".
    It seems it didn't support above two property.
    I saw some code in forum is:
    fact.setFeature("http://xml.org/sax/features/validation", true);
    fact.setFeature("http://apache.org/xml/features/validation/schema",true);
    fact.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
    SAXParser sp = fact.newSAXParser();
    sp.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",schemas);
    Why sun tutorial use property:http://java.sun.com/xml/properties/jaxp/schemaLanguage
    and someone use:http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation
    where to get information about setting properties for SAXParserFactory?
    Thanks

    In the past, ColdFusion's XML validation mechanism seems to have had issues with schemas that contain imports, e.g., http://forums.adobe.com/message/155906. Have these issues still not been resolved?
    Do you not think that perhaps you're answering your own question here?
    I don't see an issue about this on the bug tracker.  It might be an idea if you can get a simple, stand-alone repro case together and raise an issue (and post the reference back here and against that other thread so people know to vote for it).  If you post the repro case here too, it would be helpful.
    Adam

  • Generating XML document

    Hello, All!
    I have some questions about XML in Oracle 9.2
    For examle, I have a query such as:
    select to_clob(
    ((XMLElement("MSG" , XMLAttributes('EXPOPR' as "FORMAT",
         '1' as "SENDER",
                             '2' as "RECIPIENT",
                             to_char(SYSDATE, 'YYYY.MM.DD HH24:MI:SS') as "TIME"
         ))) msg
    from dual
    MSG
    <MSG FORMAT="EXPOPR" SENDER="1" RECIPIENT="2" TIME="2004.10.04 10:23:16"></MSG>
    1) How I can get a full XML document from this result (add <?xml version ...> tag)? I know about SYS_XMLGen, but this function will add a <ROW> tag into XML, but I don't need this...
    Also, I can use concatenation of strings, but it is not interestring for me...
    2) How I can get the string without enclose tag </MSG>:
    <MSG FORMAT="EXPOPR" SENDER="1" RECIPIENT="2"
    TIME="2004.10.04 10:23:16" />
    Thank for help.

    There is a new function XMLRoot that will be released as part of 10gR2 for this. In the mean time string concatenation is the only solution..
    The following works in 10gR1
    create or replace function XMLROOT (XML XMLType,
    target varchar2 default NULL,
    data varchar2 default NULL,
    CHARSET varchar2 default 'UTF-8')
    return XMLType deterministic
    is
    tempCLOB clob;
    tempXML XMLtype;
    PI VARCHAR2(256);
    begin
    PI := '<?' || target || ' ' || data || '?>';
    select xmlparse(DOCUMENT '<?xml version="1.0" encoding="UTF-8"?>' || PI || XML.getClobVal() WELLFORMED)
    into tempXML
    from dual;
    return tempXML;
    end;
    In 9.2 it would need to be something like this
    create or replace function XMLROOT (XML XMLType,
    target varchar2 default NULL,
    data varchar2 default NULL,
    CHARSET varchar2 default 'UTF-8')
    return XMLType deterministic
    is
    tempCLOB clob;
    tempXML XMLtype;
    PI VARCHAR2(256);
    begin
    PI := '<?' || target || ' ' || data || '?>';
    select xmltype('<?xml version="1.0" encoding="UTF-8"?>' || PI || XML.getClobVal(),0,1,1)
    into tempXML
    from dual;
    return tempXML;
    end;
    /

  • Inserting PI into generated XML document

    Can anyone tell me how to insert processing instructions into an XML document generated using the xmlcg generated classes? I understand that I can create a PI using the Document::createProcessingInstruction() method but how do I add it as a sibling to the root element? Any insight in this regard will be really appreciated.

    Your question is not very clear.
    Do you want to know How to insert an element into an XML document?
    Answer: I can see you already know how to do it. You have added the element using addContent()
    or do you want to know How to display the XML in a tidy format?
    Answer: to view the XML in a properly formatted style you can you the Format class. A very basic way of viewing the XML would be:
       * Prints the Document to the specified file.
       * @param doc
       * @param filename
       * @param formatting
      public static void printDocToFile(Document doc, String strFileName,
          boolean formatting)
        XMLOutputter xmlOut = null;
        if (!formatting)
          xmlOut = new XMLOutputter();
        } else
          Format prettyFormat = Format.getPrettyFormat();
          prettyFormat.setOmitEncoding(false);
          prettyFormat.setOmitDeclaration(false);
          xmlOut = new XMLOutputter(prettyFormat);
        try
          if (doc != null)
            FileWriter writer = new java.io.FileWriter(strFileName, true);
            xmlOut.output(doc, writer);
            writer.flush();
            writer.close();
          } else
            System.out.println("Document is null.");
        catch (Exception ex)
          System.out.println(ex);
      }

  • Can not generate XML Document Template

    I have the below class
    public class MyHome implements Serializable {
    ArrayList rooms;
    //getter/setter methods here
    When I right click mouse and select "Generate XML Template Document", I got the error
    Some fields could not be generated to the XML template
    c:\e200\dv900\java\classes\java\util\ArrayList.class (The system cannot find the path specified)
    Do you have any idea?

    Not with the info given...
    Which jdev version?
    Where do I find this menu, as I don't see it?
    Timo

  • Where I could get more detail information about generating xml files

    Hi Tim
    I am a oracle employee. Our project try to use XML Publisher to generate XML files. But there is so little information about this in the XML Publihser Developer Guide.
    It is that any more detail java examples about how to generate xml files using XML publisher. Or some detail java API.
    XML Publisher use which method to generate the xml files?
    Thank you very much!!

    The easiest way is to create an oracle report, switch the output to xml and format using XML publisher. That has worked well for us in most cases.
    Good luck,
    Brett

  • Question about DOM XML

    Hi Experts
    Do you Know how can I write I DOM XML
    the header of file I Mean
    <?xml version="1.0" encoding="iso-8859-8"?>
    Regards
    Yossi

    hi,
    say u have xml with following structure
    <xml>
    <Age>xyz</Age>
    </xml>
    to append age node, parse the xml string or file and try the following code
    HERE DOM is used
    Document xmlDoc = wdThis.ParseFile(xmlString);
    Node root=xmlDoc.getDocumentElement();
    Node AgeNode = xmlDoc.createElement("Age");
    Node AgeTextNode = xmlDoc.createTextNode("25");
    AgeNode.appendChild(AgeTextNode);
    root.appendChild(AgeNode);
    following code to parse the xml string
    public org.w3c.dom.Document mParseFile( java.lang.String XmlString )
    //@@begin mParseFile()
    //pearse the xml string passed
    IWDMessageManager mesg = wdComponentAPI.getMessageManager();
    String l_method = "mParseFile";
    //parsing xml string to xml document
    ByteArrayInputStream l_xmlDataInputStream = new ByteArrayInputStream(p_XmlString.getBytes());
    Document l_doc = null;
    InputSource in = new InputSource((InputStream) l_xmlDataInputStream );
    DocumentBuilderFactory l_dbf = DocumentBuilderFactory.newInstance();
    l_dbf.setValidating(true);
    l_dbf.setNamespaceAware(true);
    DocumentBuilder l_db;
    try {
    l_db = l_dbf.newDocumentBuilder();
    l_doc = l_db.parse(in);
    catch (ParserConfigurationException e) {
    } catch (SAXException e) {
    } catch (IOException e) {
    //returns xml document
    return l_doc;

Maybe you are looking for