How to Create an XML document from XSQL servlet which follows a particular DTD struct

how to Create an XML document from XSQL servlet which follows a particular DTD structure.Could anyone send me a sample code for this.

You'll need to associate an XSLT transformation with your XSQL page that transforms the canonical result into your DTD-valid format.
For example, given an XSQL page like:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="rss.xsl" ?>
<xsql:query max-rows="3" connection="demo" xmlns:xsql="urn:oracle-xsql">
select title,id,description,url,to_char(timestamp,'Mon DD') timestamp
from site_entry
order by id desc
</xsql:query>and an "rss.xsl" stylesheet that looks like this:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" doctype-system="rss-0.91.dtd"/>
<xsl:template match="/">
<xsl:for-each select="ROWSET/ROW">
<rss version="0.91">
<channel>
<title>Do You XML?</title>
<link>http://xml.us.oracle.com</link>
<description>Oracle XML Website Demo</description>
<language>en-us</language>
<xsl:for-each select="ITEM">
<item>
<title><xsl:value-of select="TITLE"/></title>
<link><xsl:value-of select="URL"/></link>
<description><xsl:value-of select="DESCRIPTION"/></description>
</item>
</xsl:for-each>
</channel>
</rss>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>You produce DTD-valid output against the rss-0.91.dtd DTD that looks like:
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE rss SYSTEM "rss-0.91.dtd">
<rss version="0.91">
<channel>
<title>Do You XML?</title>
<link>http://xml.us.oracle.com</link>
<description>Oracle XML Website Demo</description>
<language>en-us</language>
</channel>
</rss>
<rss version="0.91">
<channel>
<title>Do You XML?</title>
<link>http://xml.us.oracle.com</link>
<description>Oracle XML Website Demo</description>
<language>en-us</language>
</channel>
</rss>
<rss version="0.91">
<channel>
<title>Do You XML?</title>
<link>http://xml.us.oracle.com</link>
<description>Oracle XML Website Demo</description>
<language>en-us</language>
</channel>
</rss>

