XML Nested Structure

Hello,
I am building menu menu from the xml file using Spry Widget.
My XML structure is
main id="002">
<title>Payment Reports</title>
<link>#</link>
<submenu id="21">
<linkinner>/lckbx/main/payment_default</linkinner>
<titleinner>Check Payment Report</titleinner>
</submenu>
<submenu id="22">
<linkinner>/lckbx/main/postedpayment_default</linkinner>
<titleinner>Posted Payment Report</titleinner>
</submenu>
</main>
My nested xml calls are
var dsItems = new
Spry.Data.XMLDataSet("/menu/lockbox_menu.xml", "/buildmenu/main");
// Setup a couple of nested data sets:
var subItems = new Spry.Data.NestedXMLDataSet(dsItems,
"submenu/titleinner", "submenu/linkinner");
My problem is I am not be able to access the value of
"submenu/linkinner" from the xml file.
<li spry:repeat="subItems"
title="{subItems::titleinner}"><a
href="{subItems::linkinner}">{subItems::titleinner}</a></li>
I can not either create and use the thrid dataset as nested
data regions are not allowed if I create a third data set then they
over laps.
I can only fetch the value from the first element of the
nested structure. Please help me out how to fetch value from the
second sub value from nested tag.
Thank you,
Kamal.

Kamal,
The problem lies in your constructor for the
nestedXMLDataSet. That constructor should have only two arguments
(it can have optional arguements as well, but it's not necessary to
go into those to solve your issue). The two arguments for the
nestedXMLDataSet constructor should be, the previously defined
DataSet and the xPath for the nested data.
You could solve this a couple ways. This would be a way to do
it without changing your XML file (or much else) -- change your
nestedXMLDataSet constructor to provide only one xPath argument at
the "submenu" level of your XML doc:
<script type="text/javascript">
<!--//
var dsItems = new
Spry.Data.XMLDataSet("/menu/lockbox_menu.xml", "/buildmenu/main");
var subItems = new Spry.Data.NestedXMLDataSet(dsItems,
"submenu");
//-->
</script>
For your nestedXMLDataSet, you need only go one level further
(beyond the level indicated in the dsItems dataSet) to get to the
data you want. The <linkinner> and <titleinner> tags
are both child nodes nested at the same level below the
<submenu> node of your XML doc, so you can access them then
(when your nested set is simply "submenu") by the tag names, as in:
{subItems::linkinner}
Accessing them in your page body would look like this:
<div spry:region="dsItems subItems">
<ul>
<li spry:repeat="subItems"
title="{subItems::titleinner}"><a
href="{subItems::linkinner}">{subItems::titleinner}</a></li>
</ul>
</div>
For the spry:region, reference the primary dataSet (dsItems)
as well as the nested set (subItems), and then the rest of it for
the list item is the same as what you already listed in your post.
-dustin-

