TSQL Output to XML Question

I have a SQL Server table which needs to be output into a specific format.
Create Table
CREATE TABLE [ESS].[tblAdressGeoTag](
[RowId] [int] IDENTITY(1,1) NOT NULL,
[EntityID] [nvarchar](255) NULL,
[Name] [nvarchar](255) NULL,
[DisplayName] [nvarchar](255) NULL,
[AddressLine] [nvarchar](255) NULL,
[Locality] [nvarchar](255) NULL,
[AdminDistrict] [nvarchar](255) NULL,
[AdminDistrict2] [nvarchar](255) NULL,
[CountryRegion] [nvarchar](255) NULL,
[PostalCode] [nvarchar](255) NULL,
[Latitude] [geography] NULL,
[Longitude] [geography] NULL,
[EntityTypeId] [nvarchar](255) NULL,
CONSTRAINT [PK_ESS.tblAdressGeoTag] PRIMARY KEY CLUSTERED
[RowId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Insert Sample Data
insert into ESS.tblAdressGeoTag
[EntityID],
[Name] ,
[DisplayName] ,
[AddressLine] ,
[Locality] ,
[AdminDistrict] ,
[CountryRegion] ,
[PostalCode]
Values
(N'2555',N'Microsoft', N'Microsoft', N'1 Microsoft Way',N'Redmond', N'WA', N'USA', N'98052'),
(N'5588','ABC Enterprises', 'ABC Enterprises', '2501 Broadway','Bakersfield', 'CA', 'USA', '94022')
TSQL Select Statement to Format XML Data
Declare @XMLOutput XML
Set @XMLOutput= (Select
[RowId] id
,[EntityID]
,[Name]
,[DisplayName]
,[AddressLine]
,[Locality]
,[AdminDistrict]
,[AdminDistrict2]
,[CountryRegion]
,[PostalCode]
,[EntityTypeId]
from ESS.tblAdressGeoTag as GeocodeEntity
For XML Auto, Root ('GeocodeEntity'))
Select @XMLOutput
Results to this Output
<GeocodeEntity>
<GeocodeEntity RowId="1" EntityID="2555" Name="Microsoft" DisplayName="Microsoft" AddressLine="1 Microsoft Way" Locality="Redmond" AdminDistrict="WA" CountryRegion="USA" PostalCode="98052" />
<GeocodeEntity RowId="2" EntityID="5588" Name="ABC Enterprises" DisplayName="ABC Enterprises" AddressLine="250 Broadway" Locality="Bakersfield" AdminDistrict="CA" CountryRegion="USA" PostalCode="88752" />
</GeocodeEntity>
But Output must look exactly like this, including the header information:
<?xml version="1.0" encoding="utf-8"?>
<GeocodeFeed xmlns="http://schemas.microsoft.com/search/local/2010/5/geocode"
Version="2.0">
<GeocodeEntity Id="001"
xmlns="http://schemas.microsoft.com/search/local/2010/5/geocode">
<GeocodeRequest Culture="en-US" IncludeNeighborhood="1">
<Address AddressLine="1 Microsoft Way" AdminDistrict="WA" Locality="Redmond"
PostalCode="98052" />
</GeocodeRequest>
</GeocodeEntity>
<GeocodeEntity Id="002"
xmlns="http://schemas.microsoft.com/search/local/2010/5/geocode">
<GeocodeRequest Culture="en-US" IncludeNeighborhood="1">
<Address AddressLine="2501 Broadway" AdminDistrict="CA" Locality="Bakersfield"
PostalCode="94022" />
</GeocodeRequest>
</GeocodeEntity>
</GeocodeFeed>
Can someone please let me know how to format my TSQL Select script so that required output is achieved, including header.
Thank you,
John

Thank you Saeid, I'm not quite certain how to put several elements in here:
e.g:
The required header information,
the section:
<?xml version="1.0" encoding="utf-8"?>
<GeocodeFeed xmlns="http://schemas.microsoft.com/search/local/2010/5/geocode"
Version="2.0">
and
<GeocodeEntity Id="001"
xmlns="http://schemas.microsoft.com/search/local/2010/5/geocode">
<GeocodeRequest Culture="en-US" IncludeNeighborhood="1">
and then the insert portion of the
Address section.
The final output must be exactly like:
<?xml version="1.0" encoding="utf-8"?>
<GeocodeFeed xmlns="http://schemas.microsoft.com/search/local/2010/5/geocode"
Version="2.0">
<GeocodeEntity Id="001"
xmlns="http://schemas.microsoft.com/search/local/2010/5/geocode">
<GeocodeRequest Culture="en-US" IncludeNeighborhood="1">
<Address AddressLine="1 Microsoft Way" AdminDistrict="WA" Locality="Redmond"
PostalCode="98052" />
</GeocodeRequest>
</GeocodeEntity>
<GeocodeEntity Id="002"
xmlns="http://schemas.microsoft.com/search/local/2010/5/geocode">
<GeocodeRequest Culture="en-US" IncludeNeighborhood="1">
<Address AddressLine="2501 Broadway" AdminDistrict="CA" Locality="Bakersfield"
PostalCode="94022" />
</GeocodeRequest>
</GeocodeEntity>
</GeocodeFeed>

Similar Messages

  • Getting question marks in html output when XML sourced from a CLOB...

    I have noticed a number of other unanswered questions on the
    same subject in this forum. Can someone at Oracle shed some
    light on this problem?...
    I store XML in CLOBS which contain a lot of &eacute; &ouml;
    characters. When using XSQL to select the XML from the CLOB I
    have to apply a stylesheet to the XSQL (myFile.xsql) with
    disable-output-escaping ="yes" in order to output well formed
    XML.
    I then call the XSQL file from inside another stylesheet i.e.
    <xsl:variable name="sample" select="document(myFile.xsql)"/>
    <xsl:template match="/">
    <xsl:for-each select="$sample">
    <html>
    <body>
    <title>
    <xsl:value-of select="/page/title"/>
    </title>
    </body>
    </html>
    etc...
    I use <xsl:for-each select="$sample"> to output the XML I need,
    within the HTML. The problem is though if "&eacute;" appears in
    the /page/title node the output in HTML appears as a question
    mark.
    Its important to note as well that the stylesheet I apply to
    myFile.xsql starts with:
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output doctype-system="/myFile.dtd" indent="yes"/>
    etc..
    and myFile.dtd has <!ENTITY eacute "&#x000E9;"> in order to
    validate &eacute; in the CLOB.
    I don't have this problem when the &eacute; character is stored
    in a VARCHAR2 column and the VARCHAR2 column is in the same
    select statement as the CLOB in the XSQL file. This outputs in
    my HTML just fine. What am I missing here?
    Shaun

    I parse the XML doc into a domdocument and then loop through using xpath.valueof to pull the individual values from the nodes and then build a generic insert. It works quite well with a small number of columns. I'm not sure how it would work with a lot of columns. You can get code examples from Steve Muench's book "Developing Oracle XML Applications".

  • Report VS Excel output using XML Publisher tool (DBMS_XMLGEN)

    Hi All,
    Currently I am working on report generation in MRP module with Excel output using XML Publisher tool.
    XML tool works based on query.
    I have developed PLSQL block by using DBMS_XMLGEN – database package, to generate XML output of query.
    My question is how we can put generated xml on above PLSQL block into OUT file (APPS).
    Because DBMS_OUTPUT.PUT_LINE( ) has limitation, it allow 255 character string only.
    But I do not know, Is FND_FILE.PUT_LINE (FND_FILE.OUTPUT,’’) allow for large data?
    If it does not allow what will be the other solution in oracle application to resolve above problem.
    Let me know any queries regarding to this problem.
    Thanks and Regards,
    Sai Krishna @cavaya.com

    Hi Prakash,
    Thanks for the reply. We did apply the one-off patch and got rid of the problem of not viewing 'Excel' output using XMLP.
    Now we are looking at a different perspective:
    Basically our client is looking for the following:
    1. Mathematical functions in the resulting XLS (like SUM, AVG etc..) ouput
    2. Use of macros if possible.
    And to do this i am looking out for a sample template that gives me output in excel format I have a TAR with Oracle for this purpose, but the TAR has so far been unsuccessful in providing us with any material in the direction.
    Our client remembers seeing this as a demo at the Oracle Conference this yr at San Fransisco, but does not have a sample to provide us. We are looking for such a sample.
    Thx,
    Nitin

  • SAx Output non XML Compliant (Part 2)

    This is the question I asked before:
    http://forum.java.sun.com/thread.jsp?forum=34&thread=471553&tstart=0&trange=15
    my doubt is: what happens when the & character appears in the input data? I.e. not written by me in the XSLT styleSheet.
    Is there anything I can put in the stylesheet so the special characters appear escaped?
    And if not, is there any class that will escape all the special characters so I can use it in the Contenthandler?
    I know I could write one such class, but it seems such a common problem that I'm sure there must be a standard one out there.
    Cheers!

    I am using a Transformer and getting the output with a Contenthandler. But the output I get hasn't got the special characters converted. I don't know if it is meant to be this way or it is because I'm using a SAXResult or what.
    I find it very strange because if I tell my Transformer that the output is XML one would think that it would leave the special characters escaped.

  • Product-sku-output-config.xml - Is there a schema definition (XSD or DTD)?

    For the product-sku-output-config.xml file (used to define the set of product and sku attributes that are sent to Endeca from ATG as part of the Baseline Index process, as defined in chapter 4 of the ATGEndecaIntegrationGuide.pdf, 10.1.2 version), is there a schema definition (XSD or DTD) available?
    The format used by product-sku-output-config.xml seems similar to, but not the same as, the format described by http://www.atg.com/dtds/search/indexing-dependency-schema.dtd. For example, p35 of the ATGEndecaIntegrationGuide.pdf gives an example of a product-sku-output-config.xml with a "properties" child element of the top-level "item" element; per that indexing-dependency-schema.dtd, that isn't allowed. (Per that DTD, it should be either "meta-properties" or "text-properties", not "properties".)
    More generally, I'm wondering if there's place that fully defines what can go into the product-sku-output-config.xml file.
    I'm also interested this same question for the category-dim-output-config.xml file.
    Thanks,
    -Jon

    For the product-sku-output-config.xml file (used to define the set of product and sku attributes that are sent to Endeca from ATG as part of the Baseline Index process, as defined in chapter 4 of the ATGEndecaIntegrationGuide.pdf, 10.1.2 version), is there a schema definition (XSD or DTD) available?
    The format used by product-sku-output-config.xml seems similar to, but not the same as, the format described by http://www.atg.com/dtds/search/indexing-dependency-schema.dtd. For example, p35 of the ATGEndecaIntegrationGuide.pdf gives an example of a product-sku-output-config.xml with a "properties" child element of the top-level "item" element; per that indexing-dependency-schema.dtd, that isn't allowed. (Per that DTD, it should be either "meta-properties" or "text-properties", not "properties".)
    More generally, I'm wondering if there's place that fully defines what can go into the product-sku-output-config.xml file.
    I'm also interested this same question for the category-dim-output-config.xml file.
    Thanks,
    -Jon

  • Anyone know how to output an XML file from ABAP to a non sapgui location?

    I have a program that creates XML and then outputs a file via CALL METHOD cl_gui_frontend_services=>gui_download. But now I want to execute the program in background mode and therefore I need to be able to output that XML to a NON sapgui file location. Current code creates the XML to an internal table which is binary then the gui_download method converts that to output XML. .  Does anyone know how I can change the code to either a) output the XML to an internal table which can be output via, say, a TRANSFER command..or, b) output the created binary table of XML to a NON sapgui file location?
    Excerpts from current code are as follows:
    first the XML is created (to the binary file)
          Creating a ixml factory
      l_ixml = cl_ixml=>create( ).
          Creating the dom object model
      l_document = l_ixml->create_document( ).
          Fill root node with value XML
      l_element_xml  = l_document->create_simple_element(
                  name = 'XML'
                  parent = l_document ).
          Create tag 'HEADER' as child of 'XML'
      l_element_header  = l_document->create_simple_element(
                  name = 'HEADER'
                  parent = l_element_xml  ).
    header information about the file and general data about the fleet follows
      l_value = c_fleet_import.
      l_element_dummy  = l_document->create_simple_element(
                name = 'TYPE'
                value = l_value
                parent = l_element_header ).
    etc.......
    then the xml is connected to the stream factory and rendered
      Creating a stream factory
      l_streamfactory = l_ixml->create_stream_factory( ).
      Connect internal XML table to stream factory
      l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
      Rendering the document
      l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                            document = l_document ).
      l_rc = l_renderer->render( ).
      Saving the XML document
      l_xml_size = l_ostream->get_num_written_raw( ).
    and then output to the file
      IF sy-subrc = 0.
        CALL METHOD cl_gui_frontend_services=>gui_download
           EXPORTING
             bin_filesize = l_xml_size
            filename     = 'g:\sapdms\BSCC-DEV\EFPAC XML Files\ALL.xml'
           filename     = '/TRICK/727/OUT/ZEFP/EFPAC.XML' "doesnt work with sap gui
             filetype     = 'BIN'
           CHANGING
             data_tab     = l_xml_table
           EXCEPTIONS
             OTHERS       = 24.
    as implied by the comments the method above will successfully output the XML file to the g:drive but will not output to /TRICK/ location, which is where I need it to go in a background mode run.
    This is a problem which has defeated all our local expertise and I would appreciate any help given... Barry Jones

    Try this code below:
    data  l_xml_table2  type table of xml_line with header line.
    W_filename - This is a Path.
      if w_filename(02) = '
        open dataset w_filename for output in binary mode.
        if sy-subrc = 0.
          l_xml_table2[] = l_xml_table[].
          loop at l_xml_table2.
            transfer l_xml_table2 to w_filename.
          endloop.
        endif.
        close dataset w_filename.
      else.
        call method cl_gui_frontend_services=>gui_download
          exporting
            bin_filesize = l_xml_size
            filename     = w_filename
            filetype     = 'BIN'
          changing
            data_tab     = l_xml_table
          exceptions
            others       = 24.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.

  • Need help to get output in XML

    Hi all
    I am a PL/SQL programmer and have no idea about XML :-(
    I am using ORACLE 10g and my application generates atleast 100 text files a day for customers. These files are manipulated using Utl_File package and gets data from the DB.These files are tab or comma delimeted. Now company wants to give an option to customers to get the same output in XML format. My understanding is that I need to get information from customers first to make the report template for them and then use some XML parser to get data from DB and give an output using that customer's specific template.
    I wanna know, if there is any whitepaper or manual that can guide me step by step. I just need to make an idea how the things can go togather and the sequence of operation.
    Rashid

    Hi all
    I am a PL/SQL programmer and have no idea about XML :-(
    I am using ORACLE 10g and my application generates atleast 100 text files a day for customers. These files are manipulated using Utl_File package and gets data from the DB.These files are tab or comma delimeted. Now company wants to give an option to customers to get the same output in XML format. My understanding is that I need to get information from customers first to make the report template for them and then use some XML parser to get data from DB and give an output using that customer's specific template.
    I wanna know, if there is any whitepaper or manual that can guide me step by step. I just need to make an idea how the things can go togather and the sequence of operation.
    Rashid

  • Regarding Excel output of XML file

    When i am trying to open the output of XML file. I am getting the below dialogue boxes before report getting openend. Can any one help to resolve this issue.
    Dailogue box 1
    Open XML
    Please select how you would like to open this file:
    As a XML table
    As a read-onlyworkbook
    Use the XML Source task pane
    Dialogue box 2
    Microsoft office excel
    The Specified XML Source does not refer to a schema. Excel will create a schemabased on the XML source data.

    plz see
    How To View / Open Concurrent Requests With The Excel Application [ID 377424.1]
    How to Control the Name and the Application that Opens the Concurrent Request Output File on the Client? [ID 316752.1]
    How to Setup The Report Output to Different Viewer Types in Oracle Applications [ID 184375.1]
    http://sairamgoudmalla.blogspot.com/2009/04/concurrent-program-output-in-ms-excel.html

  • How to Create MultiSheet Excel Report Output in XML Publisher in Oracle R12

    Dear All,
    How to Create MultiSheet Excel Report Output in XML Publisher in Oracle R12.
    My Requirement is to develop RTF Template and geneate Excel output in Multiple sheet.
    plz guide me on this..
    thnx
    Khushal

    plz see
    BI Publisher: How to create Multisheet in Single Excel file using Excel Template [ID 1352000.1]
    for r12 you can use excel template
    i think it more appropriate for excel output

  • Oracle Matrix Report output to XML Publisher

    We have an Oracle matrix report (rdf) registered in our applications and we are trying to format the report output using XML publisher.
    I have taken XML output of the report by changing the Report output to XML in concurrent program definition. Using this XML output we have started designing the RTF template using Template Builder for Word 5.6.2.
    I am not able to get the MAtrix output in XML publisher. I am not sure how to design a Matrix Report using Template builder for word. I am not sure whether the XML output of Original Report has Tags mentioning Matrix report attributes or Not.
    Can anyone help me by explaining how to design a Matrix Report template using XML report output. Appreicate your help.

    I have posted a Blog on our blog site about how to create a matrix report in XML-Publisher
    http://technology.amis.nl/blog/?p=1558
    Perhaps this helps.
    Marcos

  • I need 3 dimentional charts as an output in xml publisher report

    Hi,
    As off now chrarts r in 2 dimension But I need 3 dimentional charts as an output in xml publisher report, please any one tel me wheather is possible or not.....?? if possible please tell me how to develop that report....

    Not sure you are on the right forum...

  • XML Publisher data engine vs. switching output to XML in the Con.Program.

    What is the difference between setting up templates using the data engine described in the 5.6 user's guide and creating a customer report and setting its output to XML?
    Is it a matter of you being able to totally create your own XML and add atrributes to tags and such? Is this the only way to get data output from Oracle into an XML file? It's been a while, but i recall creating XML output on the fly with .Net pretty easily via an ASPX page.
    Seems like alot of work to achieve this? Am I missing something?
    If I wanted to have a JSP page where a user could use a form to query the database via IE, are these the API's i need to use for the returned data to come back as XML?
    Thanks,
    Jeremy

    You should try posting your query in XML Publisher forum, which is now BI Publisher.

  • How to generate PDF from XML output without XML publisher

    Hi,
    I am facing a problem while splitting the rdf generated XML output.
    Problem Description:
    I have a oracle invoice report which runs once every day (scheduled program). This report fetches me the invoices generated on that day and needs to be Mailed / Faxed to the customers.
    So i developed the report in such a way that it generates the output order by customers...since the output generated will be as one .out file in APPLCSF/out directory...the .out file needs to be splitted by customers, for which i have written a cursor which takes the data of the main query and submits that many requests as many as customers are there.....There is a possibility of having 1000 customers per day also. If that is the case then my main program will fire that many requests.
    Is there a different approach......any inputs are highly appreciated.
    Also, i am generating the output in XML format. Is there a way from which i can directly generate a PDF from that XML output rather using any other tool.
    Thanks & Regards,
    Lakshmi Kalyan Vara Prasad.

    Hi,
    with Reports Bursting and the defined "distributions" it's possible to have one report splittet to several parts with different receipients. Have a look at http://download-uk.oracle.com/docs/cd/B14504_01/dl/bi/B13673_01/pbr_dist.htm.
    With xsl-fo it's possible to create pdf out of xml ... that's what xml publisher is doing.
    Regards
    Rainer

  • How to write oracle output in XML

    can any one please let me know how to write or covert procedure or function output in XML?

    845470 wrote:
    can any one please let me know how to write or covert procedure or function output in XML?What is that asking?
    Are you wanting to take output from a procedure/function that is in XML format and then convert it to something else?
    Are you wanting to get the procedure/function to produce output in XML format?
    Are you wanting to take an existing procedure/function and convert it so the code is stored in some XML structure for some purpose?
    How is anybody supposed to know what you're talking about if you don't explain it?
    {message:id=9360002}

  • Payment Format Program Output in XML

    Hi All,
    I am trying to create a new payment format and should display the output in XML.
    For this I created a PL/SQL procedure , created my tags and displayed the out put in XML format. Using this I created one RTF template and did the data def and data Template.
    I defined the payment format, programs and a document.
    When I run the payment batch using this format , It says no output is generated.
    But the xml output is generated, the template is not shown as attached.
    If I run the concurrent program alone of the payment format I can see the template attched and the output generated in XML.
    BUt when I run the same through a payment batch selecting the document from which the program format is run it does not seem to take the template and hence no output even though there is XML.
    Can someone throw some light.
    Thanks.

    Hi,
    I got it...Now I am able to generated the output in PDF.
    It is a 2 step process, I had to submit XML Report Publisher Program once the format program is run so that it picks the tempalte and generates the output.
    So, Now is there a way to skip this 2 step process ?
    coz finally I have to print the out of the format to a printer.
    Thanks
    Edited by: user576422 on Oct 21, 2008 2:22 PM

Maybe you are looking for

  • Linux users cannot open Firefox on multiple systems that are mounting the same network drive as their home directory

    I am supporting a user who is logging into multiple linux systems that all have the same /home directory mounted to a network filer. When the user opens firefox on one system, he is unable to open firefox on other systems. I'm assuming this is becaus

  • Reverse Posting

    Hi, What is the concept of Reverse Posting ....Is there any link on Request Reverse Posting....

  • Pacman strange sync behaviour

    Hey guys, I'm having some issues with pacman. I've been trying to update the last couple of hours, I clearly have packages out of date - git for example, my local package is verion 1.8.3.2-1. I've checked some mirrors and there are errors, so I rearr

  • Increase JVM memory using Java Code

    Hi Friends I am in a critical situtation and not able get the solution. My application is huge and need of increase in JVM memory. I am able to increase JVM memory in command prompt java -Xmx500m classname Simarly I am able to run jar file also java

  • Query to list the synonyms in one schema to different schema

    Hi How can i check the list of synonyms in one schema pointing to different schemas? Also query to list the table , foreign key constraint and reference table.. Thanks