How do I read an xml and get the result? (CAPX Included)

0 favourites
  • 7 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hey guys!

    So, I made an excel with some cell (Item, Count). I export as xml and import in construct.

    Now, I want to search for an exist item each time and when i press a button to give me the result from the cell (i want in future to have more cell).

    I need also when i write a wrong item, to give me error (just a text).

    Thanks very much, I really appreciate!

  • The XML parser doesn't like the format. This has come up before.

  • blackhornet

    Thank you for your answer! I saw this topic before some days, i try something without luck. Maybe i miss something.

    Can you take a minute to check my capx above? We talk for 2 cell only.. Thanks! ; -)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • you only need this part from xml file

     <Table>
       <Row>
        <Cell><Data>Item</Data></Cell>
        <Cell><Data>Count</Data></Cell>
       </Row>
       <Row>
        <Cell><Data>A</Data></Cell>
        <Cell><Data>5</Data></Cell>
       </Row>
       <Row>
        <Cell><Data>B</Data></Cell>
        <Cell><Data>10</Data></Cell>
       </Row>
       <Row>
        <Cell><Data>C</Data></Cell>
        <Cell><Data>20</Data></Cell>
       </Row>
    </Table>[/code:3vgtwze8]
    
    [img="https://media.giphy.com/media/3oriNPa4eIHIwATG9y/giphy.gif"]
    
    [url=https://app.box.com/s/ce3gv3i4yqh3exahtx94fedymkjpc0d8]xmlTable.capx[/url]
  • korbaach

    First of all big thanks for your time! I have a question.. I check your code and xml file also, you change it.. Cool but my question is: If I want to create the cell in excel then to save as xml and use the file as is in construct 2, can i? I ask because if you see xml code from excel is a bit different. Thanks again!

    For example this is the code, when excel save as xml:

      <Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="4" x:FullColumns="1"
       x:FullRows="1" ss:DefaultRowHeight="15">
       <Column ss:StyleID="s17" ss:Span="1"/>
       <Row>
        <Cell ss:StyleID="s16"><Data ss:Type="String">Item</Data></Cell>
        <Cell ss:StyleID="s16"><Data ss:Type="String">Count</Data></Cell>
       </Row>
       <Row>
        <Cell><Data ss:Type="String">A</Data></Cell>
        <Cell><Data ss:Type="Number">5</Data></Cell>
       </Row>
       <Row>
        <Cell><Data ss:Type="String">B</Data></Cell>
        <Cell><Data ss:Type="Number">10</Data></Cell>
       </Row>
       <Row>
        <Cell><Data ss:Type="String">C</Data></Cell>
        <Cell><Data ss:Type="Number">20</Data></Cell>
       </Row>
      </Table>[/code:3khwkv5k]
    
    And your code:
    [code:3khwkv5k]<Table>
       <Row>
        <Cell><Data>Item</Data></Cell>
        <Cell><Data>Count</Data></Cell>
       </Row>
       <Row>
        <Cell><Data>A</Data></Cell>
        <Cell><Data>5</Data></Cell>
       </Row>
       <Row>
        <Cell><Data>B</Data></Cell>
        <Cell><Data>10</Data></Cell>
       </Row>
       <Row>
        <Cell><Data>C</Data></Cell>
        <Cell><Data>20</Data></Cell>
       </Row>
    </Table>[/code:3khwkv5k]
  • I want to create the cell in excel then to save as xml and use the file as is in construct 2, can i?

    you can..

    but you need to delete some parts from xml..(which cause the error...check this capx)

    you can do it manually in a text editor or C2 can do for you..

    xml2Table.capx

  • korbaach

    Ok Cool!!! Thanks again my friend.. ; -)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)