Transforming xml and DataGrids

Hello
I am reading data from a large xml file. I read it in using
HTTPService and the result type is "E4X". It contains information
about items in a warehouse.
like this
<Inventory>
<warehouse name="Texas">
<chairs count="900"/>
<tables count="40"/>
<lamps count="200"/>
</warehouse>
<warehouse name="California">
<chairs count="20"/>
<tables count="200"/>
<lamps count="1"/>
</warehouse>
</Inventory>
So far I have been able to show a list of warehouses in a
mx:List control and then when I select a warehouse (texas in this
case) I would like to display the list of items and their counts in
an mx:DataGrid control.
I can see that I can use selectedItem of the mx:List to
return the Node for the Texas warehouse like this
<warehouse name="Texas">
<chairs count="900"/>
<tables count="40"/>
<lamps count="200"/>
</warehouse>
But how can I get the data to display in a data grid
ITEM COUNT
chairs 900
tables 40
lamps 200
Thanks
Todd

Not familiar with stxx, but it should allow you the use of the xsl:strip-space instruction or some equivalent, when the XSLT is applied to the XML for transformation...

Similar Messages

  • Problems with XML and Datagrid!

    Hi!
    Trying to follow a similar idea to the app shown on the flex
    homepage - i have the following code:
    [code]
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="srv.send()">
    <mx:HTTPService id="srv"
    url="lab-cs3.cs.st-andrews.ac.uk/~aa322/mytube.xml"/>
    <mx:DataGrid
    dataProvider="{srv.lastResult.videos.video}"/>
    </mx:Application>
    [/code]
    However, when I run the application - it gives the following
    error:
    [RPC Fault faultString="Error #2148: SWF file
    file:///C:/Documents and Settings/Andy/My Documents/Flex Builder
    3/HelloWorld/bin-debug/HelloWorld.swf cannot access local resource
    lab-cs3.cs.st-andrews.ac.uk/~aa322/mytube.xml. Only
    local-with-filesystem and trusted local SWF files may access local
    resources." faultCode="InvokeFailed" faultDetail="null"]
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::invoke()[E:\dev\3.0.x\frameworks\projects\rpc\ src\mx\rpc\AbstractInvoker.as:263
    at mx.rpc.http.mxml::HTTPService/
    http://www.adobe.com/2006/flex/mx/internal::invoke()[E:\dev\3.0.x\frameworks\projects\rpc\ src\mx\rpc\http\mxml\HTTPService.as:234
    at
    mx.rpc.http::HTTPService/send()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\http\HTTP Service.as:758]
    at
    mx.rpc.http.mxml::HTTPService/send()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\http \mxml\HTTPService.as:217]
    at
    HelloWorld/___HelloWorld_Application1_creationComplete()[C:\Documents
    and Settings\Andy\My Documents\Flex Builder
    3\HelloWorld\src\HelloWorld.mxml:2]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
    mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\co re\UIComponent.as:9051]
    at mx.core::UIComponent/set
    initialized()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:1167]
    at
    mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:698]
    at Function/
    http://adobe.com/AS3/2006/builtin::apply()
    at
    mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8460]
    at
    mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src \mx\core\UIComponent.as:8403]
    and fails to connect to the xml i think.
    Any ideas on what I am doing wrong?!
    Thanks
    Andy

    You need to specify the full URL. I would also suggest using
    a result handler to assign the xml to your DataGrid dataProvider.
    Below is a sample. I set the resultFormat to e4x, which is XML.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="srv.send()">
    <mx:HTTPService id="srv"
    url="
    http://lab-cs3.cs.st-andrews.ac.uk/~aa322/mytube.xml"
    result="videoListLoaded(event)"
    resultFormat="e4x"/>
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    [Bindable] private var videoList:XML;
    private function videoListLoaded(evt:ResultEvent):void {
    videoList = evt.result as XML;
    ]]>
    </mx:Script>
    <mx:DataGrid x="10" y="10" id="videos_dg"
    dataProvider="{videoList.video}">
    <mx:columns>
    <mx:DataGridColumn width="200" headerText="label"
    dataField="label"/>
    <mx:DataGridColumn width="300" headerText="URL"
    dataField="url"/>
    <mx:DataGridColumn width="50" headerText="views"
    dataField="views"/>
    <mx:DataGridColumn width="150" headerText="Category"
    dataField="category"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    Vygo

  • Transform XML and display xsl:message

    Hi,
    I have a simple method to transform XML. My XSLT has <xsl:message> to help debugging while transforming. How do I access the messages to System.out.printLn?
    public static Document transformXML(Document xmlDoc, Document xslDoc) throws XMLHelperException {
              try {
                   TransformerFactory factory = TransformerFactory.newInstance();
                   Transformer transformer = factory.newTransformer(new DOMSource(xslDoc));
                   DOMResult result = new DOMResult();
                   transformer.transform(new DOMSource(xmlDoc), result);
                   org.w3c.dom.Node resultNode = result.getNode();
                   if (resultNode instanceof Document) return (Document)resultNode;
                   else return result.getNode().getOwnerDocument();
              } catch (TransformerConfigurationException ex) {
                   throw new XMLHelperException("Unable to perform transform " + ex.getLocationAsString(), ex);
              } catch (TransformerException ex) {
                   throw new XMLHelperException("Unable to perform transform " + ex.getLocationAsString(), ex);
         }thanks for the help.
    Edited by: bonekrusher on Mar 8, 2008 2:27 PM
    Edited by: bonekrusher on Mar 8, 2008 2:27 PM

    public class XForm {
         public static void main(String[] args) throws Exception {
              InputStream xslStream = null;
              InputStream xmlStream = null;
              try {
                   TransformerFactory tf = TransformerFactory.newInstance();
                   xslStream = new BufferedInputStream(new FileInputStream(args[1]));
                   Transformer t = tf.newTransformer(new StreamSource(xslStream));
                   tf.setErrorListener(new ErrorListener() {
                        public void error(TransformerException ex) throws TransformerException {
                             ex.printStackTrace();
                        public void fatalError(TransformerException ex) throws TransformerException {
                             ex.printStackTrace();
                        public void warning(TransformerException ex) throws TransformerException {
                             ex.printStackTrace();
                   xmlStream = new BufferedInputStream(new FileInputStream(args[0]));
                   t.transform(new StreamSource(xmlStream), new StreamResult(System.out));
              } catch (Exception e) {
                   e.printStackTrace();
              } finally {
                   if (xslStream != null)
                        xslStream.close();
                   if (xmlStream != null)
                        xmlStream.close();
    <test>
         <sample try="yes">
              a
         </sample>
    </test>
    <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan">
         <xsl:template match="/">
              <xsl:message terminate="no">got here</xsl:message>
              <xsl:apply-templates/>
         </xsl:template>
         <xsl:template match="*|@*">
              <xsl:copy>
                   <xsl:apply-templates/>
              </xsl:copy>
         </xsl:template>
    </xsl:transform>          

  • XML and DataGrid

    Hi,
    I am working with the XML files and here is my question.
    This is the portion of the XML file
    you can acess my xml file at
    http://pastebin.com/f66fd1ee3
    My XML file keeps changing and the number of action_column
    nodes may vary for each xml file.
    I am trying to display the xml file in the grid using
    http://pastebin.com/f2e57f382
    public function LabelFunc(item:Object,
    column:DataGridColumn): String
    return
    item.action_column.(@column_number==column.dataField).@column_value;
    So is there a way to know how many action_column nodes are
    there and based on that can I do the datagrid dynamically?

    You can get a list of all attributes by calling attributes().
    You can use that info the generate an array of
    DataGridColumns

  • Problem With XML and DataGrid)

    Hi,
    I do have a question how to get my XML data in the appropriate way into my DataGrid. I wrote a labelFunction to get the data into the grid but I still have the problem that the length of the DataGrid depends on the dataProvider and I can't find a way to specify that it should depend on a child object of the dataProvider.
    If you look at the structure of the XML file you can see that for every date a couple of hours exist (normally 24 ) and measurements coming in every hour. So, naturally I would like to show the measurements in connection to the hour. The column 'Date' and 'Time' will be merged anyway to something like '23/2:10-11'. So, if it is easier to combine these values first and create that way a unique date I would be also happy.
    However, the XML file and the Flex code you find at http://www2.dmu.dk/thob/Station_Nord/srcview/index.html and the Flex application you find at http://www2.dmu.dk/thob/Station_Nord/Station_Nord.html.
    Thanks for your help in advance,
    Thomas

    I don't want to analyze that example. Are you asking how to
    get an id or some other value when you select a row in a datagrid?
    When you select an item in any list-based control, the
    control's selectedItem properety contains a reference to the
    dataProvider item object for that selected item. You can access any
    property that is present in that object:
    var sId:String = myDataGrid.selectedItem.myIDProperty;
    If I have misunderstood, please restate your question.
    Tracy

  • Read a xml file from local directory, transform it and put in new local dir

    Hi,
    I have a simple requirement. I have one XML file in d://source folder. I want to read it, transform it and want to put the transformed xml file in new location d://target.
    I am new to OSB. Please help me out to complete the above requirement.
    Thanks in advance.
    Cheers.

    Use a polling file transport proxy service to read the file(d://source folder)
    Do the necessary transformation XML or MFL(if the file is fixed length strings) in the proxy service stages.
    Use a file transport business service to write the file to a directory(d://target).To be called from the proxy service route node.
    http://docs.oracle.com/cd/E17904_01/doc.1111/e15866/transports.htm

  • New to XML and Oracle

    Just trying to clarify some issues as I try and learn about XML, and specifically how it integrates into the DB.
    1 - Is there a way with Oracle tools for me to get an XSD of an existing 9i relational schema? We are not currently using the XML DB, but our middleware developers would like to have an up to date XSD to use for their internal mapping.
    2 - Is there any way that I can keep that XSD up-to-date automatically, so I get a new one whenever the schema gets updated?
    3 - If I wanted to investigate storing XML docs within the DB in native XML format, I need to have an XML DB, correct? Is this DB construct maintained seperatelly from my "normal" relational schema? or are they kept in sync by Oracle?
    I know these may all be real basic questions, but as I said, I'm new to XML and Oracle. I am reading as much as I can, but there are a lot of docs out there.
    Thanks,
    Mike

    Hi
    1. On my opinion such a tool doesn't exists. Some parts can be implemented elsewhere, but not as described by you... e.g. with XSU if you specify the parameter "withschema" the XSD of the executed statement is generated. Another example is to use DBMS_METADATA to dump the data dictionary in XML (but not XSD, of course you could write your own XSLT to do this transformation...).
    2. -
    3. If you use XSD-based tables the XSD and the relational model are stored separately in the data dictionary. Therefore if you change the XSD you have to drop/create the XSD-based table... no schema evolution yet.
    Chris

  • How can I use JavaScript extention functions with Xalan for transforming XML with XSL

    While transforming standart XML and XSL files to HTML with this servlet:
    package mypackage1;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.net.URL;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import org.mozilla.javascript;
    public class Servlet2 extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    try
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(new FileReader("c:/aaa.xml"));
    Source xslSource = new StreamSource(new FileReader("c:/bbb.xsl"));
    Transformer transformer = tFactory.newTransformer(xslSource);
    transformer.transform (xmlSource, new StreamResult(out));
    catch (Exception e)
    e.printStackTrace();
    everything is going ok,
    but when try to use javascript function in XSL file, for example like in this:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:lxslt="http://xml.apache.org/xslt" xmlns:my-ext="ext1"
    extension-element-prefixes="my-ext">
    <lxslt:component prefix="my-ext"
    functions="getdate">
    <lxslt:script lang="javascript">
    function getdate() {
    var d = new Date();
    return d.toUTCString();
    </lxslt:script>
    </lxslt:component>
    <xsl:template match="/">
    <p><xsl:copy-of select="my-ext:getdate()"/></p>
    </xsl:template>
    </xsl:stylesheet>
    recieve error-message:
    XSL-1000: (Fatal Error) Error while parsing XSL file (Extension function namespace should start with 'http://www.oracle.com/XSL/Transform/java/'.).
    What kind of namespace I should specify?

    Hello, Paul.
    I'm sure you may not use JavaScript as a language for creating XSLT extention functions with Oracle XDK Parser. This is since parser might have JavaScript interpreter to work with JavaScript, but it has not.
    If you need to build any XSLT extention functions you must build them as Java class' static methods.
    After that, you define the usage of the class by mean of namespace declaration as:
    xmlns:your-ns="http://www.oracle.com/XSL/Transform/java/yourpackage.Yourclass"
    (Prefix "http://www.oracle.com/XSL/Transform/java/" may differs if you use non-Oracle XML parser)
    and use class' static method in XSLT:
    <xsl:value-of select="your-ns.staticMethodName(paramsIfAny)"/>
    In your case you may wish to use standard Date class:
    xmlns:date="http://www.oracle.com/XSL/Transform/java/java.util.Date"
    <xsl:value-of select="date:toString(date:new)"/>

  • XML and XSD file to an internal table

    I had read a lot of thread  but i don't understand how to deal with xml/xsd in R3.
    I need someone that have a definite example for this escenary please.
    With OPEN DATASET took from the server XML and XSD file, and put it in two internal tables type string.
    What functions or method have to use, and how to use them, to charge the XML file in an internal table?
    This is an example of XML and XDS:
    XML
    AND CONTINUE
    Best Regards,

    I just tried to interpret your question, it was not obvious what you wanted.
    I guess what you mean is that you have defined (statically) a deep structure, and you want to decode the XML into it. That is called a transformation (transaction STRANS, statement CALL TRANSFORMATION). You have the choice between 2 transformation languages: XSLT and ST. Of course, it depends what release you are running.
    I advise you to play first with the ID transformation, to convert an ABAP deep structured data object into XML, so that you see what XML is generated, this one is called asXML. If you create your own transformation, when you call it, it will first convert automatically the data object to asXML, and the transformation has to do the rest of the job.
    You can do the opposite, i.e. converting from XML to a data object, according to the same principle (intermediate asXML).
    Well, there are lots of things to say, I recommend you to read articles and documentation on XSLT and ST (search on SDN).
    About XSD, it won't help (and I did never see any possibility to use it) to decode the XML, as you must anyway define the target data object statically (and there's no tool to generate the ABAP code of the data object definition from the XSD).
    Note that you may also use iXML libraries to parse the XML.
    Please tell us more.
    BR
    Sandra

  • Simple Transformation XML to ABAP   - error CX_ST_MATCH_ELEMENT

    Hi all,
    I have a problem with a transformation from xml to abap. My XML file (taken from a pdf file) is
    <?xml version="1.0" encoding="iso-8859-1" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
      <NETWORK>E60000000000</NETWORK>
      <OPERAZIONE>0010</OPERAZIONE>
    - <TABELLA>
    - <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">
      <MANDT>300</MANDT>
      <NETWORK>E60000000000</NETWORK>
      <OPERAZIONE>0010</OPERAZIONE>
      <ID_ACT>1</ID_ACT>
      <DESC_ACT>ATTIVITÀ1</DESC_ACT>
      <LONG_TXT></LONG_TXT>
      <MAKE_BUY></MAKE_BUY>
      <WP></WP>
      <EVENTO_TECH></EVENTO_TECH>
      <TIPO_LEGAME></TIPO_LEGAME>
      <CONSEGNA></CONSEGNA>
      </ROW>
    - <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">
      <MANDT>300</MANDT>
      <NETWORK>E60000000000</NETWORK>
      <OPERAZIONE>0010</OPERAZIONE>
      <ID_ACT>2</ID_ACT>
      <DESC_ACT>ATTIVITÀ2</DESC_ACT>
      <LONG_TXT>ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2</LONG_TXT>
      <MAKE_BUY>M</MAKE_BUY>
      <WP></WP>
      <EVENTO_TECH></EVENTO_TECH>
      <TIPO_LEGAME></TIPO_LEGAME>
      <CONSEGNA></CONSEGNA>
      </ROW>
      </TABELLA>
      </asx:values>
      </asx:abap>
    my transformation is
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="ROOT"></tt:root>
      <tt:root name="NETWORK"></tt:root>
      <tt:root name="OPERAZIONE"></tt:root>
      <tt:template>
      <abap>
        <values>
           <network>
               <tt:value ref="NETWORK"></tt:value>
           </network>
           <operazione>
               <tt:value ref="OPERAZIONE"></tt:value>
           </operazione>
           <tabella>
              <tt:loop ref=".ROOT" name="line">
                <mandt>
                  <tt:value ref="$line.mandt"></tt:value>
                </mandt>
                <network>
                  <tt:value ref="$line.network"></tt:value>
                </network>
                <OPERAZIONE>
                  <tt:value ref="$line.OPERAZIONE"></tt:value>
                </OPERAZIONE>
                <ID_ACT>
                  <tt:value ref="$line.ID_ACT"></tt:value>
                </ID_ACT>
                <DESC_ACT>
                  <tt:value ref="$line.DESC_ACT"></tt:value>
                </DESC_ACT>
                <LONG_TXT>
                  <tt:value ref="$line.LONG_TXT"></tt:value>
                </LONG_TXT>
                <MAKE_BUY>
                  <tt:value ref="$line.MAKE_BUY"></tt:value>
                </MAKE_BUY>
                <WP>
                  <tt:value ref="$line.WP"></tt:value>
                </WP>
                <EVENTO_TECH>
                  <tt:value ref="$line.EVENTO_TECH"></tt:value>
                </EVENTO_TECH>
                <TIPO_LEGAME>
                  <tt:value ref="$line.TIPO_LEGAME"></tt:value>
                </TIPO_LEGAME>
                <CONSEGNA>
                  <tt:value ref="$line.CONSEGNA"></tt:value>
                </CONSEGNA>
             </tt:loop>
            </tabella>
          </values>
        </abap>
      </tt:template>
    </tt:transform>
    when I execute my code
    the system dump with this error
    ST_MATCH_FAIL
    excep.  CX_ST_MATCH_ELEMENT
      TRY.
                CALL TRANSFORMATION ('ZT_NETWORK')
                SOURCE XML lv_xml_data_string
                RESULT  network = l_network
                        operazione = l_operazione
                        root = it_data_tmp.
              CATCH cx_sy_conversion_data_loss .
              CATCH cx_xslt_exception INTO xslt_error.
                xslt_message = xslt_error->get_text( ).
                WRITE:/ xslt_message .
            ENDTRY.
    Any help?
    thanks
    enzo

    Enzo Porcasi wrote:
    > I have a problem with a transformation from xml to abap. My XML file (taken from a pdf file) is
    >
    <?xml version="1.0" encoding="iso-8859-1" ?>
    >  <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    >  <asx:values>
    Your XML is strange, it looks like a mix of pdf form content (xfa) and identity transformation (asx).
    Could you explain more ?
    Anyway, I tried to find out the errors (not only cx_st_match_element, that was just a catch missing), it works with the following program. Here are the main issues I have found :
    - always catch exception class cx_st_error when you use simple transformations (it contains cx_st_match_element and all other simple transformation exceptions)
    - xml "asx:abap" and "asx:values" in your input XML are useless, they are only used by identity transformation ("ID"); you may keep them if you want, but I advise you to see why they are in the xml !
    - Use same case in your tags (if xml contains  in the transformation so that it corresponds to the input XML
    - I renamed all abap names with prefix ABAP_ so that to clearly differentiate xml tags and abap field names (so that it is more easy to understand, for every sdn reader; I hope it will help as I didn't find many threads in the forum).
    Simple transformation :
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="ABAP_NETWORK"></tt:root>
      <tt:root name="ABAP_OPERAZIONE"></tt:root>
      <tt:root name="ABAP_TABELLA"></tt:root>
      <tt:template>
        <ROOT>
          <NETWORK>
            <tt:value ref=".ABAP_NETWORK"></tt:value>
          </NETWORK>
          <OPERAZIONE>
            <tt:value ref=".ABAP_OPERAZIONE"></tt:value>
          </OPERAZIONE>
          <TABELLA>
            <tt:loop ref=".ABAP_TABELLA" name="line">
              <ROW>
                <MANDT>
                  <tt:value ref="$line.ABAP_MANDT"></tt:value>
                </MANDT>
                <NETWORK>
                  <tt:value ref="$line.ABAP_NETWORK"></tt:value>
                </NETWORK>
                <OPERAZIONE>
                  <tt:value ref="$line.ABAP_OPERAZIONE"></tt:value>
                </OPERAZIONE>
                <ID_ACT>
                  <tt:value ref="$line.ABAP_ID_ACT"></tt:value>
                </ID_ACT>
                <DESC_ACT>
                  <tt:value ref="$line.ABAP_DESC_ACT"></tt:value>
                </DESC_ACT>
                <LONG_TXT>
                  <tt:value ref="$line.ABAP_LONG_TXT"></tt:value>
                </LONG_TXT>
                <MAKE_BUY>
                  <tt:value ref="$line.ABAP_MAKE_BUY"></tt:value>
                </MAKE_BUY>
                <WP>
                  <tt:value ref="$line.ABAP_WP"></tt:value>
                </WP>
                <EVENTO_TECH>
                  <tt:value ref="$line.ABAP_EVENTO_TECH"></tt:value>
                </EVENTO_TECH>
                <TIPO_LEGAME>
                  <tt:value ref="$line.ABAP_TIPO_LEGAME"></tt:value>
                </TIPO_LEGAME>
                <CONSEGNA>
                  <tt:value ref="$line.ABAP_CONSEGNA"></tt:value>
                </CONSEGNA>
              </ROW>
            </tt:loop>
          </TABELLA>
        </ROOT>
      </tt:template>
    </tt:transform>
    Program and XML included :
    REPORT  zsro2.
    DATA l_network TYPE string.
    DATA l_operazione TYPE string.
    DATA : BEGIN OF lt_data_tmp OCCURS 0,
             abap_mandt      TYPE string,
             abap_network    TYPE string,
             abap_operazione TYPE string,
             abap_id_act     TYPE string,
             abap_desc_act   TYPE string,
             abap_long_txt   TYPE string,
             abap_make_buy   TYPE string,
             abap_wp         TYPE string,
             abap_evento_tech TYPE string,
             abap_tipo_legame TYPE string,
             abap_consegna   TYPE string,
           END OF lt_data_tmp.
    DATA xslt_error TYPE REF TO cx_xslt_exception.
    DATA lo_st_error TYPE REF TO cx_st_error.
    DATA lv_xml_data_string TYPE string.
    DATA xslt_message TYPE string.
    DEFINE conc.
      concatenate lv_xml_data_string &1 into lv_xml_data_string.
    END-OF-DEFINITION.
    *conc '<?xml version="1.0" encoding="iso-8859-1" ?>'.
    *conc '<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">'.
    *conc '  <asx:values>'.
    conc ' <ROOT>'.
    conc '    <NETWORK>E60000000000</NETWORK> '.
    conc '    <OPERAZIONE>0010</OPERAZIONE> '.
    conc '    <TABELLA>'.
    conc '      <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">'.
    conc '        <MANDT>300</MANDT> '.
    conc '        <NETWORK>E60000000000</NETWORK> '.
    conc '        <OPERAZIONE>0010</OPERAZIONE> '.
    conc '        <ID_ACT>1</ID_ACT> '.
    conc '        <DESC_ACT>ATTIVITÀ1</DESC_ACT> '.
    conc '        <LONG_TXT></LONG_TXT> '.
    conc '        <MAKE_BUY></MAKE_BUY> '.
    conc '        <WP></WP> '.
    conc '        <EVENTO_TECH></EVENTO_TECH> '.
    conc '        <TIPO_LEGAME></TIPO_LEGAME> '.
    conc '        <CONSEGNA></CONSEGNA> '.
    conc '      </ROW>'.
    conc '      <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">'.
    conc '        <MANDT>300</MANDT> '.
    conc '        <NETWORK>E60000000000</NETWORK> '.
    conc '        <OPERAZIONE>0010</OPERAZIONE> '.
    conc '        <ID_ACT>2</ID_ACT> '.
    conc '        <DESC_ACT>ATTIVITÀ2</DESC_ACT> '.
    conc '        <LONG_TXT>ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2</LONG_TXT> '.
    conc '        <MAKE_BUY>M</MAKE_BUY> '.
    conc '        <WP></WP> '.
    conc '        <EVENTO_TECH></EVENTO_TECH> '.
    conc '        <TIPO_LEGAME></TIPO_LEGAME> '.
    conc '        <CONSEGNA></CONSEGNA> '.
    conc '      </ROW>'.
    conc '    </TABELLA>'.
    conc ' </ROOT>'.
    *conc '  </asx:values>'.
    *conc '</asx:abap>'.
    DATA lv_xml_data_string_2 TYPE string.
    TRY.
        CALL TRANSFORMATION zsro
              SOURCE
                XML lv_xml_data_string
              RESULT
                abap_network    = l_network
                abap_operazione = l_operazione
                abap_tabella    = lt_data_tmp[].
      CATCH cx_sy_conversion_data_loss .
      CATCH cx_st_error INTO lo_st_error.
        xslt_message = lo_st_error->get_text( ).
        WRITE:/ xslt_message .
      CATCH cx_xslt_exception INTO xslt_error.
        xslt_message = xslt_error->get_text( ).
        WRITE:/ xslt_message .
    ENDTRY.
    BREAK-POINT.

  • Inserting a node in XML and retaining the doc type

    Hi All,
    I want to insert one new node in an XML. Using the following code I can do that. But the problem is if the XML has doc type declaration then its giving me problem. After inserting the node the transformer is removing my doc type declaration from the XML. I have to retain the doc type definition (including entity declaration) as it is in the original XML file.
    The following is the code that I'm using.
    Document vDoc = null;
    try {
    // Contruct the DOM document
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    vDoc = builder.newDocument();
    Node vFormNode = vDoc.createElement("Form");
    vDoc.appendChild(vFormNode);
    // Convert into a String the DOM document
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    DOMSource source = new DOMSource(vDoc);
    StringWriter sw = new StringWriter();
    StreamResult result = new StreamResult(sw);
    transformer.transform(source, result);
    catch (Exception e) {
    System.out.println("Error: " + e.getMessage());
    }The doc type def. in the original file is some thing like this.
    <!DOCTYPE article SYSTEM "someurl/TFJA.dtd"[
    <!ENTITY T0001 SYSTEM ".\BTN_A_000112809_O_XML_IMAGES\BTN_A_000112809_O_T0001.gif" NDATA GIF>
    <!ENTITY F0001 SYSTEM ".\BTN_A_000112809_O_XML_IMAGES\BTN_A_000112809_O_F0001g.gif" NDATA GIF>
    <!ENTITY F0002 SYSTEM ".\BTN_A_000112809_O_XML_IMAGES\BTN_A_000112809_O_F0002g.jpg" NDATA JPEG>
    ]>I know that I can set up the doc type definition in the new XML using the following properties of the transformer.
    transformer.setOutputProperty( OutputKeys.DOCTYPE_SYSTEM,"article" );
    transformer.setOutputProperty( OutputKeys.DOCTYPE_PUBLIC,"my DTD def");
    I cannot hard code the DTD def. as it can vary from one XML to another. Using doc.getDocType() I can get the doctype of the original XML. But is it is not returning the complete def. including entities declaration. Its giving me "someurl/TFJA.dtd".
    Is there any way to retain the complete doc type in the original XML file? I don't have much experience in XML and this issue is eating my head.. Also do I have to modify the DTD to accommodate the new tags added in order to make it a valid XML?
    Any help and sample code would be highly appreciated.

    Hi,
    I also had similar requirement and when searching i came across this post. Later i found the solution for this. Instead of hardcoding the doctype you can get it from Document as follows..Snippet from the code i used..
    DocumentType doctype = document.getDoctype();
    if(doctype != null) {
                   String id = doctype.getSystemId();
                   if(id == null || id.length() == 0)
                        return;
                   transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, id);
                   id = doctype.getPublicId();
                   if(id == null || id.length() == 0)
                        return;
                   transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, id);
    Hope this helps.
    Regards,
    Deepak

  • XML and Air Issues

    Hi guys, first time poster so I apologize if this is a basic
    question! I am creating a Media cataloging application to run as a
    desktop application through Air, I initially built this as a Flex
    web app but have decided I want it as a standalone. Anyway my
    problem is this, in the web version I was using the following code:
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="srv.send()"
    xmlns:ns1="com.dougmccune.containers.*"
    backgroundGradientAlphas="[1.0, 1.0]"
    backgroundGradientColors="[#FFFFFF, #2CE1AC]" width="1281">
    <mx:HTTPService id="srv" url="dvdLibrary.xml"/>
    <mx:DataGrid x="336" y="57"
    dataProvider="{srv.lastResult.dvdList.dvd}" id="dg" width="935"
    height="354">
    <mx:columns>
    <mx:DataGridColumn headerText="Title"
    dataField="title"/>
    <mx:DataGridColumn headerText="Studio"
    dataField="studio"/>
    <mx:DataGridColumn headerText="Released"
    dataField="releaseDate"/>
    <mx:DataGridColumn headerText="Runtime"
    dataField="runtime"/>
    <mx:DataGridColumn headerText="Colour"
    dataField="color"/>
    <mx:DataGridColumn headerText="Aspect Ratio"
    dataField="aspectRatio"/>
    </mx:columns>
    </mx:DataGrid>
    The above code uses the XML file to populate the dataGrid
    (which I am sure you know already! :) ), however when I port this
    to an Air app, it no longer works. I have tried changing the
    <mx:HTTPService> tag and attributes to the <mx:XML
    source="pathtoXML.xml" id="srv"/> and <mx:Model
    source="pathtoXML.xml" id="srv"/> but neither works.
    Can anyone shed any light? I also get and error saying
    something about creationComplete send() is not a function?
    Is there a very different way of achieving this in Air?
    Thanks in advance!

    Hi guys, first time poster so I apologize if this is a basic
    question! I am creating a Media cataloging application to run as a
    desktop application through Air, I initially built this as a Flex
    web app but have decided I want it as a standalone. Anyway my
    problem is this, in the web version I was using the following code:
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="srv.send()"
    xmlns:ns1="com.dougmccune.containers.*"
    backgroundGradientAlphas="[1.0, 1.0]"
    backgroundGradientColors="[#FFFFFF, #2CE1AC]" width="1281">
    <mx:HTTPService id="srv" url="dvdLibrary.xml"/>
    <mx:DataGrid x="336" y="57"
    dataProvider="{srv.lastResult.dvdList.dvd}" id="dg" width="935"
    height="354">
    <mx:columns>
    <mx:DataGridColumn headerText="Title"
    dataField="title"/>
    <mx:DataGridColumn headerText="Studio"
    dataField="studio"/>
    <mx:DataGridColumn headerText="Released"
    dataField="releaseDate"/>
    <mx:DataGridColumn headerText="Runtime"
    dataField="runtime"/>
    <mx:DataGridColumn headerText="Colour"
    dataField="color"/>
    <mx:DataGridColumn headerText="Aspect Ratio"
    dataField="aspectRatio"/>
    </mx:columns>
    </mx:DataGrid>
    The above code uses the XML file to populate the dataGrid
    (which I am sure you know already! :) ), however when I port this
    to an Air app, it no longer works. I have tried changing the
    <mx:HTTPService> tag and attributes to the <mx:XML
    source="pathtoXML.xml" id="srv"/> and <mx:Model
    source="pathtoXML.xml" id="srv"/> but neither works.
    Can anyone shed any light? I also get and error saying
    something about creationComplete send() is not a function?
    Is there a very different way of achieving this in Air?
    Thanks in advance!

  • Transform xml datas

    Hi,
    I'm a real newbie in XML and Java. But I must use Java for this.
    But all I want to do is the following:
    I generate a XML file like this:
    <day atday=12><hour athour=10><minute atminute=10>
    <second atsecond=20>value1</second>
    <second atsecond=21>value2</second>
    <second atsecond=22>value3</second>
    </minute></hour>
    <hour athour=11><minute atminute=10>
    <second atsecond=10>value4</second>
    <second atsecond=11>value5</second>
    </minute></hour></day>
    Now I want to transform this to csv. Such that there is for every value in row2 the suitable date in row1.
    Something like that:
    12 10 10 20, value1
    12 10 10 21, value2
    12 10 10 22, value3
    12 11 10 22, value4
    If you have some similar code...please send it.
    I need code which I can modify.
    Thx

    please refering jasperreports project in www.sourceforge.com.

  • Using XSLT to link XML and ABAP data

    Hi Experts,
    I am using XSLT to deal with XML and ABAP data.
    I using the following statement to convert a Internal Table to XML String:
    CALL TRANSFORMATION id SOURCE  root = lt_sflight RESULT XML l_xml_string.
    And I get the XML String:
    <?xml version="1.0" encoding="utf-16" ?>
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <ROOT>
    <SFLIGHT>
    </SFLIGHT>
    <SFLIGHT>
    </SFLIGHT>
    </ROOT>
    </asx:values>
    </asx:abap>
    But What I expected is:
    <?xml version="1.0" encoding="utf-16" ?>
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <ROOT>
    <DATA>
    </DATA>
    <DATA>
    </DATA>
    </ROOT>
    </asx:values>
    </asx:abap>
    Could you tell me how to get my dream format using XSLT?
    Best Regards,
    Guo Guo Qing
    Edited by: guoqing guo on Jun 11, 2008 9:58 AM

    Hi Experts,
    I am using XSLT to deal with XML and ABAP data.
    I using the following statement to convert a Internal Table to XML String:
    CALL TRANSFORMATION id SOURCE  root = lt_sflight RESULT XML l_xml_string.
    And I get the XML String:
    <?xml version="1.0" encoding="utf-16" ?>
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <ROOT>
    <SFLIGHT>
    </SFLIGHT>
    <SFLIGHT>
    </SFLIGHT>
    </ROOT>
    </asx:values>
    </asx:abap>
    But What I expected is:
    <?xml version="1.0" encoding="utf-16" ?>
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <ROOT>
    <DATA>
    </DATA>
    <DATA>
    </DATA>
    </ROOT>
    </asx:values>
    </asx:abap>
    Could you tell me how to get my dream format using XSLT?
    Best Regards,
    Guo Guo Qing
    Edited by: guoqing guo on Jun 11, 2008 9:58 AM

  • Transforming XML/XSLT : CDATA problem

    Hi!
    I have a problem transforming xml with XSLT using the API javax.xml.
    The result is correct until I have a CDATA section in my xml document.
    The transforming process encodes all the & < > (special characters) it finds in.
    This occurs problem for the follow of my treatement because the content of my CDATA is already encoded.
    For example, this xml code :
    <?xml version='1.0' encoding="ISO-8859-1" ?>
    <article>
    <article-contenu><![CDATA[Accent : &eacute; Signe : &lt;]]></article-contenu>
    </article>
    produces in my output :
    Accent : &amp;eacute; Signe : &amp;lt;
    This is my java code :
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(readerXml);
    Source xslSource = new StreamSource( fileXsl );
    // Generate the transformer.
    Transformer transformer = tFactory.newTransformer(xslSource);
    // Perform the transformation, sending the output to the response.
    transformer.transform(xmlSource, new javax.xml.transform.stream.StreamResult(sw));
    How can I tell the transformer not to do that?
    Thanks for your answers!

    I am having a similar problem. I have enclosed my text data in my xml file like this:
    <![CDATA[<b>Hello World!</b>]]>
    My select statement in my XSLT sheet is as follows:
    <xsl:value-of select="." disable-output-escaping="yes"/>
    I have tried setting xsl:output to text, to html, and to xml. The <, >, and & get converted to xhtml entities.
    Where should I begin to troubleshoot? If the Xalan xslt jars? My stylesheet. My xml doc? Java code?
    Any feedback welcome.

Maybe you are looking for

  • Alarms in subscribed calendars - can they be switched off?

    I share my Google calendar with my partner on her iPhone but it seems that the alarms on the entries go off on her phone even when she has it set to look at her own calendar. Is there a way anyone knows of preventing this please?

  • Can't get a network aggregate/bond to work properly

    *I am trying to accomplish network teaming in the Windows world* I have my Mac Pro wired with two Ethernet cables to my Time Capsule. In Network preferences I show Ethernet 1 and Ethernet 2 connected. I go and create a new aggregate called "Bond1" an

  • Insert a blank line in a form

    Is there any way to insert a blank line into a form? The only thing I can think of is to insert an empty display as text item with no label. Is there an easier way?

  • Display burn-in problem

    Hello all. I noticed that my 3G display burns in at the bottom right. I already can read the text "iPod" if the screen is black (comes from the ipod-icon there). Also the area gets lighter and visibly bigger every day. Not bad for 10 days use and app

  • Auto-fill like problems

    I want to keep Safari from trying to automatically guess what I am typing the browser bar/search bar (where I enter the http://www.xyz.com address). I want to disable the automatic guessing feature. I can't find anything in the Safari help literature