My Xml parse code is attached, not sure whats wrong

0 favourites
  • 9 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I'm including both my actual Xml data and the code. The Messages2 text object never fills so the Xml is not parsing. The function is really getting the right Xml string so I'm not sure what I'm doing wrong.

    <?xml version="1.0" encoding="utf-8"?>
    <game>
        <info>
            <name>Standard 52 Cards Game</name>
            <cardsize>
                <small width="73" height="98"></small>
                <large width="252" height="358"></large>
            </cardsize>
        </info>
        <cards>
            <card frame="0" name="Ace of Clubs" color="black" type="Clubs">Text</card>
            <card frame="1" name="Two of Clubs" color="black" type="Clubs">Text</card>
            <card frame="2" name="Three of Clubs" color="black" type="Clubs">Text</card>
            <card frame="3" name="Four of Clubs" color="black" type="Clubs">Text</card>
            <card frame="4" name="Five of Clubs" color="black" type="Clubs">Text</card>
            <card frame="5" name="Six of Clubs" color="black" type="Clubs">Text</card>
            <card frame="6" name="Seven of Clubs" color="black" type="Clubs">Text</card>
            <card frame="7" name="Eight of Clubs" color="black" type="Clubs">Text</card>
            <card frame="8" name="Nine of Clubs" color="black" type="Clubs">Text</card>
            <card frame="9" name="Ten of Clubs" color="black" type="Clubs">Text</card>
            <card frame="10" name="Jack of Clubs" color="black" type="Clubs">Text</card>
            <card frame="11" name="Queen of Clubs" color="black" type="Clubs">Text</card>
            <card frame="12" name="King of Clubs" color="black" type="Clubs">Text</card>
            <card frame="13" name="Ace of Spades" color="black" type="Spades">Text</card>
            <card frame="14" name="Two of Spades" color="black" type="Spades">Text</card>
            <card frame="15" name="Three of Spades" color="black" type="Spades">Text</card>
            <card frame="16" name="Four of Spades" color="black" type="Spades">Text</card>
            <card frame="17" name="Five of Spades" color="black" type="Spades">Text</card>
            <card frame="18" name="Six of Spades" color="black" type="Spades">Text</card>
            <card frame="19" name="Seven of Spades" color="black" type="Spades">Text</card>
            <card frame="20" name="Eight of Spades" color="black" type="Spades">Text</card>
            <card frame="21" name="Nine of Spades" color="black" type="Spades">Text</card>
            <card frame="22" name="Ten of Spades" color="black" type="Spades">Text</card>
            <card frame="23" name="Jack of Spades" color="black" type="Spades">Text</card>
            <card frame="24" name="Queen of Spades" color="black" type="Spades">Text</card>
            <card frame="25" name="King of Spades" color="black" type="Spades">Text</card>
            <card frame="26" name="Ace of Hearts" color="red" type="Hearts">Text</card>
            <card frame="27" name="Two of Hearts" color="red" type="Hearts">Text</card>
            <card frame="28" name="Three of Hearts" color="red" type="Hearts">Text</card>
            <card frame="29" name="Four of Hearts" color="red" type="Hearts">Text</card>
            <card frame="30" name="Five of Hearts" color="red" type="Hearts">Text</card>
            <card frame="31" name="Six of Hearts" color="red" type="Hearts">Text</card>
            <card frame="32" name="Seven of Hearts" color="red" type="Hearts">Text</card>
            <card frame="33" name="Eight of Hearts" color="red" type="Hearts">Text</card>
            <card frame="34" name="Nine of Hearts" color="red" type="Hearts">Text</card>
            <card frame="35" name="Ten of Hearts" color="red" type="Hearts">Text</card>
            <card frame="36" name="Jack of Hearts" color="red" type="Hearts">Text</card>
            <card frame="37" name="Queen of Hearts" color="red" type="Hearts">Text</card>
            <card frame="38" name="King of Hearts" color="red" type="Hearts">Text</card>
            <card frame="26" name="Ace of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="27" name="Two of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="28" name="Three of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="29" name="Four of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="30" name="Five of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="31" name="Six of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="32" name="Seven of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="33" name="Eight of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="34" name="Nine of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="35" name="Ten of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="36" name="Jack of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="37" name="Queen of Diamonds" color="red" type="Diamonds">Text</card>
            <card frame="38" name="King of Diamonds" color="red" type="Diamonds">Text</card>
        </cards
    </game>
    [/code:3jtmnrzt]
    
    [img="http://i.imgur.com/Hd7drLc.png"]
  • just close node </cards

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • korbaach I was psyched for a few minutes, I thought you found the glitch. Sadly, no.

    I see nothing wrong with this simple code. This is killing me.

  • korbaach I was psyched for a few minutes, I thought you found the glitch. Sadly, no.

    I see nothing wrong with this simple code. This is killing me.

    It does seem the code you provided is missing the > at the end of </cards

  • It says function param(0) is xmldata..

    when are you calling this function and are you sure the data is actually in param(0)

  • LittleStain Yeah, with korbaach helping I finally saw the </cards error. I thought for sure that was the problem. I made the fix and it still doesn't parse. Yes the Function.Param(0) definitely does have the Xml string. I can see it a variable in debug. And the Xml has the </cards> fix. I can't see why it won't parse. I may have to switch back to JSON. I can parse that for sure.

  • locohost I copy your Xml code in text file and this is the result

  • korbaach Yeah I have it working now too. The issue was the </cards thing you found, plus I had a set of double-double quotes in the Xml start node. Fixed those two issues and it worked.

    korbaach

    LittleStain

    Thanks a lot guys for getting me through this. Xml is a pain the ass :-/

  • Wish I would have found (or thought of looking for) this sooner...

    http://www.xmlvalidation.com/

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