Step by step guide to create XML based report


I have never tried this kind of reporting before. Mail from a friend prompted me that I should start creating this report and also publish an article which shows a step-by-step process of creating one.

So here is the list that we are going to achieve:

Create a DTD file
Create an XML file
Create a report based on the two files created.

First step is to create a DTD file.

Our XML file contains details of all database environments in use by a team.

The following is our DTD file. Save the following contents as c:\database.dtd:




                         , OracleSID
                         , DatabaseDomain
                         , Administrator+
                         , DatabaseAttributes
                         , Comments)



















The contents of the structure is as follows:
DatabaseInventory (Row of type DatabaseName)
DatabaseName is a type of fields (GlobalDatabaseName, OracleSID, DatabaseDomain, Administrator+, DatabaseAttributes, Comments)
GlobalDatabaseName is a field of type PCDATA
OracleSID is a field of type PCDATA
DatabaseDomain is a field of type PCDATA
Administrator is a field of type PCDATA
DatabaseAttributes is EMPTY by default
Comments is a field of type PCDATA


In the ATTLIST tag, we are defining the properties of the fields of type PCDATA.


Now the second step is to create XML file as below. Save the following contents as database.xml:







 
    mydb.myspace.com
    production
    myspace.com
    Anantha
   
   
      This is production database.
   
 


 
    prod.myspace.com
    development
    myspace.com
    Anantha
   
   
      This is development database.
   
 


 
    test.myspace.com
    testing
    myspace.com
    Anantha
   
   
      This is testing database.
   
 





Now start Report Builder.



  • Create a New report using the wizard
  • Click next on Welcome wizard
  • Select Create both Web and Paper Layout option and click Next
  • Choose a Tabular report
  • Choose XML Query
  • In the Query Source definition choose Query Definition button
  • In the Define XML Query choose the database.dtd and choose select columns button
  • Choose all columns
  • In the Data source field choose the database.xml file and click OK
  • Click next
  • Choose all fields and click next
  • Click next
  • Edit the labels if necessary.
  • Click next
  • Choose a template if necessary
  • Click Finish.

Congratulations, you have created a report based on an XML query successfully.