XsltCompiledTransform.Transform with XmlReader/XmlWriter

Hi - there is one form of the XsltCompiledTransform class's Transform() function that takes an XmlReader and XmlWriter as parameters:
https://msdn.microsoft.com/en-us/library/ms163433%28v=vs.110%29.aspx
At first glance, this would appear to allow a streaming-based transform of the input XML, without having to load the whole XML document into memory first.
But doing an XSLT transform is something very difficult to do in a streaming fashion (which XmlReader/XmlWriters would allow you to do).
So, I assume whilst this form of the function takes these streaming XML reader/writer classes, in reality it still loads the XML pointed to by the XmlReader completely into memory first, performs the transform, then writes out the whole document to the XmlWriter?
It doesn't say whether it loads the whole document into memory before transforming it in the MSDN docs...

Hi Herro, thanks for your response.
Sorry if my initial question wasn't clear - I don't know if the XsltCompiledTransform.Transform() function always loads the complete XML document into memory before transforming or not, that's what I'm asking.
The Transform(XmlReader, XmlWriter) form of the function is passed an XmlReader to read the XML to transform. An XmlReader does not have to load the complete XML document into memory in order to read any of its contents - it can read it part by part, tag
by tag in a forward-only fashion (in contrast to, say, XDocument or XmlDocument which loads the complete XML into a DOM tree).
If you use this form of the Transform(XmlReader, XmlWriter) method, my question is does this method still load the whole XML document into memory first before transforming the document and writing out the transformed XML using the XmlWriter?
To put it in a nutshell, is it possible to use XSLTs on large XML documents without loading the complete (large) XML document into memory first? Does this method load the whole document into memory first before performing the transform?

