XML Data w/ plsql

Greetings,
Case:
Trying to create a report on eBS and XDO combines to plsql as xml data source.
Problem:
When I execute the procedure, Only one single record is generated, whereas the underlying sql statement retreives more rows.
Question:
Could you pls advise on what's wrong with the procedure below ?
Thks, lamso
Procedure (gives single row)
PROCEDURE do_it(errbuf OUT VARCHAR2, retcode OUT VARCHAR2) IS
CURSOR c_xml IS
SELECT XMLElement("EMPLOYEES",
                         XMLElement
                          ("Emp"                  
                            , XMLElement("EmployeeName", e.ename)
                            , XMLElement("Dept", d.dname)
                              , XMLElement("Salary", e.sal)
                              , XMLElement("Job", e.job)
                              , XMLElement("Location", d.loc)
                   ).getCLobVal()
FROM scott.emp e, scott.dept d
WHERE e.deptno = d.deptno;
l_xml CLOB;
proceed BOOLEAN;
l_curr PLS_INTEGER;
l_next PLS_INTEGER;
BEGIN
proceed := TRUE;
l_curr := 1;
l_next := 1;
OPEN c_xml();
FETCH c_xml INTO l_xml;
CLOSE c_xml;
IF proceed THEN
WHILE l_curr < dbms_lob.getlength(l_xml) LOOP
l_next := INSTR(l_xml, '</', l_curr);
l_next := INSTR(l_xml, '>', l_next);
Fnd_File.put_line(Fnd_File.OUTPUT, SUBSTR(l_xml, l_curr, l_next - l_curr + 1));
l_curr := l_next + 1;
END LOOP;
END IF;
Fnd_File.put_line(Fnd_File.LOG, 'XML succesfully created!');
END do_it;
END;
plsql output
[pre]
Single rowThe direct sql statement
SELECT XMLElement("EMPLOYEES",
                         XMLElement
                          ("Emp"                  
                            , XMLElement("EmployeeName", e.ename)
                            , XMLElement("Dept", d.dname)
                              , XMLElement("Salary", e.sal)
                              , XMLElement("Job", e.job)
                              , XMLElement("Location", d.loc)
                   ).getCLobVal()
FROM scott.emp e, scott.dept d
WHERE e.deptno = d.deptnosql statement output
<EMPLOYEES><Emp><EmployeeName>CLARK</EmployeeName><Dept>ACCOUNTING</Dept><Salary>2450</Salary><Job>MANAGER</Job><Location>NEW YORK</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>KING</EmployeeName><Dept>ACCOUNTING</Dept><Salary>5000</Salary><Job>PRESIDENT</Job><Location>NEW YORK</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>MILLER</EmployeeName><Dept>ACCOUNTING</Dept><Salary>1300</Salary><Job>CLERK</Job><Location>NEW YORK</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>SMITH</EmployeeName><Dept>RESEARCH</Dept><Salary>800</Salary><Job>CLERK</Job><Location>DALLAS</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>ADAMS</EmployeeName><Dept>RESEARCH</Dept><Salary>1100</Salary><Job>CLERK</Job><Location>DALLAS</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>FORD</EmployeeName><Dept>RESEARCH</Dept><Salary>3000</Salary><Job>ANALYST</Job><Location>DALLAS</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>SCOTT</EmployeeName><Dept>RESEARCH</Dept><Salary>3000</Salary><Job>ANALYST</Job><Location>DALLAS</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>JONES</EmployeeName><Dept>RESEARCH</Dept><Salary>2975</Salary><Job>MANAGER</Job><Location>DALLAS</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>ALLEN</EmployeeName><Dept>SALES</Dept><Salary>1600</Salary><Job>SALESMAN</Job><Location>CHICAGO</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>BLAKE</EmployeeName><Dept>SALES</Dept><Salary>2850</Salary><Job>MANAGER</Job><Location>CHICAGO</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>MARTIN</EmployeeName><Dept>SALES</Dept><Salary>1250</Salary><Job>SALESMAN</Job><Location>CHICAGO</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>JAMES</EmployeeName><Dept>SALES</Dept><Salary>950</Salary><Job>CLERK</Job><Location>CHICAGO</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>TURNER</EmployeeName><Dept>SALES</Dept><Salary>1500</Salary><Job>SALESMAN</Job><Location>CHICAGO</Location></Emp></EMPLOYEES>
<EMPLOYEES><Emp><EmployeeName>WARD</EmployeeName><Dept>SALES</Dept><Salary>1250</Salary><Job>SALESMAN</Job><Location>CHICAGO</Location></Emp></EMPLOYEES>

SELECT      SYS_XMLAGG(xmlelement( "e",
xmlforest(
                         e.ename as "EmployeeName",
                         e.sal as "Dept"
))).getCLobVal() FROM scott.emp e, scott.dept d
WHERE e.deptno = d.deptno;
change your query :)

Similar Messages

  • XML:selecting the value of a xml tag using plsql

    Hi,
    I have a table xx_table with one of the column xx_column which is of type XMLTYPE.I inserted the xml data into this column with xml data as below.
    <userComments xmlns:ns1="http://xmlns.oracle.com/XXXX_AccountDistribution"
    xmlns="http://xmlns.oracle.com/XXXXX_AccountDistribution">
    <task:userComment
    xmlns:task="http://xmlns.oracle.com/bpel/workflow/task">
    <task:comment>*********** Rejecting invoice **********</task:comment>
    <task:updatedBy>
    <task:id>r</task:id>
    <task:displayName></task:displayName>
    <task:systemVersionFlag></task:systemVersionFlag>
    </task:updatedBy>
    <task:updatedDate>2010-05-19T14:09:15-07:00</task:updatedDate>
    <task:displayNameLanguage></task:displayNameLanguage>
    <task:action></task:action>
    <task:systemVersionFlag></task:systemVersionFlag>
    </task:userComment>
    </userComments>
    My question ,how do i select the value of the tag "comment" from the above xml data using plsql? Can we write a query to select the value of the tag "comment" to fetch "*********** Rejecting invoice **********" as value.
    Regards,
    Sandeep

    If you have rights to modify tabular model then, you can create a measure in your Tabular model which returns previous week and then use this measure in Pivot Table.
    Thanks,
    Sagar K 
    (Blog: http://datamazik.blogspot.in/)

  • How to retrieve data from plsql table in BI publisher Data template

    Hi All,
    I have created a data template for XML publisher report. In data template i m getting data from plsql table. for that i have created one package with pipelined function. I am able to run that sql from sql developer .But if i run the concurrent program then i got error like "java.sql.SQLSyntaxErrorException: ORA-00904: "XXXXX": invalid identifier".
    I have used the same parameters in Data template and concurrent program....
    please clarify me what needs to be done....
    thanks in advance....
    Regards,
    Doss

    Hi Alex ,
    i am using pipelined function and get the data from cursor and load it into plsql table (nested table). and i use the below in my data template to fetch the data:
    <sqlStatement name="Q1">
    <![CDATA[select * from  table(PO_SPEND_RPT_PKG.generate_report(P_ORG_ID,P_SOB_ID,P_ORG_NAME,P_PERIOD_NAME,P_CLOSE_STATUS,P_E_PCARD_NEED,P_REPORT_TYPE))]]>
    </sqlStatement>
    if i run the above in sql developer i can get the result....from apps if i run i got the error "java.sql.SQLSyntaxErrorException: ORA-00904: "P_ORG_ID": invalid identifier"
    Edited by: kalidoss on Sep 14, 2012 4:32 AM

  • How to Write Log Message in a XML Data Source Report

    Hi Friends,
    Can anyone help me out what is the process of writing a log file in the XML Data Source Report. for eg: in Plsql we use FND_LOG.PUT_LINE to print the Log message in the Concurrent Request Output. in the similar manner, when we develop a report using XML, where we write Coding in XQuery of XML, what is the process need to follow to print the logs for the XQuery.
    Any inputs/Suggestion on this Highly appreciable.
    Thanks in advance.

    Create an RMI application (for example) that writes the log, and let all logging calls call that remote application.
    Something like that is the only feasible way that doesn't require you to have a drive on the remote machine mapped to the local one (which causes its own problems as you could have multiple simultaneous write attempts...).

  • XML Parser for PLSQL and BIG5/UTF-8

    I'm trying store data in traditional chinese submitted by IE5 (through oXMLHttpRequest.send() and javascript), I tried both 'encoding="BIG5"' and 'encoding="UTF-8"'.
    It seems that the parser ignore all characters that are not ascii regardless of their encoding.
    Any thoughts will be much appreciated
    procedure UpdateXMLProc(xmlSrc varchar2)
    is
    p xmlparser.parser;
    doc xmldom.DOMDocument;
    nlist xmldom.DOMNodeList;
    list_len pls_integer;
    node1 xmldom.DOMNode;
    node2 xmldom.DOMNode;
    node3 xmldom.DOMNode;
    begin
    p := xmlparser.newParser;
    xmlparser.parseBuffer(p, xmlSrc);
    doc := xmlparser.getDocument(p);
    nlist := xmldom.getElementsByTagName(doc, 'ROW');
    list_len := xmldom.getLength(nlist);
    -- loop through elements
    for j in 0..list_len-1 loop
    node1 := xmldom.item(nlist, j);
    -- get primary key values
    node2 := xmldom.getFirstChild(node1);
    loop
    -- get the text node and if not null get value
    node3 := xmldom.getFirstChild(node2);
    if not xmldom.isNull(node3) then
    -- THIS OUTPUT MAY ALTER CHARACTER IF IT'S NOT ASCII
    htp.p(xmldom.getNodeValue(node3));
    end if;
    -- get next field
    node2 := xmldom.getNextSibling(node2);
    exit when (xmldom.isNull(node2));
    end loop;
    end loop;
    -- THIS OUTPUT WILL BE IN THE SAME ENCODING AS THE ORIGINAL
    htp.p(xmlSrc);
    end;
    null

    I just ran the initjvm.sql,initdbj.sql and
    initsqlj.sql.
    Still getting the error.
    Please help!!!!
    Thanks
    Jay
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jay ([email protected]):
    I have Oracle8i Release 8.1.5.0.0 - ProductionWith the Java option
    PL/SQL Release 8.1.5.0.0 - Production version
    runnig in sun sparc server.
    While I am loading Oracle XML Parser for PLSQL(using plxmlparser_V1_0_1.tar.gz) have a problem. When I try to load the xmlparser.jar class and I get the
    following messages:
    initialization complete
    Error while accessing MD5 table
    ORA-00942: table or view does not exist
    loading : org/w3c/dom/DOMImplementation
    Error while loading org/w3c/dom/DOMImplementation
    ORA-04068: existing state of packages has been discarded
    ORA-04063: package body "TEST.LOADLOBS" has errors
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at line 1
    creating : org/w3c/dom/DOMImplementation
    Error while creating class org/w3c/dom/DOMImplementation
    ORA-00406: COMPATIBLE parameter needs to be 8.1.0.0.0 or greater
    Error while accessing MD5 table
    ORA-00942: table or view does not exist
    loading : org/w3c/dom/html/HTMLDivElement
    Error while loading org/w3c/dom/html/HTMLDivElement
    ORA-04068: existing state of packages has been discarded
    ORA-04063: package body "TEST.LOADLOBS" has errors
    ORA-06508: PL/SQL: could not find program unit being called
    and so on.
    Could anyone please tell me if I need to do any pre-installation steps.
    Thanks
    Jay<HR></BLOCKQUOTE>
    null

  • Using a SQL data source and XML data source in the same template

    I am trying to develop a template for the Request for Quote report generated in Apps 11.5.10. I have loaded the data from the XML output into the template, but I am missing one field - I need the org_id from the po_headers table. Is it possible to use a sql data source (i.e., "select org_id from po_headers_all where po_header_id = [insert header_id from xml data]...") in addition to the xml data source to populate the template at runtime? When you use the Insert > SQL functionality is it static at the time the template is created, or does it call to the database at runtime? I've looked through all the docs I could find, but this isn't clear.
    Thanks for any help or suggestions you may have.
    Rhonda

    Hi Pablo
    Thats a tough one ... if you go custom with a data template you will at least get support on the data template functionality ie you have a problem when you try and build one. You will not get support on the query inside the data template as you might have gotten with the Oracle Report, well you could at least log a bug against development for a bad query.
    Eventually that Oracle Report will be converted by development anyway, theres an R12 project going on right now to switch the shipped OReports to data templates. AT this point you'll be fully supported again but:
    1. You have to have R12 and
    2. You'll need to wait for the patch
    On reflection, if you are confident enough in the query then Oracle will support you on its implementation within a data template. Going forward you may be able to swap out your DT and out in the Oracle one without too much effort.
    Regards, Tim

  • XML data 32K into CLOB

    Hi all,
    I am trying to use UTL_FILE.PUT_LINE to output an XML file. This xml file is the result of a select query. Hence converting the result of the select query into xml format using dbms_xmlgen.getxml and storing it in a variable. But the resultant xml data > 32k . What would be the best way to store it in variable? When using CLOB datatype, getting a numeric value error.
    Thanks in advance.

    As you didn't post the code, nor included a four digit database version, you are asking someone to look in a crystal ball.
    Sorry, they are out for repair.
    Also the XDB forum would be more appropriate.
    Sybrand Bakker
    Senior Oracle DBA

  • How i can transfer XML data from internet to SAP R/3?

    Hi all,
    I have an issue to catch data from internet (perticular website) in xml format and i want to update that xml data format into SAP R/3 database. so how i can do that?
    Can I do directly or i should use any third party tools?

    Hi Deepak,
        Refer these two weblogs,
    /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function
    /people/jin.shin/blog/2007/05/21/handling-web-service-soap-fault-responses-in-sap-netweaver-xi
    I hope, this will solve your problem
    Regards,
    Deviprasad

  • DataGrid does not display XML data

    Hello, and thanks for reading this...
    I am having a problem displaying XMLList data in a DataGrid.
    The data is coming from a Tree control, which is receiving it
    from a database using HTTPService.
    The data is a list of "Job Orders" from a MySQL database,
    being formatted as XML by a PHP page.
    If it would be helpful to see the actual XML, a sample is
    here:
    http://www.anaheimwib.com/_login/get_all_orders_test2.php
    All is going well until I get to the DataGrid, which doesn't
    display the data, although I know it is there as I can see it in
    debug mode. I've checked the dataField property of the appropriate
    DataGrid column, and it appears correct.
    Following is a summary of the relevant code.
    ...An HTTPService named "get_all_job_orders" retrieves
    records from a MySQL database via PHP...
    ...Results are formatted as E4X:
    HTTPService resultFormat="e4x"
    ...An XMLListCollection's source property is set to the
    returned E4X XML results:
    ...The "order" node is what is being used as the top-level of
    the XML data.
    <mx:XMLListCollection id="jobOrdersReviewXMLList"
    source="{get_all_job_orders.lastResult.order}"/>
    ...The "jobOrdersReviewXMLList" collection is assigned to be
    the dataProvider property of a Tree list, using the @name syntax to
    display the nodes correctly, and a change event function is defined
    to add the records to a DataGrid on a separate Component for
    viewing the XML records:
    <mx:Tree dataProvider="{jobOrdersReviewXMLList}"
    labelField="@name"
    change="jobPosForm.addTreePositionsToDG(event)"/>
    ...Here is the relevant "jobPosForm" code (the Job Positions
    Form, a separate Component based on a Form) :
    ...A variable is declared:
    [Bindable]
    public var positionsArray:XMLList;
    ...The variable is initialized on CreationComplete event of
    the Form:
    positionsArray = new XMLList;
    ...The Tree's change event function is defined within the
    "jobPosForm" Component.
    ...Clicking on a Tree node fires the Change event.
    ...This passes an event object to the function.
    ...This event object contains the XML from the selected Tree
    node.
    ...The Tree node's XML data is passed into the positionsArray
    XMLList.
    ...This array is the dataProvider for the DataGrid, as you
    will see in the following block.
    public function addTreePositionsToDG(event:Event):void{
    this.positionsArray = selectedNode.positions.position;
    ...A datagrid has its dataProvider is bound to
    positionsArray.
    ...(I will only show one column defined here for brevity.)
    ...This column has its dataField property set to "POS_TITLE",
    a field in the returned XML record:
    <mx:DataGrid width="100%" variableRowHeight="true"
    height="75%" id="dgPositions"
    dataProvider="{positionsArray}" editable="false">
    <mx:columns>
    <mx:DataGridColumn width="25" headerText="Position Title"
    dataField="POS_TITLE"/>
    </mx:columns>
    </mx:DataGrid>
    In debug mode, I can examine the datagrid's dataProvider
    property, and see that the correct XML data from the Tree control
    is present. However, The datagrid does not display the data in any
    of its 6 columns.
    Does anyone have any advice?
    Thanks for your time.

    Hello again,
    I came up with a method of populating the DataGrid from the
    selected Item of a Tree Control which displays complex XML data and
    XML attributes. After the user clicks on a Tree branch, I call this
    function:
    public function addTreePositionsToDG(event:Event):void{
    //Retrieve all "position" nodes from tree.
    //Loop thru each Position.
    //Add Position data to the positionsArray Array Collection.
    //The DataGrid dataprovider is bound to this array, and will
    be updated.
    positionsArray = new ArrayCollection();
    var selectedNode:Object=event.target.selectedItem;//Contains
    entire branch.
    for each (var position:XML in
    selectedNode.positions.position){
    var posArray:Array = new Array();
    posArray.PK_POSITIONID = position.@PK_POSITIONID;
    posArray.FK_ORDERID = position.@FK_ORDERID;
    posArray.POS_TITLE = position.@POS_TITLE;
    posArray.NUM_YOUTH = position.@NUM_YOUTH;
    posArray.AGE_1617 = position.@AGE_1617;
    posArray.AGE_1821 = position.@AGE_1821;
    posArray.HOURS_WK = position.@HOURS_WK;
    posArray.WAGE_RANGE_FROM = position.@WAGE_RANGE_FROM;
    posArray.WAGE_RANGE_TO = position.@WAGE_RANGE_TO;
    posArray.JOB_DESCR = position.@JOB_DESCR;
    posArray.DES_SKILLS = position.@DES_SKILLS;
    positionsArray.addItem(posArray);
    So, I just had to manually go through the selected Tree node,
    copy each XML attribute into a simple Array, then ADD this Array to
    an ArrayCollection being used as the DataProvider for the DataGrid.
    It's not elegant, but it works and I don't have to use a Label
    Function, which was getting way too complicated. I still think that
    Flex should have an easier way of doing this. There probably is an
    easier way, but the Flex documentation doesn't provide an easy path
    to it.
    I want to thank you, Tracy, for the all the help. I checked
    out the examples you have at www.cflex.net and they are very
    helpful. I bookmarked the site and will be using it as a resource
    from now on.

  • Edit/add XML data in BI Publisher

    Hi
    I have a java program that is generating an XML file that I am using as input for my BI publisher for PO report. However, I want to add some extra information(location addresses corresponding to location id) that is not there in the XML and I cannot edit the java program generating it. Is there any way I can do this in BI publisher? Can I edit/add XML data in BI publisher? This is really urgent and I appreciate any help.
    Thanks,
    Sharmila

    You have to edit the package which has the sql query,
    without fetching them in xml , you cannot display that.
    BIP will not help you to get that into report.
    The code which generates the XML data has to edited for sure..
    I guess, i helped one guy for similar requirement,
    i guess you are asking in the same report..
    the java program in turn calls the Pl/Sql package which generates the XML data and pass it to the Java Concurrent Program.
    The Pl/Sql package picks data from these views po_headers_xml, po_lines_xml, po_distribution_xml.
    you can also add the columns you want to be displayed in these views, and then change the template accordingly.

  • Regrouping the XML data source in BI Publisher

    Hello,
    We have a requirement in BI Publisher to develop a template accessing the data from different sources (data sets) and need to regroup the whole data by a field which exists in all the data sets.
    Below is the sample example of the source file
    <DATA><Total_Depletion>
    <TOTAL_DEPLETION_ROW>
    <BRAND_GROUP>BEEFEATER</BRAND_GROUP>
    <BRAND>BEEFEATER</BRAND>
    <OPP_RISK>-50.000001</OPP_RISK>
    <STATE>AL</STATE>
    </TOTAL_DEPLETION_ROW>
    <TOTAL_DEPLETION_ROW>
    <BRAND_GROUP>BEEFEATER</BRAND_GROUP>
    <BRAND>BEEFEATER</BRAND>
    <OPP_RISK>53.1</OPP_RISK>
    <STATE>AR</STATE>
    </TOTAL_DEPLETION_ROW>
    </Total_Depletion>
    <Accounts_sold><ACCOUNTS_SOLD_ROW>
    <BRAND_GROUP>BEEFEATER</BRAND_GROUP>
    <BRAND>BEEFEATER REGULAR</BRAND>
    <STATE>MC</STATE>
    <ACTUAL_ONPREMISE>2</ACTUAL_ONPREMISE>
    </ACCOUNTS_SOLD_ROW>
    <ACCOUNTS_SOLD_ROW>
    <BRAND_GROUP>BEEFEATER</BRAND_GROUP>
    <BRAND>BEEFEATER WET</BRAND>
    <STATE>CA</STATE>
    <ACTUAL_ONPREMISE>916</ACTUAL_ONPREMISE>
    </ACCOUNTS_SOLD_ROW>
    </Accounts_sold></DATA>
    Now our requirement is to regroup the whole data by Brand and then state, and need to display in two different tables.
    Can any one help us in fixing this issue out.
    Thanks a lot,

    Hi Stefanos,
    Check beow blog for reference...
    /people/community.user/blog/2007/08/13/sap-netweaver-70-bi-how-to-send-xml-data-to-bi--enhancement
    Regards,
    KK.

  • Tranferring XML data to the B1 System

    Hi,
    Iam very new to the B1 system..
    Iam looking to transfer the data from the XML file to the B1 system.
    to make it clear, the requirement is i have a purchase order coming from one system and it is saved in the server..the data in the XML file will have to be shown in the B1 system as a sales order..
    Please any one can help on this ASAP.
    Thanks,
    Bhaskar.

    Bhaskar,
    The forum that you have posted your question in is for questions related to the SAP Business One Integration to SAP NetWeaver.  You question seems more generic as to how to import XML into SAP Business One.
    One way of doing this would be to create a small program using the Business One SDK.  You can search the SAP Business One SDK Discussion Forum as well as look at the SDK documentation that comes with the product.  If you converted the XML data to text, you could use the Data Transfer Workbench.  There are different options that you have.
    Eddy

  • Convert XML data to byte array...

    Hello All,
    In my application, i have an XML file and the corresponding XSD file. This XML file is having some date, which i want to convert into an byte[] and then save it in a file. 
    How i can convert the XML data in the byte[]? Here as an example of the xml file and the byte[] data which i want to save in a file.
    <?xml version="1.0" encoding="utf-8"?>
    <HeadersInfo>
    <header>
    <id>0</id>
    <Name>H1</Name>
    </header>
    <header>
    <id>1</id>
    <Name>H2</Name>
    </header>
    </HeasersInfo>
    In the above example 'id' field is of type 'uint' and 'name' field is of type 'string' with max length of '5'. So in this case my byte array should be as shown below:
    00 00 00 01 48 31 00 00 00
    00 00 00 02 48 32 00 00 00
    Here underlines values are for the 'id' parameter where as values in bold are for 'Name' parameter for all the header values in sequence. Name parameter is null (0x00) padded.
    Thanks in advance,
    IamHuM

    Hi,
    the following example extract the id, name values using LINQ To Xml and writes it to a memory stream using a binary writer and returns the result as a byte array:
    internal static byte[] GetXmlAsByteArray()
    var document = XDocument.Parse("<HeadersInfo>"
    + " <header><id>1</id><Name>H1</Name></header>"
    + " <header><id>2</id><Name>H2</Name></header>"
    // additional testing
    + " <header><id>32767</id><Name>H1234</Name></header>"
    + " <header><id>305419896</id><Name>H56789</Name></header>"
    + "</HeadersInfo>");
    const int NameLength = 5; // Max length for a name
    byte[] zeroBytes = new byte[NameLength]; // Helper to fill name
    using (var ms = new MemoryStream())
    using (var writer = new BinaryWriter(ms))
    // write each header
    foreach (var header in document.Root.Elements("header"))
    int id = (int)header.Element("id");
    string name = (string)header.Element("Name");
    byte[] nameBytes = System.Text.Encoding.UTF8.GetBytes(name);
    Console.WriteLine("id: {0}, Name: {1}", id, name);
    // Write id
    writer.Write(GetUIntBytes((uint)id));
    // Write name NameLength (5) max, otherwise padded
    if (nameBytes.Length > NameLength)
    writer.Write(nameBytes, 0, NameLength);
    else
    writer.Write(nameBytes, 0, nameBytes.Length);
    if (nameBytes.Length < NameLength)
    writer.Write(zeroBytes, 0, NameLength - nameBytes.Length);
    byte[] result = ms.ToArray();
    // dump array
    foreach (var value in result)
    Console.Write("{0:X2} ", value);
    Console.WriteLine();
    return result;
    public static byte[] GetUIntBytes(uint value)
    if (BitConverter.IsLittleEndian)
    // swap bytes
    value = ((value & 0x00ff) << 24)
    | ((value & 0xff00) << 8)
    | ((value & 0x00ff0000) >> 8)
    | ((value & 0xff000000) >> 24);
    return BitConverter.GetBytes(value);
    For a general purpose solution you should create a class and split the example into separate methods to extract the data and write the values (integers, strings).
    Regards, Elmar

  • How do I use the Session State to manage bind variables & download xml data

    I have a Report Query with more than 30 queries; many have bind variables in them. I'd like to create sample xml so that I can develop my word templates. When I try to download the XML data Source for Layout, it doesn't ask for the bind variable values.
    How can I download the XML data without replacing the bind variable values in each of the queries?
    Thank you.

    If you are using the Standalone version, then first of all make sure to UNCHECK (BIP10g 10.1.3.4.1)
    "AUTO RUN" (it is under General Settings when you select your Report Definition)
    Next, you should define the parameters in the corresponding parameter Section.
    Its simplest form is of "Text" type so you will have to enter values at runtime.
    Then these parameters can be used in your query as bind variables.
    When you run the report it will prompt for parameter values. Enter these values
    and you would get a sample of your XML data.
    This should work and you should not find any issues.
    regards
    Jorge

  • XML Data ( View Total exist in a different query)

    Hi,
    This is a sample of my xml data :
    <TEST_COMP>
    - <LIST_G_Q1>
    - <G_Q1>
      <Q1_ITEM_ID>61</Q1_ITEM_ID>
      <TOT>13754492</TOT> 
      </G_Q1>
    - <G_Q1>
      <Q1_ITEM_ID>62</Q1_ITEM_ID>
      <TOT>1199366</TOT>
      </G_Q1>
    - <G_Q1>
      <Q1_ITEM_ID>63</Q1_ITEM_ID>
      <TOT>20886715</TOT>
      </G_Q1>
    </LIST_Q1>
    - <LIST_G_ALL_LIST>
    <G_ALL_ITEMS>
      <ITEML_ID>68</ITEM_ID>
      <ITEM_NAME>ITEM NAME 1</ITEM_NAME>
      </G_ALL_ITEMS>
    - <G_ALL_ITEMS>
      <ITEM_ID>69</ITEM_ID>
      <ITEM_NAME>ITEM NAME 2</ITEM_NAME>
      </G_ALL_ITEMS>
    </LIST_G_ALL_LIST>
    </TEST_COMP>I do insert a table that display the data in the LIST_G_ALL_LIST, i need to insert one more column that read the total value of the same item exist in the LIST_G_Q1..
    I wrote the following in the new column:
    <?for-each:G_Q1?><?if: Q1_ITEM_ID=ITEM_ID?><?TOT?><?end if?><?end for-each?>What i got is a blank cloumn whatever the item id was even if there is a total in the Q1
    Would you please help
    Hope that my problem is clear enough!
    Thanks a lot

    I tried using variables...
    I rest my variable (in G_ALL_ITEMS) using
    <?xdoxslt:set_variable($_XDOCTX, 'x', ITEM_ID)?>Then i tried to recall it in my if condition ( inside G_Q1)
    <?if: Q1_ITEM_ID=xdoxslt:get_variable($_XDOCTX, 'x')?>it still give me a blank cloumn!!

Maybe you are looking for

  • Line Chart - Current Year Sales, Current year Returns, Last year Sales, Last Year Returns

    We have a report that summarises monthly sales & credits for 2 years in a group footer.   The footer is a sum of a formula in the detail section that calculates the monthly sales at the Item code level Item 1 Group Footer 1     July     Aug     Sept 

  • Can a color laser printer be adjusted to match InDesign CS6 colors?

    I'm trying to print through a laser printer (color Brother HL-4570CDW) but it muddies all the colors and darkens them. The inkjet Epson does ok, but I'd like to save ink, if possible.  Is there a way to adjust the way the printer reads the colors? I'

  • Button to save as reader enabled

    Good evening! I have a form that I am automatically saving with a button.  However, I will have to go into each form and save as reader-enabled.  It is for evaluation forms--so does not exceed the EULA.  Is there a way to save as reader extended with

  • Agent statistics and SQL server agent

    We have CUCCX 5.02 and CUCM 6.1 When agents try to look their "Agent statistics report" in CAD there is no data. And status of this report is "Inactive". All other reports are active. In CCX "control center" I see that "CRS SQL server Agent - this se

  • Disable/enable the serial port

    Hello All, I am using Labview to communicate with a Microchip PIC virtual serial port. Ocassionally the serial comms is lost. To recover the connection I open Device Manager then right click the faulty comm port then select disable ( a red cross appe