Similar Messages

  • Message Mapping Nested Structure to key node in JDBC XML SQL Structure

    Hello everybody,
    I'm facing the next problem, I have the following nested structure
    <ns0:MT_Irdoc_ArchivoNested xmlns:ns0="http://ref.pemex.com/PI/FI/ArchivoIrdoc">
       <Header id_consecutivo="">
          <Transaction/>
          <Header2/>
          <Header3/>
          <Header4/>
          <Header5/>
          <Detail>
             <Transaction/>
             <Detail2/>
             <Detail3/>
             <Detail4/>
             <Detail5/>
          </Detail>
       </Header>
       <NombreArchivo/>
    </ns0:MT_Irdoc_ArchivoNested>
    as you can see, Detail is a nested Node from Header Node, and Detail is with occurrence 0...unbounded, I need to generate a SELECT XML SQL Structure as follows
       <StatementName>
              <dbTableName action=u201DSELECTu201D>
                  <table>realDbTableName</table>
                  <access>
                     <col1/>
                     <col2/>
                     <col3/>
                  </access>
                  <key1>
                     <col4>val4</col4>
                     <col5>val5</col5>
                     <col6>val6</col6>
                  </key1>
              </dbTableName> 
       </StatementName>
    now my problem is that col4 and col6 are values mapped from Header fields values, and col5 mus be mapped from Detail2 field of Detail Nested Structure, and Detail is 0...unbounded so it can contain any number of values and must included in the key structure, I tried by mapping the Detail Node to the key1 node, so it will generate n numbers of key1 nodes to include in the query, and the Detail number of nodes are not constant so I can't generate key2, key3, keyn...., so what I need is to create n numbers of instances of key1 node, but the problem is that when the mapping try to generate the second instance of key1 node it gives an error in the fields that comes from Header structure, maybe I'm trying to solve my problem wrong, could anyone give some advices or direction?, thanks in advance.
    Regards,
    Julio Cesar

    Julio,
    After placing the below logic in the mapping editor
    Details2 > SplitByValue> col5
    Right click on the Details2 node and choose Context. By Default you will see Details, because Details2 is the child of Details node. I want you to choose the Parent of Details node, I believe that would be HeaderID, am I right?
    If you don't want to do that then,
    Details2 ---> Remove Context > SplitByvalue> col5 will do the trick!
    raj.

  • File sender adapter: Content conversion for very deep nested structure

    Hi all
    I have a file which looks like this
    HDOCKET    9800000660980000061911062009AA123456bbWM100012349800000619
    DDOCKET_TEST001 4012YAG1 
    WZOA00000000010000000001
    WZOA00000000020000000002
    WZOB00000000030000000003
    IAAXX000001
    IAAXX000002
    C0000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004
    T2
    and my structure is
    Header  - 1
    Detail     - 0....Unbounded
            Bag     - 0.....Unbounded   (sub node of detail)
            Track  - 0.....Unbounded    (sub node of detail)
            Customer - 0.....Unbounded    (sub node of detail)
    Trailer    - 1
    and in the file sender adapter i mentioned the following content conversion setting
    HEADER,1,DETAIL,*,Bag,*,Track,*,Customer,*,TRAILER,*
    But when i go and see in the monitoring i received the following conversion
    <?xml version="1.0" encoding="utf-8" ?>
    <ns:MT_REQ xmlns:ns="http://royalmail.com/dd_c">
    <HEADER>
      <ID>H</ID>
      <INT>DD</INT>
      <CAR>9899999660</CAR>
      <CUS>9899999619</CUS>
      <POST>11062009</POST>
      <NUMBER>AA123456bbWM10001234</NUMBER>
      <ACC>9899999619</ACC>
      </HEADER>
    <DETAIL>
      <ID>D</ID>
      <Bag>DOCKET_TEST001</Bag>
      <S>4012</S>
      <Code>YAG</Code>
      <mat>1</mat>
      <count/>
      <Mixed />
      </DETAIL>
    <Bag>
      <ID>W</ID>
      <Zone>ZOA</Zone>
      <Item>0000000001</Item>
      <Number>0000000001</Number>
      </Bag>
    <Bag>
      <ID>W</ID>
      <Zone>ZOA</Zone>
      <Item>0000000001</Item>
      <Number>0000000001</Number>
      </Bag>
    <Bag>
      <ID>W</ID>
      <Zone>ZOA</Zone>
      <Item>0000000001</Item>
      <Number>0000000001</Number>
      </Bag>
      </Bag>
    <Track>
      <ID>I</ID>
      <Item>AAXX000001</Item>
      </Track>
    <Track>
      <ID>I</ID>
      <Item>AAXX000001</Item>
      </Tracked>
    <Customer>
      <ID>C</ID>
      <OrigCustomer>00000000000000000001</OrigCustomer>
      <Field1>00000000000000000001</Field1>
      <Field2>00000000000000000002</Field2>
      <Field3>00000000000000000003</Field3>
      <Field4>00000000000000000004</Field4>
      </Customer>
    <TRAILER>
      <ID>T</ID>
      <Count>2</Count>
      </TRAILER>
      </ns:MT_REQ>
    whereas i wanted it like:
    <?xml version="1.0" encoding="utf-8" ?>
    <ns:MT_REQ xmlns:ns="http://royalmail.com/dd_c">
    <HEADER>
      <ID>H</ID>
      <INT>DD</INT>
      <CAR>9899999660</CAR>
      <CUS>9899999619</CUS>
      <POST>11062009</POST>
      <NUMBER>AA123456bbWM10001234</NUMBER>
      <ACC>9899999619</ACC>
      </HEADER>
    <DETAIL>
      <ID>D</ID>
      <Bag>DD_TEST001</Bag>
      <S>4012</S>
      <Code>egg</Code>
      <mat>1</mat>
      <count/>
      <Mixed />
    <Bag>
      <ID>W</ID>
      <Zone>zzz</Zone>
      <Item>0000000001</Item>
      <Number>0000000001</Number>
      </Bag>
    <Bag>
      <ID>W</ID>
      <Zone>zzz</Zone>
      <Item>0000000001</Item>
      <Number>0000000001</Number>
      </Bag>
    <Bag>
      <ID>W</ID>
      <Zone>zzz</Zone>
      <Item>0000000001</Item>
      <Number>0000000001</Number>
      </Bag>
      </Bag>
    <Track>
      <ID>I</ID>
      <Item>AAXX000001</Item>
      </Track>
    <Track>
      <ID>I</ID>
      <Item>AAXX000001</Item>
      </Tracked>
    <Customer>
      <ID>C</ID>
      <OrigCustomer>00000000000000000001</OrigCustomer>
      <Field1>00000000000000000001</Field1>
      <Field2>00000000000000000002</Field2>
      <Field3>00000000000000000003</Field3>
      <Field4>00000000000000000004</Field4>
      </Customer>
    </DETAIL>
    <DETAIL>
      <ID>D</ID>
      <Bag>DD_TEST002</Bag>
      <S>4012</S>
      <Code>egg</Code>
      <mat>1</mat>
      <count/>
      <Mixed />
    <Bag>
      <ID>W</ID>
      <Zone>zzzzzz</Zone>
      <Item>0000000001</Item>
      <Number>0000000001</Number>
      </Bag>
    <Bag>
      <ID>W</ID>
      <Zone>ZOA</Zone>
      <Item>0000000001</Item>
      <Number>0000000001</Number>
      </Bag>
    <Bag>
      <ID>W</ID>
      <Zone>zzz</Zone>
      <Item>0000000001</Item>
      <Number>0000000001</Number>
      </Bag>
      </Bag>
    <Track>
      <ID>I</ID>
      <Item>AAXX000001</Item>
      </Track>
    <Track>
      <ID>I</ID>
      <Item>AAXX000001</Item>
      </Tracked>
    <Customer>
      <ID>C</ID>
      <OrigCustomer>00000000000000000001</OrigCustomer>
      <Field1>00000000000000000001</Field1>
      <Field2>00000000000000000002</Field2>
      <Field3>00000000000000000003</Field3>
      <Field4>00000000000000000004</Field4>
      </Customer>
    </DETAIL>
    <TRAILER>
      <ID>T</ID>
      <Count>2</Count>
      </TRAILER>
      </ns:MT_REQ>
    i.e. i need all Bag ,Track and Customer inside detail tag.
    could anyone help me in this..i've already searched SDN and got some link as useful but none of them were totally related.
    Regards
    Naina

    Naina
    Pls. check my forum link, i had the single level hierarchy XML file which I converted into nested structure & then into flat file.
    File Conversion in Rec File Adapter with subnodes
    This can give you an idea how to go ahead. Let me know in case you need any more info about this.

  • Nested Structure handling in XML2Plain module of receiver SFTP aadaptor

    Dear Experts,
    Greeting for the day...
    I am working on Receiver SFTP Adaptor scenario where I have to generate CSV file at receiver end. I am using XML2Plain module for the same. But I have a nested structure at receiver end. Receiver structure is given below.
    General Header
       Packet1
          Node1
               Field1, Field2...
          Node2
               Field1, Field2..
          Node3
               Field1, Field2..
          Node4
               Field1, Field2..
       Packet2
          Node1
               Field1, Field2...
          Node2
               Field1,Field2...
          Node3
               Field1, Field2...
          Node4
               Field1, Field2..
    File structure is as given below
    General Header
    Node1-field1,Field2..
    Node2-Field1,Field2..
    Node3-field1,Field2..
    Node4-Field1,Field2..
    Node1-field1,Field2..
    Node2-Field1,Field2..
    Node3-field1,Field2..
    Node4-Field1,Field2..
    I tried regular XML2Plain configuration but it is giving error "Message processing failed in XML parser: 'Conversion configuration error: Unknown structure 'Node1'".
    Kindly suggest..
    Thanks in advance.
    Vinit.

    hi Vinit,
    You can add another message mapping next to the original one such that Node1 can be treated as a field in new target and concat fields of Node1 with comma.
    this way u can bring down the levels.
    and finally the output mapping will look something like this
    [General Header]
    [Node1-field1,Field2..] [Node2-Field1,Field2..] [Node3-field1,Field2..] [Node4-Field1,Field2.]
    [Node1-field1,Field2..] [Node2-Field1,Field2..] [Node3-field1,Field2..] [Node4-Field1,Field2.]
    [Node1-field1,Field2..] [Node2-Field1,Field2..] [Node3-field1,Field2..] [Node4-Field1,Field2.]
    [Node1-field1,Field2..] [Node2-Field1,Field2..] [Node3-field1,Field2..] [Node4-Field1,Field2.]
    then in the channel u can give
    field separator  for the node fields as 'nl' which will bring your output as below.
    General Header
    Node1-field1,Field2..
    Node2-Field1,Field2..
    Node3-field1,Field2..
    Node4-Field1,Field2..
    Node1-field1,Field2..
    Node2-Field1,Field2..
    Node3-field1,Field2..
    Node4-Field1,Field2..
    hope this helps
    thanks and regards,
    Praveen T

  • Nested structure and FCC problem (Header Problem)

    Hi all,
    I have a target structure like this:
    MT
    -Recordset (0..unbounded)
    --field1 (1)
    --field2 (1)
    Record (0..unbounded)
    field6 (0..1)
    field7 (0..1)
    After mapping:
    MT
    -Recordset (0..unbounded)
    --field1 (1)
    --field2 (1)
    Record (0..unbounded)
    field6 (0..1)
    field7 (0..1)
    -Recordset (0..unbounded)
    --field1 (1)
    --field2 (1)
    Record (0..unbounded)
    field6 (0..1)
    field7 (0..1)
    -Recordset (0..unbounded)
    --field1 (1)
    --field2 (1)
    Record (0..unbounded)
    field6 (0..1)
    field7 (0..1)
    I need header like this after FCC:
    field1,field2, field6,field7
    But Iu2019m getting something like this:
    field1,field2,Record (Because of the nested structure, I can't change the structure)
    I have used xml.addHeaderLine = 1 it didnu2019t work it gives something like the above structure.
    I have also used xml.HeaderLine = field1,field2,field6,field7  and xml.addHeaderLine =3
    Nothing is working is there any option.
    Thanks,
    Srinivas
    Edited by: Srinivas Davuluri on Jul 17, 2008 10:13 PM

    Hi,
    one option could be
    RecordSet.addHeaderLine = 3
    Recordset.headerLine = field1<ur seperator>field2<ur seperator> field6<ur seperator> field7
    Edited by: Progirl Progirl on Jul 18, 2008 9:50 AM

  • Query on Receiver FCC for nested structure

    Hi Friends,
    I want to  configure the Receiver side FCC for the below nested structure.
    Can you guide me how can i achicve it? or its not possible for nested structure?
    Seg100,Seg200.Seg300 and Seg400 are nested one below the other.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:Test xmlns:ns0="http://hello.com">
    --<Seg100>
    --<field1>0000564.30</field1>
    --<field2>KG</field2>
    --<Seg200>
    ---<field3>1070</field3>
    ---<Seg300>
    <field4>5</field4>
    <Seg400>
    <field4>5</field4>
    </Seg400>
    ---</Seg300>
    --</Seg200>
    -</Seg100>
    </ns0:Test>
    Regards
    Venkatesh

    Hi,
      For nested structure we cont do the File content conversion.
      so that we need to convert it a flat structure in the mapping level and then we can go for FCC.
    Regards,
    Prakasu

  • Exracting Nested Structure as raw String

    Hi all, I think this is a unique problem, and was wondering if anyone else has encountered this, or has clean suggestion.
    lets say the xml is as follows:
    <foo>
       <bar>
       </bar>
       <stuff>
          <sometag>
           </sometag>
       </stuff>
    </foo>I'm using a DOM parser, and when ever I hit the tag bar, the code will nest down parse/extract all the nested structures there in (pretty standard stuff).
    But when I hit the tag called stuff (I do not want to 'parse' it per say), I just want to retrieve the entire payload as one string (including all nested nodes), (i.e. i don't care about the underlaying node details)..I just need to shove the entire contents of "<sturff>" into a database..as 1 string.
    any suggestions on how to do this with a DOM parser cleanly, or will I be forced to walk the structure to obtain it.
    Thanx in advance

    grab the stuff node and serialize it to a string.

  • Import XML  Nested tags

    Hi all
    Here is my XML file structure
    <book>
    <section title="My Life">
    <p>
    <ol>
    <li>item 1</li>
    <li>item 2</li>
    <li>item 3</li>
    <li>item 4
        <ol>
            <li>item 1</li>
            <li>item 2</li>
            <li>item 3</li>
        </ol>
    </li>
    </ol>
    </p>
    </section>
    </book>
    I need to do two things from my XML file
    one
    I have a problem with importing my xml file. I have nested tags in my xml file. list inside list. While I am mapping tags to styles I am hang I can’t map different styles to my nested list 2nd level list. I am working with IDCS3. Is there any way to map my nested tag?
    in short
    list level One > Item 1
    TagName: <li>
    Paragraph style>ListIndentOne
    list level Two > Item 1
    TagName: <li>
    Paragraph style>ListIndentTwo
    two
    The next problem is I need to pint the value of my tag variables into indesign document is this is possible?
    <section title="My Life">
    I need to print the value of the variable value "My Life" as title style in my document.
    thanks in advance
    reagrds
    a r u l

    Hi all
    Here is my XML file structure
    <book>
    <section title="My Life">
    <p>
    <ol>
    <li>item 1</li>
    <li>item 2</li>
    <li>item 3</li>
    <li>item 4
        <ol>
            <li>item 1</li>
            <li>item 2</li>
            <li>item 3</li>
        </ol>
    </li>
    </ol>
    </p>
    </section>
    </book>
    I need to do two things from my XML file
    one
    I have a problem with importing my xml file. I have nested tags in my xml file. list inside list. While I am mapping tags to styles I am hang I can’t map different styles to my nested list 2nd level list. I am working with IDCS3. Is there any way to map my nested tag?
    in short
    list level One > Item 1
    TagName: <li>
    Paragraph style>ListIndentOne
    list level Two > Item 1
    TagName: <li>
    Paragraph style>ListIndentTwo
    two
    The next problem is I need to pint the value of my tag variables into indesign document is this is possible?
    <section title="My Life">
    I need to print the value of the variable value "My Life" as title style in my document.
    thanks in advance
    reagrds
    a r u l

  • Map flat to nested structure by creating a collection

    Hi All,
    I've got a problem by mapping a flat to a nested structure.
    The source structure looks like that:
    <b>ISIN</b> = DE00000123450
    <b>WKN</b>  = 012345
    The target structure is build as a collection of identifers:
    <i><b>IDENTIFIER (1..unbounded)</b></i>
    <b>ID</b>    = 01
    <b>TYPE</b>  = Isin
    <b>VALUE</b> = DE00000123450
    <b>ID</b>    = 02
    <b>TYPE</b>  = Wkn
    <b>VALUE</b> = 012345
    Now, it's impossible for me to append a new record to this identifier collection by using the plain mapping functionality without java functions.
    Did anybody face and solve this problem?

    Hi Bhavesh, Marcus,
    I'd like to refine the above problem somewhat ..
    The main problem here is not to map an element name of a source document to an element value of a destination document, but to construct a collection from a list of source element values (Isin->Value, Wkn->Value):
    ("." are just for prettyprinting)
    Source_1:
    <PRICES>
    ....<Price>
    ........<Isin>DE0123456</Isin>
    ........<Wkn>123456</Wkn>
    ........<Currency>USD</Currency>
    ........<Amount>123.45</Amount>
    ....</Price>
    ....<Price>
    ........<Isin>DE0123457</Isin>
    ........<Wkn>123457</Wkn>
    ........<Currency>EUR</Currency>
    ........<Amount>987.65</Amount>
    ....</Price>
    </PRICES>
    Destination_1:
    <PRICES>
    ....<Price>
    ........<IDENTIFIERS>
    ............<Identifier>
    ................<Key>ISIN</Key>
    ................<Value>DE0123456</Value>
    ............</Identifier>
    ............<Identifier>
    ................<Key>WKN</Key>
    ................<Value>123456</Value>
    ............</Identifier>
    ........</IDENTIFIERS>
    ........<Currency>USD</Currency>
    ........<Amount>123.45</Amount>
    ....</Price>
    ....<Price>
    ........<IDENTIFIERS>
    ............<Identifier>
    ................<Key>ISIN</Key>
    ................<Value>DE0123457</Value>
    ............</Identifier>
    ............<Identifier>
    ................<Key>WKN</Key>
    ................<Value>123457</Value>
    ............</Identifier>
    ........</IDENTIFIERS>
    ........<Currency>EUR</Currency>
    ........<Amount>987.65</Amount>
    ....</Price>
    </PRICES>
    So the main question for me seems to be: How to do the transpose of Isin and Wkn to the Value elements:
    Source_2:
    <Price>
    ....<Isin>DE0123456</Isin>
    ....<Wkn>123456</Wkn>
    ....<Currency>USD</Currency>
    ....<Amount>123.45</Amount>
    </Price>
    Destination_2:
    <Price>
    ....<IDENTIFIERS>
    ........<Value>DE0123457</Value>
    ........<Value>123457</Value>
    ....</IDENTIFIERS>
    ....<Currency>EUR</Currency>
    ....<Amount>987.65</Amount>
    </Price>
    Since the length of the source list has very few items (comparable to columns in a database table), they could easily be set as constant Key's in the destination. The problem is: how to map element values of different source elements  (Isin, Wkn) into a collection of destination elements (comparable to rows in a database table). The mapping from Destination_2 to Destination_1 could be done by a SplitByValue.
    I couldn't find a mapping in the GUI which allows to do the latter mapping. More precisely to sort-of reference the destination elements by an index or to simply add more elements to the collection without overwriting the first one.
    A Java Mapping doesn't seem to be appropriate, since it seems, that only 1 result value can be returned (or is it possible to modify the destination DOM/XML with a Java Mapping ? Or to return a list of values ?).
    An XSLT Mapping seems to be possible, but unfortunately it imposes bigger efforts when additionally conversions or value-mappings are needed.
    In the case that XSLT mapping is the only solution to the problem: is it possible, to do a XSLT mapping pipelined with a GUI mapping, such that the structural mapping can be done by XSLT and the conversions / value-mappings can be done via the GUI ?
    Best regards,
    Marc

  • Nested structure when using FM XXL_SIMPLE_API

    I use this logic to fill in the headings before calling the FM xxl_simple_api in one of my programs. Is it possible to have nested structure(for <b>i_tab</b> in my code) and still use same kind of logic to fill in the headings? Not sure if this Fm would display data correctly when there is a component of strucutre type. I tried it, the field was blank with no contents in excel.
      DATA : nlines TYPE i,
             tempfile LIKE gxxlt_f-file,
             descr_ref TYPE REF TO cl_abap_structdescr,
             header LIKE gxxlt_v OCCURS 0 WITH HEADER LINE,
             it_print LIKE gxxlt_p OCCURS 0 WITH HEADER LINE.
    *data:               keycol type i.
      FIELD-SYMBOLS:
      <comp_wa> TYPE abap_compdescr,
      tempfile = file_name.
      REFRESH header.
      CLEAR header.
      descr_ref ?= cl_abap_typedescr=>describe_by_data( i_tab ).
      DESCRIBE TABLE descr_ref->components LINES nlines.
      nlines = nlines + 1.
      LOOP AT descr_ref->components ASSIGNING <comp_wa>.
        IF sy-tabix = nlines.
          EXIT.
        ELSE.
          header-col_no = sy-tabix.
          header-col_name = <comp_wa>-name.
          APPEND header.
        ENDIF.
      ENDLOOP.
      CALL FUNCTION 'XXL_SIMPLE_API'
      EXPORTING
        filename = tempfile
    N_KEY_COLS = keycol
      TABLES
       col_text = header[]
    I appreciate your help. Thanks

    Hi,
    It's better to use another FM 'SAP_CONVERT_TO_XLS_FORMAT'
      call function 'SAP_CONVERT_TO_XLS_FORMAT'
                 exporting
                  I_FIELD_SEPERATOR = seper
                  I_LINE_HEADER = 'X'
                     I_FILENAME = P_FILE
                  tables
                      I_TAB_SAP_DATA = itab
                  exceptions
                      CONVERSION_FAILED = 1.
    Svetlin

  • Create a new line in the xml-header structure.

    Hi,
    Can any one tell me how to create a new line in the xml-header structure.
    I am doing a IDOC-XI-HTTP scenario.
    Actually my mapping create this file:
    <b><?xml version="1.0" encoding="utf-8"?>
    <ORDERS05>
      <IDOC BEGIN="1">
        <EDI_DC40 SEGMENT="1"> </b>
    The result must look like this.
    <b><?xml version="1.0" encoding="utf-8"?>
    <ORDERS05>
      <IDOC BEGIN="1">
        <EDI_DC40 SEGMENT="1"> </b>
    Thanks and Regards,
    Eren

    Hi,
    thanks for you quick answer.
    I found a xsl script.
    It works fine.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
       <xsl:template match="*">
          <xsl:param name="depth">0</xsl:param>
          <!-- New line with indenting. -->
          <xsl:if test="$depth > 0">
             <xsl:text>    </xsl:text>
          </xsl:if>
          <xsl:text>&#xA;</xsl:text>
          <xsl:element name="{name(.)}">
             <xsl:for-each select="@*">
                <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
             </xsl:for-each>
             <xsl:apply-templates>
                <xsl:with-param name="depth" select="$depth + 1"/>
             </xsl:apply-templates>
          </xsl:element>
       </xsl:template>
    </xsl:stylesheet>
    Best regards
    Eren

  • XML document structures must start and end within the same entity

    Hi there,
    I'm working with a client/server application and using SaxParser for reading in xml. I get the SaxParserException: XML document structures must start and end within the same entity. I understand what that means, but it isn't applicable! The xml data being used is well-formed. I checked the well-formedness with Stylus Studio to make sure. Here's the data:
    <?xml version='1.0' encoding='UTF-8'?>
    <vcmessage>
         <vcsource>3</vcsource>
         <processevent>16</processevent>
         <shape>
              <llindex>0</llindex>
              <shapetype>9</shapetype>
              <shapeproperties>
                   <shapelocation>
                        <xcoord>54</xcoord>
                        <ycoord>184</ycoord>
                   </shapelocation>
                   <bounds>
                        <width>24</width>
                        <height>24</height>
                   </bounds>
                   <fgcolor>
                        <fgred>0</fgred>
                        <fggreen>0</fggreen>
                        <fgblue>0</fgblue>
                   </fgcolor>
                   <bgcolor>
                        <bgred>255</bgred>
                        <bggreen>255</bggreen>
                        <bgblue>255</bgblue>
                   </bgcolor>
                   <thickness>1</thickness>
                   <isfilled>false</isfilled>
              </shapeproperties>
         </shape>
    </vcmessage>The parser generally stops around the </bgcolor> tag.
    I'm using Eclypse as my IDE. I'm wondering if there's something wrong with it? Or maybe there's something wrong with the class I'm using for reading in the XML? Followng is the class.
    Please advise,
    Alan
    package vcclient;
    import java.io.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    import javax.xml.parsers.*;
    public class XMLDocumentReader extends DefaultHandler
      private VCClient client = null;
      private Writer out;
      private String lineEnd =  System.getProperty("line.separator");
      private boolean haveSourceType = false;
      private boolean haveUserName = false;
      private boolean haveMessage = false;
      private boolean haveProcessEvent = false;
      private boolean haveLinkedListIndex = false;
      private boolean haveOpeningShapePropertiesTag = false;
      private boolean haveShapeType = false;
      private boolean haveOpeningShapeLocationTag = false;
      private boolean haveShapeLocation = false;
      private boolean haveOpeningXCoordTag = false;
      private boolean haveOpeningYCoordTag = false;
      private boolean haveOpeningBoundsTag = false;
      private boolean haveBoundsWidth = false;
      private boolean haveBoundsHeight = false;
      private boolean haveOpeningFGColorTag = false;
      private boolean haveOpeningBGColorTag = false;
      private boolean haveOpeningThicknessTag = false;
      private boolean haveOpeningIsFilledTag = false;
      private boolean haveOpeningImageDataTag = false;
      private boolean haveOpeningTextDataTag = false;
      private boolean haveFGRed = false;
      private boolean haveFGGreen = false;
      private boolean haveFGBlue = false;
      private boolean haveBGRed = false;
      private boolean haveBGGreen = false;
      private boolean haveBGBlue = false;
      private boolean haveThickness = false;
      private boolean haveIsFilled = false;
      private boolean haveImageData = false;
      private boolean haveTextData = false;
      private VCMessage vcmessage = null;
      public XMLDocumentReader(VCClient value)
           client = value;
           vcmessage = new VCMessage();
      public VCMessage getVCMessage()
           return vcmessage;
      public boolean haveSourceType()
         return haveSourceType; 
      public boolean ParseXML(InputStream stream)
         boolean success = false;
         // Use the default (non-validating) parser
        SAXParserFactory factory = SAXParserFactory.newInstance();
        try
             // Set up output stream
            out = new OutputStreamWriter(System.out, "UTF-8");
            // Parse the input
            SAXParser saxParser = factory.newSAXParser();
            saxParser.parse( stream, this );
            success = true;
        catch (SAXParseException spe)
            // Error generated by the parser
            System.out.println("\n** Parsing error"
               + ", line " + spe.getLineNumber()
               + ", uri " + spe.getSystemId());
            System.out.println("   " + spe.getMessage() );
            // Unpack the delivered exception to get the exception it contains
            Exception  x = spe;
            if (spe.getException() != null)
                x = spe.getException();
            x.printStackTrace();
            return success;
        catch (SAXException sxe)
             // Error generated by this application
             // (or a parser-initialization error)
             Exception  x = sxe;
             if (sxe.getException() != null)
                 x = sxe.getException();
             x.printStackTrace();
             return success;
        catch (ParserConfigurationException pce)
            // Parser with specified options can't be built
            pce.printStackTrace();
            return success;
        catch (Throwable t)
             t.printStackTrace();
             return success;
        return success;
      public void startDocument()throws SAXException
          emit("<?xml version='1.0' encoding='UTF-8'?>");
          nl();
      public void endDocument()throws SAXException
          try {
              nl();
              out.flush();
          } catch (IOException e) {
              throw new SAXException("I/O error", e);
      public void startElement(String namespaceURI,
                               String lName, // local name
                               String qName, // qualified name
                               Attributes attrs)throws SAXException
          String eName = lName; // element name
          if (eName.equals(""))
             eName = qName; // namespaceAware = false
          emit("<"+eName);
          if (attrs != null) {
              for (int i = 0; i < attrs.getLength(); i++) {
                  String aName = attrs.getLocalName(i); // Attr name
                  if (aName.equals("")) aName = attrs.getQName(i);
                  emit(" ");
                  emit(aName + "=\"" + attrs.getValue(i) + "\"");
          emit(">");
          if(makeStartTag(eName).equals(Constants.OPENING_SHAPEPROPERTIES))
                haveOpeningShapePropertiesTag = true;
          else if(makeStartTag(eName).equals(Constants.OPENING_SHAPELOCATION))
              haveOpeningShapeLocationTag = true;
          else if(makeStartTag(eName).equals(Constants.OPENING_BOUNDS))
                haveOpeningBoundsTag = true;
          else if(makeStartTag(eName).equals(Constants.OPENING_FGCOLOR))
                 haveOpeningFGColorTag = true;
          else if(makeStartTag(eName).equals(Constants.OPENING_BGCOLOR))
              haveOpeningBGColorTag = true;
          else if(makeStartTag(eName).equals(Constants.OPENING_BGGREEN))
               System.out.println("See BGGreen");
          else if(makeStartTag(eName).equals(Constants.OPENING_BGBLUE))
               System.out.println("See BGBlue");
          else if(makeStartTag(eName).equals(Constants.OPENING_THICKNESS))
              haveOpeningThicknessTag = true;
          else if(makeStartTag(eName).equals(Constants.OPENING_ISFILLED))
              haveOpeningIsFilledTag = true;
          else if(makeStartTag(eName).equals(Constants.OPENING_IMAGEDATA))
              haveOpeningImageDataTag = true;
          else if(makeStartTag(eName).equals(Constants.OPENING_TEXTDATA))
              haveOpeningTextDataTag = true;
      public void endElement(String namespaceURI,
                             String sName, // simple name
                             String qName  // qualified name
                            )throws SAXException
           if(sName.equals("") && !qName.equals(""))
              sName = qName;
              emit("</"+sName+">");
           else
              emit("</"+sName+">");
           if(makeEndTag(sName).equals(Constants.CLOSING_SOURCE_TYPE))
              haveSourceType = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_USER))
              haveUserName = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_MESSAGE))
              haveMessage = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_PROCESSEVENT))
               haveProcessEvent = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_LINKEDLISTINDEX))
               haveLinkedListIndex = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_SHAPETYPE))
               haveShapeType = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_SHAPELOCATION))
                haveOpeningShapeLocationTag = false;
           else if(makeEndTag(sName).equals(Constants.CLOSING_WIDTH))
               haveBoundsWidth = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_HEIGHT))
               haveBoundsHeight = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_BOUNDS))
                haveOpeningBoundsTag = false;
           else if(makeEndTag(sName).equals(Constants.CLOSING_FGRED))
               haveFGRed = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_FGGREEN))
               haveFGGreen = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_FGBLUE))
               haveFGBlue = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_FGCOLOR))
                haveOpeningFGColorTag = false;
           else if(makeEndTag(sName).equals(Constants.CLOSING_BGRED))
               haveBGRed = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_BGGREEN))
             haveBGGreen = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_BGBLUE))
               System.out.println("See closing BGBlue");
               haveBGBlue = true;
           else if(makeEndTag(sName).equals(Constants.CLOSING_BGCOLOR))
                haveOpeningBGColorTag = false;
           else if(makeEndTag(sName).equals(Constants.CLOSING_THICKNESS))
               System.out.println("XMLDocumentReader: Step2");
                haveOpeningThicknessTag = false;
           else if(makeEndTag(sName).equals(Constants.CLOSING_ISFILLED))
               haveOpeningIsFilledTag = false;
           else if(makeEndTag(sName).equals(Constants.CLOSING_IMAGEDATA))
               haveOpeningImageDataTag = false;
           else if(makeEndTag(sName).equals(Constants.CLOSING_TEXTDATA))
               haveOpeningTextDataTag = false;
      private String makeStartTag(String tag_name)
           String start = "<";
           String end = ">";
           return start.concat(tag_name).concat(end);
      private String makeEndTag(String tag_name)
           String start = "</";
           String end = ">";
           return start.concat(tag_name).concat(end);
      public void characters(char buf[], int offset, int len)throws SAXException
           String s = new String(buf, offset, len);
          if(haveSourceType == false)
               if(vcmessage.getSourceType() == null)
                  try
                    if(s.equals(""))return;
                   int sourcetype = Integer.parseInt(s);
                   vcmessage.setSourceType(sourcetype);                            
                  catch(NumberFormatException nfe){}
          else if(vcmessage.getSourceType() == SourceType.CHAT_SOURCE)
            if(vcmessage.getSourceType() == SourceType.CHAT_SOURCE && haveUserName == false)
                 vcmessage.setUserName(s);          
            else if(vcmessage.getSourceType() == SourceType.CHAT_SOURCE && haveMessage == false)
               //When the parser encounters interpreted characters like: & or <,
               //then this method gets invoked more than once for the whole message.
               //Therefore, we need to concatonate each portion of the message.  The
               //following method call automatically concatonates.
               vcmessage.concatMessage(s);                    
          else if(vcmessage.getSourceType() == SourceType.WHITEBOARD_SOURCE)
               if(haveProcessEvent == false)
                 try
                   vcmessage.setProcessEvent(Integer.parseInt(s));
                 catch(NumberFormatException nfe){}
               else if(haveLinkedListIndex == false)
                    try
                       vcmessage.setLinkedListIndex(Integer.parseInt(s));
                     catch(NumberFormatException nfe){}
               else if(haveShapeType == false)
                    try
                       vcmessage.setShapeType(Integer.parseInt(s));
                     catch(NumberFormatException nfe){}
               if(haveOpeningShapePropertiesTag)
                    if(haveOpeningShapeLocationTag)
                         if(haveOpeningXCoordTag)
                              try
                                vcmessage.setXCoordinate(Integer.parseInt(s));
                              catch(NumberFormatException nfe){}
                         else if(haveOpeningYCoordTag)
                              try
                                vcmessage.setYCoordinate(Integer.parseInt(s));
                                //reset all flags for ShapeLocation, X and Y coordinates
                                haveOpeningXCoordTag = false;
                                haveOpeningYCoordTag = false;
                                //haveOpeningShapeLocationTag = false;
                              catch(NumberFormatException nfe){}
                    else if(haveOpeningBoundsTag)
                         if(haveBoundsWidth == false)
                              try
                                vcmessage.setBoundsWidth(Integer.parseInt(s));
                              catch(NumberFormatException nfe){}
                         else if(haveBoundsHeight == false)
                              try
                                vcmessage.setBoundsHeight(Integer.parseInt(s));
                                //reset flag
                                //haveOpeningBoundsTag = false;
                              catch(NumberFormatException nfe){}
                    else if(haveOpeningFGColorTag)
                         if(haveFGRed == false)
                              try
                                vcmessage.setFGRed(Integer.parseInt(s));                           
                              catch(NumberFormatException nfe){}
                         else if(haveFGGreen == false)
                              try
                                vcmessage.setFGGreen(Integer.parseInt(s));                           
                              catch(NumberFormatException nfe){}
                         else if(haveFGBlue == false)
                              try
                                vcmessage.setFGBlue(Integer.parseInt(s));
                                //reset flag
                                //haveOpeningFGColorTag = false;
                              catch(NumberFormatException nfe){}
                    else if(haveOpeningBGColorTag)
                         if(haveBGRed == false)
                              try
                                vcmessage.setBGRed(Integer.parseInt(s));                           
                              catch(NumberFormatException nfe){}
                         else if(haveBGGreen == false)
                              try
                                vcmessage.setBGGreen(Integer.parseInt(s));                           
                              catch(NumberFormatException nfe){}
                         else if(haveBGBlue == false)
                         {   System.out.println("getting BGBlue data");
                              try
                                vcmessage.setBGBlue(Integer.parseInt(s));
                                //reset flag
                                //haveOpeningBGColorTag = false;
                              catch(NumberFormatException nfe){}
                    else if(haveOpeningThicknessTag)
                         try
                            vcmessage.setThickness(Integer.parseInt(s));                       
                          catch(NumberFormatException nfe){}
                    else if(haveOpeningIsFilledTag)
                         vcmessage.setIsFilled(s);
                    else if(haveOpeningImageDataTag && vcmessage.getProcessEvent() == org.jcanvas.comm.ProcessEvent.MODIFY)
                         vcmessage.setBase64ImageData(s);                    
                    else if(haveOpeningTextDataTag && vcmessage.getProcessEvent() == org.jcanvas.comm.ProcessEvent.MODIFY)
                         vcmessage.setTextData(s);
                    //reset
                    haveOpeningShapePropertiesTag = false;
          emit(s);
      //===========================================================
      // Utility Methods ...
      //===========================================================
      // Wrap I/O exceptions in SAX exceptions, to
      // suit handler signature requirements
      private void emit(String s)throws SAXException
          try {
              out.write(s);
              out.flush();
          } catch (IOException e) {
              throw new SAXException("I/O error", e);
      // Start a new line
      private void nl()throws SAXException
          try {
              out.write(lineEnd);
          } catch (IOException e) {
              throw new SAXException("I/O error", e);
      //treat validation errors as fatal
      public void error(SAXParseException e)
      throws SAXParseException
        throw e;
      // dump warnings too
      public void warning(SAXParseException err)
      throws SAXParseException
        System.out.println("** Warning"
            + ", line " + err.getLineNumber()
            + ", uri " + err.getSystemId());
        System.out.println("   " + err.getMessage());
    }

    Just out of curiosity what happens if you append a space to the end of the XML document?

  • Nested Structure

    I would like to know how to use nested structure in a ABAP program.
    Thanks in Advance!

    A <b>nested structure</b> is a structure that contains one or more other structures as components.
    Flat structures contain only elementary data types with a fixed length
    (no internal tables, reference types, or strings).
    The term deep structure can apply regardless of whether the structure is nested or not.
    Nested structures are flat so long as none of the above types is contained in any nesting level.
    Any structure that contains at least one internal table, reference type, or string as a component
    (regardless of nesting) is a deep structure.
    Accordingly, internal tables, references, and strings are also known as deep data types.
    The technical difference between deep structures and all others is as follows:
    When you create a deep structure, the system creates a pointer in memory that points to the
    real field contents or other administrative information.
    When you create a flat data type, the actual field contents are stored with the type in memory.
    Since the field contents are not stored with the field descriptions in the case of deep structures,
    assignments, offset and length specifications and other operations are handled differently from flat structures.
    Kindly check the following link for more information on Nested structures:
    http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb2fcc358411d1829f0000e829fbfe/frameset.htm
    <b>Examples:</b>
    DATA: BEGIN OF itab.
            include structure vbak.  
    DATA: END OF itab.
    DATA: BEGIN OF itab OCCURS 0,
            itab1 LIKE mara,
            itab2 LIKE vbak,
          END OF itab.
    Kindly reward points if it helps!
    best regards,
    Thangesh

  • How to convert sequencial textlines into nested structure?

    Hi experts,
    I have an input-TXT file in which I get headerdata (1 line), positiondata (n lines) and for each position partnerdata (n lines). I have to map this data to Idoc ORDERS05. In this structure, there is 1 element per position (E1EDP01) which contains a subelement where I can enter position-partners. How can I achieve this mapping using the graphical message mapping tool in XI?
    Example lines of inputfile:
    (headerdata) 199992;100;10;...
    (positiondata) 10;100200;50
    (positionpartners) 10;partner1
    (positionpartners) 10;partner2
    (positionpartners) 10;partner3
    (positionpartners) 10;partner4
    (positiondata) 20;100201;100
    (positionpartners) 20;partner1
    (positionpartners) 20;partner2
    (positiondata) 30;100202;75
    must result in:
    headerdata linked to E1EDK01, no problem
    positiondata linked to E1EDP01, no problem
    positionpartners linked to E1EDPA1 within E1EDP01. Here is the problem...just linking the input-positionpartners to EDEDPA1 does not work. Then I get all positionpartners of the complete inputfile linked to the first E1EDP01, and no partners from the second E1EDP01 on...
    Regards,
    William

    Hey,
    First step is create a mapping structure(i.e data type and message type) which will be convenient
    for you to map with the Idoc.
    Then you can use File content conversion to convert the text file into the nested structure(one which you have created))
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
    refer to this blog in order to convert the input file stream into the required nested structure.
    Once done this map the message type to your Idoc.
    revert in case of any problem with FCC(file content conversion).
    reward points if useful.

  • Help!! - File to Idoc Mapping with Nested structure

    Scenario:
    I have an inbound file that has three nested records.
    eg. A00, B00 and C00. C00 is nested structure of B00 and B00 nested structure of A00. All these structure can repeat N number of times in a file.
    How do I map this to IDoc structure that have one segment each for the three structures in the file and nested in the same way.
    Question: How is the parent child relationship established?
         Suppose I have a file
         A00 1234 Sam 29
              B00 london LE3 XYZ
              B00 US 123456
                    C00 2 XYZ
               A00 5678 Joe 22
            B00 US 23456
         If I make a nested structure and then say in the file conversion properties that A00 go to segA and then B00 go to segB, but then when I come back to A00, how do I move the data to the A00?
    Thanks in Advance
    Rgds

    From what you have layed out, you can create a data type with 3 children, all 1..unbounded cardinality, each containing their own elements.  You say they are nested, but the example you gave isn't nested... it's just A's followed by B's followed by C's.  If that is the case, you can then use a data type w/ 3 subelements (A, B & C) and each of those is actually a container with the real attributes of that line in your file.  (I can email you a schema quickly if you need it)
    If you are saying they can occur like this:
    A00 1234 Sam 29
    B00 london LE3 XYZ
    B00 US 123456
    C00 2 XYZ
    B00 US 23456
    C00 2 XYZ
    THEN they are nested - ie B's & C's repeat under any A.  Then you must create segment B as a subelement of segment A instead of on the same level, then bury C under B. (I find this easiest w/ a text tool rather than inside XI, as I can cut/paste segments where I want them to belong...)
    Good luck with setting up content conversion on that file adapter... We have done this a few times, and it can be quite interesting.
    If you have trouble with the schema, you can post your email & I can give you a quick example.
    Message was edited by: Amanda Derringer

Maybe you are looking for

  • Had to reinstall windows 7 - Problems syncing iPhone with new iTunes

    Hello everyone! I've recently had to reinstall windows 7. Now I am having issues syncing my iPhone 4 with my new iTunes. I've look online at several forums and webpages but haven't found a workable solution yet. My issues are that when I attempt to s

  • How do I burn a long Podcast over two CD's in GarageBand?

    How do I burn a long Podcast over two CD's in GarageBand?

  • Just Upgraded to 10.2.8....Help!!!!

    Got G4 upgraded from 9.2 to 10.2++ 10.2.8.... did all the upgrades, jave, etc.... here's the problem.... reboot all I get is a blue screen after the grey screen with the apple logo. Freezes..... reboot holding shift key (safe Mode) she boots just fin

  • How do I get around special charaters in supplied XML

    I'm writting an application for displaying the yahoo weather info. The issue is that they label their elements like below. <yweather:location city="Mission Viejo" region="CA" country="US" /> notice the label is "yweather:location" which screws up fla

  • Pause between chapters

    Ok So I am making a DVD of sperate pieces and making each piece a chapter, I have the stories and all that for the chapter settings, and I have the "PLay All" section. But Id like to create a pause on the chapters in the play all section, because its