Similar Messages

  • How to create an XML document from a String.

    Can anyone help,
         In the Microsoft XML Document DOM there is a load function load(string) which will create an XML document, but now we are switching to Java and I do not know how to create and XML document from a string, this string �xml document� is passed to my program from a webservice and I need to read several xml elements form it in a web server.
    This string is a well formatted XML document:
    <?xml version="1.0" encoding="UTF-8"?>
    <Countries NumberOfRecords="1" LanguageID="en-us">
         <Country>
              <CountryCode>AU</CountryCode>
              <CountryName>AUSTRALIA</CountryName>
         </Country>
    </Countries>

    Thanks PC!
    I made it work using:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    factory.setIgnoringComments(true); // We want to ignore comments
    // Now use the factory to create a DOM parser
    DocumentBuilder parser = factory.newDocumentBuilder();
    //TransformThisStringBuffer is a string buffer wich contain the 'XML document (String)'
    InputStream in = new ByteArrayInputStream(TransformThisStringBuffer.toString().getBytes());
    // Parse the InputStream and build the document
    Document document = parser.parse(in);
    But which one is faster InputSource or InputStream, were would you put the "new InputSource(new StringReader(yourString))" in the above code?

  • Create an XML document from a HTML form???

    Good morning, is it possible to create an XML document from a HTML form
    if yes, can someone tell me how to proceed exactely, I would be very thankful!

    Hi,
    A very simple intro at this link. Apologies for anything unclear.
    http://cswww.essex.ac.uk/TechnicalGroup/TechnicalHelp/xmlCreate.htm
    best
    kev

  • How can I access xml document from javascript whithin a JSP page

    how can I access xml document from javascript whithin a JSP page?
    I have a JSP that receives an XML document from a JavaBean, so I can access it within the entire JSP, but I need to access it from the javascript inside the JSP... and I have no idea how i can do this.
    Thanks in advance!

    The solution would only work on MS IE browsers, as other browsers do not support an XML DOM.
    It can be done, but you would be stuck with using the Microsoft broswer. If that is acceptable, I have some example code, and a book recommendation.

  • How to use java to create an XML document from an SQL database?

    Hi,
    I'm a complete novice at XML and have only recently started programming in Java.
    I'm currently trying to develop a package in Java 1.1.8 which requires a set of very specifically formatted XML documents. These documents would need to be updated regularly by people with no knowledge of Java and I would like to make it as simple as possible.
    Since the data will already be in an SQL database, I thought it might be possible to generate the XML documents from the data using a small Java application, but I'm not too sure how to go about this or if this is even possible! Any help or pointers in the right direction would be very much appreciated.
    Louise

    Do you have the option of upgrading to a newer version of the JDK?
    JAXB does what you are wanting very easily. Also there are tools if you don't want to write your own. JAXB is available as early release on Sun's site as is the newest JDK. Otherwise, you have to design a factory and interface that will do this for you (which is what JAXB basically is in a very simplified view).

  • How to create an XML file from scratch ?

    Hi all,
    I'm afraid that I will seem dummy, but I think I really misunderstand something or I'm trying to do something that is not possible...
    I would like to create a XML file containing the following:<?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="pl.xsl"?>
    <!DOCTYPE playlist SYSTEM "pl.dtd">
    <playlist id="2">
    </playlist>I really need to have both the stylesheet and the DOCTYPE declarations... Does anyone know if this is possible ?
    To create the XML Document, I am using the DocumentBuilder object from javax.xml package (jaxp-1.2-ea2). I think this, at least, is correct.
    To print out the XML document I have tried to use :
    - the Transformer from javax.xml package (jaxp-1.2-ea2) but I could obtain only the DOCTYPE declaration.
    - the Serializer from Xerces parser (version 2.0.1) to print out the Document I am creating with the jaxp, but I was able only to obtain the stylesheet declaration...
    So far I have just understand that there is a difference between Serializer and Transformer (one is serializing, and the other is transforming ;-)), but I couldn't figure out which one would be suitable to produce the XML file above...
    I would really appreciate if one could help me with that ;-)
    Thanks,
    Karau

    Could send me an example ?
    For the moment I am using Transformer in that way:
         TransformerFactory tfactory = TransformerFactory.newInstance();
         try {
             Transformer transformer = tfactory.newTransformer();
             DOMSource source = new DOMSource(playlistDoc.getDocumentElement());
             StreamResult res = new StreamResult(new File(path));
             transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, PL_DTD);
             transformer.setOutputProperty(OutputKeys.INDENT, "yes");
             transformer.transform(source, res);
         catch (TransformerConfigurationException tce) {
             throw tce;
         catch (TransformerException te) {
             throw te;
         }

  • Creating an XML document from a DTD in Java

    Hi All,
    I need help on the following requirement very badly. Pls help me.
    I have a requirement to implement with java and XML. I am quit new to XML.Can any of you pls help me.
    I have a DTD file. I need to generate XML document from it using java code. I have to use DTD as a template to generate my XML document.
    After going through WEB sites, I understtod that, we have to user Java API JAXB for my requirement. But I could not find JAXB.jar anywhere.
    I need to know the following inforamtion ....
    1. Is my understanding of using JAXB for my requirement is correct?
    2. Where can I get JAXB.jar?
    3. What are the steps to create XML document from a DTD in Java?
    If can give me a sample code for this would help me a lot.
    Pls pls reply me. Your help is greatly appreciated.
    Thanks in Advance.
    Regards,
    Gayathri.

    hi Gayathri,
    iam currently working in the same field.
    firs download jaxb from this link:
    http://java.sun.com/xml/downloads/jaxb.html
    first u need to marshall it.
    cheers
    shashi

  • How can we forward XML document from Routing Engine to Mapviwer!!!

    Does anyone try to forward XML document from routing engine to Mapviwer. Like spatial coordinate system from Routing engine. Could you help me how to accomplish this problem. Thank much much....

    Just open an HTTP connection to MapViewer's server url (ususally http://host:port/mapviewer/omserver) and send an XML map request to it using POST. You can do that from any language that supports such a connection.
    Inside the xml map request you can attach the routing result (a series of coordinates i imagine) as dynamic geo-features. You can also specify any base map/layer information in the xml map req provided you have defined such map/themes. DTD of mapviewer's map req is in the Users Guide, which is on OTN site mapviewer http://otn.oracle.com/products/mapviewer.

  • Create single XML document from multiple queries

    hi all!
    being a new programmer in XML world,my question might sound a bit stupid but your answers would mean a world to me. i have to generate a single XML document from my database by querying more than one table. for example i have 3 tables i.e HR_EMP_NAME, HR_PRODUCTS_DETAIL, HR_PAYROLL_SUMMARY. all three tables have completely different columns except one ID column which is a foreign kay from HR_MASTER_LIST. i want to get any insert operation on these tables as a single document. so far as i have studied, one option is to generate XMLDoc using XSU and then add child nodes using JAXP but i am ot geting the logic right.
    please do reply.
    thanks a lot
    usman

    This is an SQL/XML based answer so how much it helps you is hard to say, but it would be one option. You can have the SQL statement build the XML for you as shown by this simple example.
    SELECT XMLElement("root",
              XMLForest(emp.dummy AS "emp_name",
                        prod.dummy AS "prod_lvl",
                        pay.dummy AS "pay_scale"))
      FROM dual emp,
           dual prod,
           dual pay
    WHERE emp.dummy = prod.dummy
      AND emp.dummy = pay.dummy;which produces (formatted for human readability)
    <root>
      <emp_name>X</emp_name>
      <prod_lvl>X</prod_lvl>
      <pay_scale>X</pay_scale>
    </root>Whether that works with what you are trying to do via Java you will have to decide.

  • How to create a XML document

    Hi,
    I am new to XML and don't understand when to use what.
    I have a java.sql.ResultSet and wants do create a XML document.
    When should I use the following methods ?
    - createElement
    - createAttribute
    - createCDATASection
    - createTextNode
    I think I have to create at least a "root" element, right ?
    Should every column in my resultset be an element and its value an attribute ?
    When should I use CDATA and Text ?
    Please explain this to me.
    Regards Uffe

    Hi,
    Use CDATA sections when you know the string will include some funny characters e.g. ?,<,> etc.
    You can decide yourself whether to create an attribute or a separate element.
    e.g. <book isbn="1234">The Spice Girls</book>
    or
    <book>The Spice Girls
    <isbn>1234</isbn>
    </book>
    I do not know about you, but I like the first better, using attributes.
    It is up to individual preference, but it all depends what you intend to do with the data. At the moment, there is little understanding of how to map a/some xml files to a database type relation.
    Many people are trying to force XML documents into relational database schemas, soem use object-oriented databasese.
    Another suggestion is to treat the whole internet as a big web-site.
    Who knows what is the next big decision, I do not think even the experts know! So, what do you think, your thoughts in this are as important as everybody elses.
    best
    kev

  • Creating an xml document from filenames of selected files

    Hey guys, I am totally new to automator and applescript so please be kind!
    I have an xml/flash image portfolio website which has image galleries. Each gallery has an xml document which specifies a thumbnail and full size photo to be displayed in the gallery. If I want to make a new gallery I have to make a new xml document and enter all the filenames of the images I want to display in the gallery. ( I guess you can see where this is going).
    This is fine if I have 10 images in the gallery but if I want to make a gallery with 350 images in then it could get pretty tedious.
    What I would love to be able to do is select a group of images and then have a script or automator action that can copy the files names and create a new gallery xml document containing the relevant code with all the files names. Ideally then saving the gallery with a sequential filename.
    Tying this into the new contextual services menu in snow leopard would really make the task incredibly easy.
    Is this possible? I'm not scared of learning how to do this therefore some pointers in the right direction would be great.
    Thanks,
    Chris

    Thanks Camalot,
    I was just thinking of selecting images from the finder but if this could be integrated into Aperture's export dialog that would be even better.
    this is the xml:
    <?xml version="1.0" encoding="utf-8"?>
    <gallery thumbwidth="220" thumbheight="138" columns="3" gap="4">
    <item>
    <ID>1</ID>
    <title><![CDATA[Title 1]]></title>
    <desc><![CDATA[This is description 1. <font color="#0099CC">This is a colourful text. </font> This is a <a href="http://www.flashden.net/user/iceonflames">link</a>. <i>This is italic text.</i> <b>This is bold text.</b> <b><i>This is bold italic text.</i></b> This text is styled by a CSS document.<br/><br/>]]></desc>
    <thumb>images/thumbs/7.jpg</thumb>
    <image>images/big/7.jpg</image>
    </item>
    <item>
    <ID>2</ID>
    <thumb>images/thumbs/8.jpg</thumb>
    <image>images/big/8.jpg</image>
    </item>
    <item>
    <ID>3</ID>
    <title><![CDATA[Title 3]]></title>
    <desc><![CDATA[This is description 3. <font color="#0099CC">This is a colourful text. </font> This is a <a href="http://www.flashden.net/user/iceonflames">link</a>. <i>This is italic text.</i> <b>This is bold text.</b> <b><i>This is bold italic text.</i></b> This text is styled by a CSS document.<br/><br/>]]></desc>
    <thumb>images/thumbs/9.jpg</thumb>
    <image>images/big/9.jpg</image>
    </item>
    </gallery>

  • How to create an Xml File From DataBase?

    hi all
    i have two tables from my database :
    VoucherHeader and VoucherItem
     VoucherHeader has 4 fields:
    VoucherHeaderId
    bigint Unchecked
    VoucherNum bigint
    Unchecked
    VoucherDate nvarchar(50)
    Unchecked
    Comment nvarchar(50)
    Unchecked
    VoucherItem has 8 fields :
    VoucherItem bigint
    Unchecked
    VoucherHeaderRef
    bigint Unchecked
    Row bigint
    Unchecked
    Code1 bigint
    Unchecked
    Code2 bigint
    Unchecked
    ItemComment nvarchar(50)
    Unchecked
    Debit bigint
    Unchecked
    Credit bigint
    Unchecked
    and i fill datatable by this codes:
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.VoucherItemTableAdapter.Fill(Me.DataSet1.VoucherItem)
    Me.VoucherHeaderTableAdapter.Fill(Me.DataSet1.VoucherHeader)
    End Sub
    now i see this result:
    how to send data into an Xml File From DataGridView Header and Item?
    please help me
    thanks all.
    Name of Allah, Most Gracious, Most Merciful and He created the human

    One instruction.  But you do it from the dataset, not the DataGridView
    Me.DataSet1.WriteXml(FILENAME)
    There is a WriteXML method for a DataTable but it gives errors.  Since you dataset has two tables save bot into the same xml file.
    jdweng

  • How to generate an XML Document from XQuery

    The following query returns me the required XML output. However, I need to generate an XML Document out of it. How do I go about generating an XML Doc?.
    SELECT XMLQuery('<Data>
    {for $tert in ora:view("DATA"),
               $tert_audit in ora:view("DATA_AUDIT")
           let $tert_cmd_id := $tert/ROW/ID/text(),
               $tert_spouse_name := $tert/ROW/SPOUSE_NAME/text(),
               $tert_directions := $tert/ROW/DIRECTIONS/text(),
               $tert_soil_zone := $tert/ROW/SOIL_ZONE/text(),
               $tert_audit_cmd_id := $tert_audit/ROW/ID/text(),
               $tert_audit_trans_date := $tert_audit/ROW/TRANSACTION_DATE/text()
               where $tert_cmd_id = $tert_audit_cmd_id and
               $tert_audit_trans_date >= xs:date(V_Last_Successful_Date)
               order by $tert_cmd_id
           return
           <op>
             <op_type>I</op_type>
             <ent_id>{$tert_cmd_id}</ent_id>
    <source>S</source>
    <fg>
    <val_flds>
    <fld>
    <id>spouse_name</id>
    <val>{$tert_spouse_name}</val>
    </fld>
    <fld>
    <id>directions</id>
    <val>{$tert_directions}</val>
    </fld>
    <fld>
    <id>soil_zone</id>
    <val>{$tert_soil_zone}</val>
    </fld>
    </val_flds>
    </fg>
    </op>}</Data>' RETURNING CONTENT)
    INTO V_Other_Insert
    FROM dual;

    Hi Geoff,
    I would like to generate an XML file which contains data as shown below:
    <Insert>
    <result>
    <type>A</type>
    <id>1</id>
    <date>11/11/2006</date>
    <source>Web</source>
    </result>
    </Insert>
    I'm using the below given query for this purpose:
    SELECT XMLQuery('<Insert>
    {for $c in ora:view("TableA")
           let $id := $c/ROW/ID/text(),
               $code := $c/ROW/CODE/text(),
               $type := $c/ROW/TYPE/text(),
               $date := $c/ROW/DATE/text()
           return
           <result>
             <type>{$type }</type>
    <id>{$id}</id>
    <date>{$date}</date>
    <source>S</source>
    </result> }</Insert>' RETURNING CONTENT)
    INTO V_Insert
    FROM dual;
    V_Insert stores the required result.
    How do I save this result to a XML Document?
    Please help.

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

  • How to create a xml file from the jsp page?

    I'm a beginner of the develop xml,my question like this,
    there has a jsp page,some parameters in it,I wanna get the parameters and create a xml file,so,what parser method should I use?
    And how to create a new xml file,when the file haven't exist at first?
    pls give some code,thanks.

    a ggod link for u http://www.theserverside.com/resources/article.jsp?l=JSP-XML2

Maybe you are looking for

  • Trying to set up home share on G4s and G5s No Luck

    Hi I recently installed Leopard and updated it all the way to 10.5.8. On A Power Mac G5, G4 Mac Mini 1.25 with 1 gig ram, and Powerbook G4 1.25, 15 inch with 2 GB ram. I have success on the same network with my new mac Mini dual I7 with 16 GB ram. Bu

  • Problems with Nvidia GeForce 210 and windows 8.1

    Hi all, I have Windows 8.1 Pro update 1 64bit installed, two weeks ago I started giving problems graphics card NVidia (even has me given several blue screen). I tried to update the drivers for the card but I got the same problem. It was working prope

  • What's the difference between 2nd and 3rd generation

    PLEASE HELP! New Apple user and looking to purchase a used 2nd or 3rd generation ipod touch. what's the difference between 2nd and 3rd generation? apparently I am told that the 2nd gen does not have the capabilities of listening without headphone? an

  • EFT Customers and Vendors

    Hi, We have a coustomer who will be sending the payments to us via EFT.  Since the same vendor has five different customers associated, they are claiming that they can't make payments on individual vendor because of they have same tax id.  Is that tr

  • About Records Management (TCODE ORGANIZER)

    Hi to all, First tell me if this thread is at incorrect place. My question is: When I open a record in Organizer with a different folders and I open a folder system said me: Node hidden: 0 (visibility check), 1 (authorization check)