Similar Messages

  • Problems in SQL transform with variable in statement

    Hi,
    I have an sql transform with a variable in the statement. It looks like this:
    SELECT * FROM I.X where I.X.CUSTOMERNUMBER IN ([$variable])
    I have a script running prior which sets the $variable = '\'366800\',\'000933\'';
    (the CUSTOMERNUMBER field is a string)
    The problem is when DI compiles the SQL with the variable value, it is replacing each single quote with two single quotes, and thus turning my list of values into a single string (as recognised by DB2).
    How can I work around this? The CUSTOMERNUMBER field is indexed and the table is very large, so I want to use a very efficient statement to retrieve the data. I'm inserting this data into a different database, so I can't use the sql() function to execute the query and insert the rows into a new table in the same database (don't have authority to do that).
    I also need the sql to be dynamic because the customer numbers required will change from time to time. They're listed in another database and I plan on writing a loop to set the $variable value to contain all values in the lookup table, but I can't use that in a join because its in a different database and would not be efficient.
    Does anyone have any ideas? I'm literally all out, have tried a wide range of things to no avail, and none of my colleagues can work it out either.
    Thanks very much,
    -Steve

    I assume the SQL Transform is used only because of that in-list, not for other reasons....
    In this book page here: https://boc.sdn.sap.com/node/20046 at the very bottom it isdescribed on how to use the pushdown_sql() function in a where clause to add *any* text of your choice into the select statement DI generates. In this example I used a "where exists" but you can easily change the text to
    where key=5 and       pushdown_sql('my_datastore', 'CUSTOMERNUMBER IN ([$variable])')    and gender='M'
    I used the key=5 and gender=M just to clarify the syntax (I hope).
    For the SQL Transform, I wonder if you need the [$variable] syntax as well....

  • In Data Quality transform please explain Associate transform with the help of any example.

    In Data Quality transform please explain Associate transform with the help of any example.

    Hi Neha,
    If we are using multiple match transforms and consolidate the final output we will use associate transform .
    Let me explain with one example based on data quality blue prints for USA .
    We have customer/vendor data .     We need to find the duplicates .
    1. First  we will find the duplicates  on   Name and Address
    2. Second  we will find the duplicates on Name and Email
    3. Third we will find the duplicates on Name and Phone
    Here why we need to find the duplicates in multiple stages . If we are finding the duplicates on combination of  Name, Address, Email and Phone  we may not get proper duplicates   as we are finding the potential duplicates . That's why we are finding the duplicates on different combinations .
    In this case we will get the different group numbers for each match combination . Each combination name is there .
    We want to consolidate and give the group number to the whole set of duplicates . We will pass these  3 match groups to associative transform and generate the  consolidated match group for the input data.
    I hope you understand the concept .
    Thanks & Regards,
    Ramana.

  • SQL Transform with VARIABLE

    Hello!
    I have the SQL Transform with global variable.
    First, I have a script for iniciality the variable:
    $DATE_CUST= to_date('2011/11/15 00:00:00.000','YYYY/MM/DD HH24:MI:SS.FF');
    I print the variable, in the execution write:
    2800     896     PRINTFN     2011.11.15 00:00:00.000000000
    STEP in SQL Transforms: 
    1.  SELECT * FROM TABLE_CUSTOMER
    2.  PUSH the update Schema button
    3.  add the where clause:  WHERE DATE_CUSTOMER > [$DATE_CUST]
    4.  save the DataFlow.
    When the execute the job, But we got error...  The variable is null or empty
    In the log trace: 
    |Data flow DF_VAR|Reader SQL
    SELECT query <select * from TABLE_CUSTOMER
    WHERE DATE_CUSTOMER  > 
    The database error message is <Sybase SQL Server <CRMGCPSA> error message for operation <ct_results>: <Sybase ASE Server message number <102> State <1> Severity <15> From Server <ASEDWHD>:   Message Text is: Incorrect syntax near ')'.
    >.
    Why no have value the variable ?
    The script correct should be
    SELECT query <select * from TABLE_CUSTOMER
    WHERE DATE_CUSTOMER  >  2011.11.15 00:00:00.000000000

    Both braces and square brackets can be used to reference variables, however they behave slightly differently.
    suppose I have the following hard-coded SQL statement
    select * from al_funcinfo where name = 'avg'
    Now I want to make it dynamic, I can use a variable and some square brackets
    select * from al_funcinfo where name = '[$G_Name]'
    or braces
    select * from al_funcinfo where name = {$G_Name}
    As you can see, braces adds single quotes around the varible value.  It is very useful when constructing complex statements requiring string values to be delimited with quotes (as most SQL DBs do).  These variable interpolation techniques can be used in scripts.
    M

  • Xmltype.transform() with stylesheet that includes another stylesheet

    I' trying to use xmltype.transform() with a stylesheet that includes/imports another stylesheet. But this results in a 'ORA-03113: End of communication channel'. Is xsl:include or xsl:import supported?
    This is the first stylesheet:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:import href="company2.xsl"/>
         <xsl:template match="/">
              <xsl:apply-templates select="company"/>
         </xsl:template>
    </xsl:stylesheet>
    And this the second stylesheet:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="company">
              Company: <xsl:value-of select="."/>
         </xsl:template>
    </xsl:stylesheet>
    Both stylesheets are stored in the Oracle XDB Repository in folder '/public/test'.
    The following script results in an error:
    declare
    l_xsl xmltype;
    l_xml xmltype;
    l_xml2 xmltype;
    begin
    l_xsl := xdburitype('/public/test/company.xsl').getxml();
    l_xml := xmltype('<company>Oracle</company>');
    l_xml2 := l_xml.transform(l_xsl);
    end;
    I tried the following values for the href attribute of xsl:include:
    company2.xsl
    /public/test/company2.xsl
    http://<host>:<port>/public/test/company2/xsl
    I also tried to use xsl:import instead of xsl:include with the above attribute values for href. In all cases I get the ORA-03113.
    Thanks for any help, hints or tips.
    Erwin Groenendal

    Did you look in the database alert log or in the database log area to see if any trace file was generated by your error? The listener.log may have more information too.
    Also, you can trace your session to see what is happening.
    alter session set sql_trace = true;
    run sql
    alter session set sql_trace = false;
    or
    alter session set events '10046 trace name context forever, level 12';
    or TURN on TRACING for any SESSION
    execute sys.dbms_system.set_sql_trace_in_session -
    (sid => &sid, serial# => &serial#, sql_trace => true);
    run sql
    execute sys.dbms_system.set_sql_trace_in_session -
    (sid => &sid, serial# => &serial#, sql_trace => false);
    HTH
    M.

  • Transformation with JDOM (off-topic)

    Hi All,
    I am wondering if anyone could advice me on how to carry out transformation in a JDOM enviornment. I am familiar with querrying data using XPath with JDOM.
    Any tutorial or online reference material would be very much appreciated.
    I am running Netbeans 6.1, J2EE 5 Glassfish on Windows XP platform.
    Many thanks,
    Jack

    It contains the [org.jdom.transform|http://www.jdom.org/docs/apidocs/org/jdom/transform/package-summary.html] package with classes to do basic transformation. As the documentation says:
    Classes to help with transformations, based on the JAXP TrAX classes. JDOMTransformer supports simple transformations with one line of code. Advanced features are available with the JDOMSource and JDOMResult classes that interface with TrAX.

  • Transport error when transporting a transformation with formulas/routines

    Hi All,
    I have migrated some 3.5 dataflow (Datasource, Transfer rules, Update rules, Infosource etc..) to 7.0. I am able to load the datatargets using the DTP's just fine.
    The problem I am facing is transporting these dataflows to Quality and Production systems. I am specifically having problem with transporting transformations which has formulas/routines.
    I was able to transport the transformations with direct mapping from source field to target fields (no formulas/routines) without any problem and it works fine in Quality system. I tried to transport couple of transformations with formulas/routines, all of them give a shortdump ASSERTION_FAILED (transport fails with error code 12).
    I am not sure what the problem is. We are on support package 16. Has anyone faced this problem before? Any suggestions are appreciated.
    Points are assured
    Thanks,
    Sirish.

    Hi,
    What is the dump message you are getting? Check in ST22 and let us know. And try the process which is said in the previous post collect all the transformations through transport connections and transport them.
    Khaja

  • 2 transformation with same datasource

    Hi 
    Can I assign one Datasource to 2 DSO . I want to create a transformation . I hv already creatred one transformation with one DSO and by using the DS , I am creating a transformation with other DSO . getting msg that , DS is not active .
    Is it possible to create 2 transformation by using the same DS with different target .
    Regards

    HI Maasum
    Yes, you can make the same datasource point to two different data targets. As you've alreadt mentioned you would need to create two independant transformations. Be sure to replicate the datasource and activate the transformations before testing the data load.
    Hope this helps.
    Thanks.

  • ORA-03113 in spatial query with xmlReader

    I run a spatial query with xmlReader. but it occurs a ORA-03113 exception. If i use the OracleDataReader,not through xml, the execution is ok. But i have to get the geometry data through xml. I have try to set the validate connection to True, but it seems useless.
    Can some one help me?Thx a lots.
    Here is my code:
         string id = "scott";
         string psw = "tiger";
         string source = "Oracle";
         string connectionstring = "User Id="+id+";password="+psw+";data source="+source+";validate connection=true";
         string sql ="select cname from L218 where sdo_relate(L218.GEOLOC,MDSYS.SDO_geometry(2003,NULL,NULL,MDSYS.SDO_elem_info_array(1,1003,3),MDSYS.SDO_ordinate_array(295596.60260187,2761786.9958782, 316370.598147679,2789383.2780762)),'mask=anyinteract')='TRUE'";
         try
              Oracle.DataAccess.Client.OracleConnection con = new OracleConnection(connectionstring);
              con.Open();
              Oracle.DataAccess.Client.OracleCommand cmd = con.CreateCommand();
              cmd.XmlCommandType = OracleXmlCommandType.Query;
              cmd.BindByName = true;
              cmd.CommandText =sql;
              XmlReader xmlReader = cmd.ExecuteXmlReader();
              XmlDocument xmlDocument = new XmlDocument();
              xmlDocument.PreserveWhitespace = false;
              xmlDocument.Load(xmlReader);
              Console.WriteLine(xmlDocument.OuterXml);
              con.Close();
         catch (OracleException e)
              Console.WriteLine(e);
    And it returns:
    Oracle.DataAccess.Client.OracleException ORA-03113: end-of-file on communication
    channel at Oracle.DataAccess.Client.OracleCommand.XmlHandleException(OracleE
    xception e)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlQuery(Boolean wantResult)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlReader()

    Hi Daniel
    I ran the validation and some of the geometries were invalid. I have now corrected these and all are OK. The db version is 817. However, I am still getting the same error. It appears to be dependant on what cordinates the query is searching:
    Errors
    SELECT 1
    FROM wpe_misc_site, WPE_PLAN_APPLICATION
    WHERE wpe_misc_site.ste_id > 0
    AND WPE_PLAN_APPLICATION.APL_ste_id(+) =
    wpe_misc_site.ste_id
    AND mdsys.sdo_relate(ste_geometry,
    MDSYS.SDO_GEOMETRY(2003, 81989, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),
    MDSYS.SDO_ORDINATE_ARRAY(278792,187310,278876,187393)),
    'mask=anyinteract querytype=window') = 'TRUE';
    Substriute those coordinates for 278792,187308,278876,187393 and query works.
    Any ideas??
    Thanks
    Chris

  • Mouse scroll wheel not working on Asus Transformer with Swiftpoint Mouse. Is there a fix?

    Asus Transformer with Android 3.1 Honeycomb. Mouse is the Swiftpoint mobile wireless mouse. The scroll wheel doesn't function in the latest firefox mobile browser. Other browsers like the built-in browser and Dolphin browser work.
    I've tried going into the firefox config and tried all the mousewheel fixes, but still cant get the wheel to work. Is this a known bug?

    Sorry, this is not possible in the current version of Firefox, but we have an open bug report where we are tracking this issue here:
    https://bugzilla.mozilla.org/show_bug.cgi?id=686228
    With luck it will be fixed in a future version.

  • Dump when I activate a transformation with a formula.

    Hi All,
    I 've different problems with transformations....
    Particulary when I activate a transformation with a formula, it terminates in dump with exception "ASSERTION_FAILED" in class CL_RSRAN_FOBU_APPL method GET_CODE.
    I' ve read the note 1050275 (ASSERTION_FAILED in CL_RSTRAN_FOBU_APPL->GET_CODE) that seems to have the solution for this problem, but the correction instruction proposed is already applied and the problem still running...
    Infact the note suggest to apply the support package SAPKW70014...and  I've  SAP_BW 700 with SAPKW70015.
    I've also read the note 1055217 and 998730, but I'm not able to find the right solution.
    How I can solve the problem?
    Thank's a lot,
    Valentina.

    Hello Valentina,
    does this happen with all Transformations, or only with once into the DSOs or InfoCubes.
    If only into the above mentioned target I have a possible solution for you.
    I had a similar problem recently, you are probably also working with some Master Data Update. The InfoObjects that you are updating into the DSO or InfoCubes are being updated(With Master Data Transformaion) with Master Data as well, these need to be active, otherwise the check goes into the following tables(please see below) and if there are inconsistences it ends with "ASSERTION_FAILED".
    These the relevant tables for Routines and Formulas, please check them as well:
    Formulas are maitained in the follwing tbls:
    RSAFORM
    RSAFORMMAP
    RSAFORMT
    RSFOBUEV000
    RSFOBUEV001
    Routines:
    RSAABAP
    RSAABAPINV
    RSARFIELDS
    RSAROUT
    RSAROUTT
    Hope this helps a bit.
    Kind Regards,
    Patrik Hengerics

  • Transformation with PL/SQL Procedure

    Hi,
    I want to do the following transformation with the OWB.
    Table1 -> Transformation (Procdure) -> Table2
    The procedure should take the table structure of Table1 as input. The procedure sould process the data inside it.
    It should return the table structure of Table2 as output, so that Table2 can get populated with the transformed data.
    Can any of you please let me know how the above can be achieved efficiently with OWB (without the use of Table Functions) ?
    I am working with OWB10G Release 2.
    Thanks
    Anirban

    LS,
    Since the transformations are complex, using a temporary table does not simplify the mapping in OWB. A table function does keep the mapping in OWB simple and keeping maintenance simpler by keeping it out of OWB and into a tablefunction.
    The "walkthrough" of 'gladnn' in this post should give you a good start:
    Table Function
    Regards,
    André

  • Xsl:output ignored when doing transformation by XMLReader and XMLFilter

    I want to make XML transformation via XSL file using XMLReader and filter as described in java tutorial http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/5_chain.html, but it is not working correctly. Transformation is not using encoding and method set in xslfile by <xsl:output method="xml" encoding="ISO-8859-2"/>.
    I wrote simple test program whitch has two method doing transformation:
    transform_method1 - transforms by XMLReader and filter
    transform_method2 - transforms in other manner described in the same tutorial
    The second method is working, but first not. Maybe someone has some solution why the first method is not working correctly?
    Here is test class:
    package xslt;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.sax.*;
    import javax.xml.transform.stream.*;
    import java.io.*;
    public class TestTransform {
        public static void main(String[] args) {
            File xml_file = new File(args[0]);
            File xsl_file = new File(args[1]);
            File output_file_method1 = new File(args[2]);
            File output_file_method2 = new File(args[3]);
            transform_method1(xml_file, xsl_file, output_file_method1);
            transform_method2(xml_file, xsl_file, output_file_method2);
        private static void transform_method1(File xml, File xsl, File output) {
            try {
                BufferedInputStream bis = new BufferedInputStream(new FileInputStream(xml));
                InputSource input = new InputSource(bis);
                SAXParserFactory spf = SAXParserFactory.newInstance();
                SAXParser parser = spf.newSAXParser();
                XMLReader reader = parser.getXMLReader();
                SAXTransformerFactory stf = (SAXTransformerFactory) TransformerFactory.newInstance();
                XMLFilter filter1 = stf.newXMLFilter(new StreamSource(xsl));
                filter1.setParent(reader);
                StreamResult result = new StreamResult(output);
                Transformer transformer = stf.newTransformer();
                SAXSource transformSource = new SAXSource(filter1, input);
                System.out.println("encoding method1="+transformer.getOutputProperty(OutputKeys.ENCODING));
                transformer.transform(transformSource, result);
            } catch (Exception e) {
                e.printStackTrace();
        private static void transform_method2(File xml, File xsl, File output) {
            try {
                TransformerFactory tFactory =   TransformerFactory.newInstance();
                Transformer transformer = tFactory.newTransformer( new StreamSource( xsl) );
                System.out.println("encoding method2="+transformer.getOutputProperty(OutputKeys.ENCODING));
                transformer.transform(new StreamSource(xml), new StreamResult(output));
            } catch (Exception e) {
                e.printStackTrace();
    }and here is test xml file:
    <?xml version="1.0" encoding="ISO-8859-2"?>
    <root>
        <line>Some text line 1</line>
        <line>Some text line 2</line>
        <line>Some text line 3</line>
    </root>the test stylesheet:
    <?xml version="1.0" encoding="ISO-8859-2"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="ISO-8859-2"/>
    <xsl:template match="root">
         <p><xsl:apply-templates/></p>
    </xsl:template>
    <xsl:template match="line">
         <div><xsl:apply-templates/></div>
    </xsl:template>
    </xsl:stylesheet>I get output file from method1:
    <?xml version="1.0" encoding="UTF-8"?>
        Some text line 1
        Some text line 2
        Some text line 3and method2 output:
    <?xml version="1.0" encoding="ISO-8859-2"?>
    <p>
        <div>Some text line 1</div>
        <div>Some text line 2</div>
        <div>Some text line 3</div>
    </p>Output on System.out from program is:
    encoding method1=UTF-8
    encoding method2=ISO-8859-2Can someone help how can I make transformation like transform_method1 style not to ignore <xsl:output method="xml" encoding="ISO-8859-2"/> tag?

    You have two transformations chained together. The first is the XMLFilter, which uses your XSLT, and the second is the Transformer, which takes its output and does an identity transformation on it. The second transformation is the one that produces your final XML, so it's the one that controls what encoding it gets.
    So your stylesheet should be working. Your only "problem" is that you get a different encoding than you expected. And I put "problem" in quotes because the output you are getting is identical, in XML terms, to the output you want to get.

  • Using Transformations with Delta enabled Datasources

    Hi,
    I have a delta enables datasource which uses incremental update to my infoCube.
    In order to populate some fields in the cube I used a transformation routine for a couple of these fields to do some lookups from some tables.
    The problem that I am encountering is that when the delta update runs its only updates the directly assigned fields it does not also update the routine delivered fields.
    Is there a way to get this to work or is it impossible?
    Thanks

    HI,
    The routines work fine for full load as the data is replaced with new data each time.
    What I need to happen is I am using a SAP standard content datasource with delta enabled on the datasource and when loading from datasource to Cube all the 0 fields are updating correctly but my Z fields which i update with routines do not seem to be replaced.
    Please advise of anyway to get this to work
    Thanks

  • Using Simple Transformations with Objects tt:copy .. results in Exception

    Question:
    How can I serialize an ABAP-Object-Instanz with my own simple transformation?
    In the sap-documentation I found the following solution for the serialisation of any data-objects.
    "z_steffens_simple_transf":
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="ROOT"/>
      <tt:template>
        <root>
          <tt:copy ref="ROOT"/>
        </root>
      </tt:template>
    </tt:transform>
    Following the example I wrote this report:
    report  zspahr_test_simple_transf.
    class serializable definition.
      public section.
        interfaces if_serializable_object.
        data attr type string value 'Attribute'.
    endclass.         
    method main_serializable.
        data: oref type ref to serializable,
              xmlstr type xstring.
        create object oref.
        call transformation id
          source root = oref
          result xml xmlstr.
        call function 'DISPLAY_XML_STRING'
          exporting
            xml_string = xmlstr.
        call transformation z_steffens_simple_object
          source root = oref
          result xml xmlstr.
        call function 'DISPLAY_XML_STRING'
          exporting
            xml_string = xmlstr.
      endmethod.                    "main_
    start-of-selection.
      demo=>main_serializable( ).
    Executing this report leads to an exception "CX_SY_REF_NOT_SUPPORTED".
    The "standard" transformation "ID" ist working an translates my object-instance into an asXML representation:
      <?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
      <ROOT href="#o3" />
      </asx:values>
    - <asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary">
    - <prg:SERIALIZABLE xmlns:prg="http://www.sap.com/abapxml/classes/program/ZSPAHR_TEST_SIMPLE_TRANSF" id="o3">
    - <local.SERIALIZABLE>
      <ATTR>Attribute</ATTR>
      </local.SERIALIZABLE>
      </prg:SERIALIZABLE>
      </asx:heap>
      </asx:abap>
    How can I do this with my own Simple Transformation "ZSPAHR_TEST_SIMPLE_TRANSF" ?
    I want to serialize my object using my own xml-structure, not the asXML-structure !
    Regards
    Steffen

    Hi,
    try like this,i think it may help you.
    ABAP:
    CALL TRANSFORMATION ztrans_test
          SOURCE
               root = partab
         RESULT XML lv_xstring.
    Trnsformation:
    <tt:root name="ROOT" type="?"/>
    <tt:template>
    <VALUES>
    <VALUE_SOURCE>
            <tt:value ref=".ROOT"/>
    </VALUE_SOURCE>
    <VALUE_PARAM>
    <tt:value ref="NAME"/>
    <tt:value ref="VALUE"/>
    </VALUE_PARAM>
    </VALUES>
    Thanks,
    Rajesh.

Maybe you are looking for