Creating XML doc from DTD using jDOM

Hi...
I want to create empty XML Document from the DTD using JDOM or JAXP & then want to populate that xml document with the values from the database.
The problem is :-
     How can we create an XML document by simply reading the DTD using JDOM or JAXP.?
or
first of all how am i going to parse the DTD from jDOM or JAXp & then how will i create the empty XML Document from it..?
Please revert back soon... & thanx in advance for helping..
regards
Shoorya

Yes i've also got teh same problem this day...
Can somone help us ?
Thanks
Math

Similar Messages

  • Generete xml doc with dtd form

    Hi,
    I am trying to generate xml doc based on dtd kind format.
    I use following code to get my xml doc is ok based on dtd like
    -----------dtd file---------------
    <!ELEMENT client_data (client_job*, person*)>
    <!ELEMENT client_job (job_cd, job_title?, primary_responsibilities?, grade_cd?, br_job_cd, eeo_job_group_id, effective_date?, end_date?)>
    <!ATTLIST client_job errMsg CDATA #IMPLIED>
    <!ATTLIST client_job deleteFlag ( Y | N ) 'N'>
    <!ELEMENT job_cd (#PCDATA)>
    <!ELEMENT job_title (#PCDATA)>
    <!ELEMENT primary_responsibilities (#PCDATA)>
    <!ELEMENT br_job_cd (#PCDATA)>
    <!ELEMENT eeo_job_group_id (#PCDATA)>
    -----------------end dtd--------------
    OracleXMLQuery qry = new OracleXMLQuery(conn, sql);
    qry.setRowsetTag("client_data");
    qry.setRowIdAttrName(null);
    // qry.useNullAttributeIndicator(true);
    qry.useLowerCaseTagNames();
    qry.setRowTag("client_job");
    xmlDocToReturn = qry.getXMLDOM();
    But if my dtd like following, i.g. has tree level, and data from multiple tables, the above code doesn't work for thes case
    --------------tree level dtd----------------
    <!ELEMENT person (person_name)>
    <!ATTLIST person person_id CDATA #REQUIRED>
    <!ATTLIST person hire_date CDATA #IMPLIED>
    <!ATTLIST person effective_date CDATA #IMPLIED>
    <!ATTLIST person end_date CDATA #IMPLIED>
    <!ELEMENT person_name (formatted_name*, given_name*, prefered_given_name?, middle_name?, family_name*, affix*)>
    <!ELEMENT formatted_name EMPTY>
    <!ATTLIST formatted_name type ( presentation | legal | sortOrder) 'presentation'>
    <!ELEMENT given_name (#PCDATA)>
    <!ELEMENT prefered_given_name (#PCDATA)>
    <!ELEMENT middle_name (#PCDATA)>
    <!ELEMENT family_name (#PCDATA)>
    <!ATTLIST family_name primary ( true | false | undefined ) 'undefined'>
    -----------------end dtd -------------------
    I try to use XMLDocumentFragment to create xml doc and appendChild , but the xml doc is not the format of the dtd required. Can you give me a Java sample?
    Thanks in advance.
    Yan

    Why don't you use XSLT?

  • 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

  • Creating xml complience for dtd

    Hi,
               i have a pdf with forms data, and a dtd.
               In pdf we have a button which has to create xml file with forms data on click action of that button.
               And in that main thing is to create xml file in complience with dtd. means i want create xml complience for dtd
              how to do that using java script(i dont want to use adobe life cycle designer).
    Any help would be highly appreciated.

    Have you read the Acrobat javaScript documentation?  What did you find there that you didn't understand that is preventing you from accomplishing this goal?

  • Create XML file from ABAP with SOAP Details

    Hi,
    I am new to XML and I am not familiar with JAVA or Web Service. I have searched in SDN and googled for a sample program for creating XML document from ABAP with SOAP details. Unfortunately I couldn't find anything.
    I have a requirement for creating an XML file from ABAP with SOAP details. I have the data in the internal table. There is a Schema which the client provided and the file generated from SAP should be validating against that Schema. Schema contains SOAP details like Envelope, Header & Body.
    My question is can I generate the XML file using CALL TRANSFORMATION in SAP with the SOAP details?
    I have tried to create Transformation (Transaction XSLT_TOOL) in SAP with below code. Also in CALL transformation I am not able to change the encoding to UTF-8. It's always show UTF-16.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:template match="/">
        <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
          <SOAP:Header>
            <CUNS:HeaderInfo>
              <CUNS:InterfaceTypeId>10006</InterfaceTypeId>
              <CUNS:BusinessPartnerID>11223344</BusinessPartnerID>
              <CUNS:SchemaVersion>1.0</SchemaVersion>
              <CUNS:DateTime>sy-datum</DateTime>
            </CUNS:HeaderInfo>
          </SOAP:Header>
          <SOAP:Body>
            <xsl:copy-of select="*"/>
          </SOAP:Body>
        </SOAP:Envelope>
      </xsl:template>
    </xsl:transform>
    In ABAP program, I have written below code for calling above Transformation.
      call transformation ('Z_ID')
           source tab = im_t_output[]
           result xml xml_out.
      call function 'SCMS_STRING_TO_FTEXT'
        exporting
          text      = xml_out
        tables
          ftext_tab = ex_t_xml_data.
    Please help me how to generate XML file with SOAP details from ABAP. If anybody have a sample program, please share with me.
    Is there any easy way to create the XML file in CALL Transformation. Please help.
    Thanks

    Try ABAP forum, as it seems not to be PI related.

  • Creating XML file from Java Bean

    Hi
    Are there any standard methods in Java 1.5 to create XML file from java bean,
    i can use JAXB or castor to do so,
    But i would like to know if there is any thing in java core classes,
    I have seen XMLEncoder, but this is not what i want.
    Any ideas
    Ashish

    Marshall JavaBean to an XML document with JAXB or XMLBeans.

  • Help in creating XML documents in ABAP using XI in new version ECC6.0

    Hello All:
       I am pretty comfortable with XML and XSLT but new to XI. Is there a way of creating XML documents in ABAP using XI in new version ECC6.0? Please provide me with any links or any information you may have. All the answers will be rewarded.
    Thanks.
    Mithun

    hi,
    U cant create XML data in ABAP.
    to send the data to the XI, u have to use the IDOC or RFC FM, from there IDOC or RFC adapters will read the data in the same  format  and these adapters will convert the data in to  XML .Bcoz XI understand only XML data.
    from there XI will process and route them to Destination, by using anthor adapter.
    here u can use file adapter if u want data in file foramat from the IDOC or RFC .
    So XI is the integration tool only.
    reward points if helpful
    ragards
    sreeni

  • Create XML docs with hierarchy of tags and attr defined in databaste tables

    Hi,
    My problem is a little unique one. I want the ability to define the structure of the XML document (i.e. the hierarchy of element tags and attribute names) in the database tables. The values of tags and attributes will also be populated at runtime in tables.
    Then write some generic API that reads the structure of the XML document through the database tables and spits out an XML document based on this structure and values stored in the tables.
    So, basically, I want the tag names and values both to be values in the database rather than the tag names being the columns in database tables.
    With this I should be able to have one procedure/function that can serve the purpose of creating XML documents with different structures by just specifying that structure in the form of database tables.
    Almost all the Oracle XML utilities I read about, create XML docs based on a SQL query with tag names being columns in the database tables. Any help will be highly appreciated.
    Thanks,
    Monika

    Which database release are you using...
    The computed constructors feature of XQuery may help.
    -Mark

  • CREATE XML PUBLISHER REPORT WITHOUT USING RDF

    Hi Every one ,
    Can anybody share his/her expertise on following issue ?
    "How to create XML Publisher Report without using RDF?"
    Your help is appreciated.

    Hi Swapnesh
    YOu do not need to create the XDODTEXE, its seeded for you. You need to do the following:
    1. Create and test the data template
    2. Load the data template to the template manager against a data definition
    3. Create a concurrent program definition that uses the XDODTEXE as its executable
    4. Create parameters (if required) for the CP and DT that match in name
    You're done
    Regards
    Tim

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • Create a PDF from webpage using entire site option doesn't works

    OK, guys, this is the problem...
    After YEARS of testing from Acrpbat 4 thru 9 on Create a PDF from webpage using entire site option... it doesn't works properly and doesn't got the entire site. ALWAYS get an error of memory or any other error but FINALLY you NEVER got the entire site. I'm talking for a big website... not like amazon.com, but a big one.
    I make a walkarround to try to capture the website in parts but Acrobat is not "intelligent" to make a resume capture of the site, because ALWAYS start from the begining instead from the resume position of the site...
    My question is, HOW can get the ENTIRE SITE in a PDF document... without getting errors or stopping the capture process...
    Don't have problem of low RAM memory because I'm in a MONSTER MACINTOSH.... 3.2 GHZ with 8 Core and 32 GB of RAM under Mac OS X Leopard 10.5.6 in Acrobat 9 Pro.
    If I'm not wrong, the GET ENTIRE SITE option in Web Capture (Create a PDF from webpage using entire site option) doesn't works from Acrobat 4 thru 9 in Pro version... tested, you'll never got the entire site... I'm talking in capture a huge entire site and not a little one...
    Can someone help me?
    Thanks.

    Ok so I go to a web page and select something to print. Once I've clicked print I switch over from printer/micosoft xps docu writer/fax and select Adobe PDF. All goes through with a 'Create Adobe PDF' coming up progressing through to eventually save and store. Once I open the file it end up as the picture above. I have the same version on another computer and that works fine but this particular Sony laptop it doesn't seem to work properly. 

  • How to create chord charts from midi using logic pro x

    How to create chord charts from midi using logic pro x

    Depending on what you mean by Chord charts (Tabs?)
    Use the Score.......
    http://help.apple.com/logicpro/mac/10/#lgcpf755d649

  • Convert XML file into DTD using Java

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

  • BUG:  Advanced Actions duplicated when creating NEW PROJECTS FROM TEMPLATE using Adobe Captivate 8.

    Need:  CREATE NEW PROJECTS FROM TEMPLATE using Adobe Captivate 8. 
    Problem:  NEW PROJECT (.cptx) duplicates the Advanced Actions originally configured within TEMPLATE FILE (.cpt.).
    For example: Template file (.cptl) advanced action "_initializeModule" gets duplicated as "_initializeModule1", "_initializeModule2", "_initializeModule3" within NEW PROJECT.  FYI, the original "_initializeModule" advanced action still appears.
    MAJOR BUG, what the heck is going on?!?!!!  Planning to deploy this template file to use for multiple courses with multiple users, this WILL cause epic confusion across the board.

    Similar problem, think they are working on it as well: when dragging a shared action from an external library to a slide or object event, and that action is using a parameter that was already created for another shared action, there will be a new parameter created which really screws up the shared action contrary to this problem. Tip: for the moment do not drag shared actions from an external library immediately to an event, but drag them first to the Library: Reuse Shared Actions in other Projects - Captivate 7 vs. 8 - Captivate blog

  • Create Oracle tables from DTD

    Hi,
    are there any tools to create oracle tables from dtd's

    None to my knowledge. DTD's don't provide any data type information or length information on the data, so at best such a tool could create you tons of VARCHAR2(4000) columns.

Maybe you are looking for