Jump to content
Download Section Back Up, Navigate the Right Hand Menu to find files, ignore the 0s

xml description in alphabetical order


Peliculon

Recommended Posts

Hi, im editing xml list for MAME 0.139 and im seeing that there is an alphabetical order, but what happens is that is not an exact order :rofl:

Im asking me if someone knows about a program that can handle that, i mean, reorder the blocks in the xml by alphabetical order by a determinated tag/label (in this case description label). In the next example we will see that the game mgakuen2 should be place before than the game mgcldate (because the description tag/label is the real alphabetical order for this case):

<?xml version="1.0"?>
<menu>
    <game name="88games" index="true" image="'">
        <description>&apos;88 Games</description>
        <cloneof></cloneof>
        <crc></crc>
        <manufacturer>Konami</manufacturer>
        <year>1988</year>
        <genre>Sports / Track &amp; Field</genre>
        <rating>AAMA - Green (Suitable For All Ages)</rating>
        <enabled>Yes</enabled>
    </game>

    <game name="005" index="true" image="0">
        <description>005</description>
        <cloneof></cloneof>
        <crc></crc>
        <manufacturer>Sega</manufacturer>
        <year>1981</year>
        <genre>Maze / Shooter Small</genre>
        <rating>AAMA - Green (Suitable For All Ages)</rating>
        <enabled>Yes</enabled>
    </game>

    <game name="a51mxr3k" index="true" image="a">
    <description>Area 51 / Maximum Force Duo (R3000)</description>
        <cloneof>area51mx</cloneof>
        <crc></crc>
        <manufacturer>Atari Games</manufacturer>
        <year>1998</year>
        <genre>Shooter / Gun</genre>
        <rating>AAMA - Red (Animated Violence Strong)</rating>
        <enabled>Yes</enabled>
    </game>

    <game name="mgakuen2" index="" image="">
    <description>Mahjong Gakuen 2 Gakuen-chou no Fukushuu</description>
        <cloneof></cloneof>
        <crc></crc>
        <manufacturer>Face</manufacturer>
        <year>1989</year>
        <genre>Tabletop / Mahjong * Mature *</genre>
        <rating>AAMA - Red (Sexual Content Strong)</rating>
        <enabled>Yes</enabled>
    </game>

<game name="mgcldate" index="" image="">
    <description>Magical Date / Magical Date - dokidoki kokuhaku daisakusen (Ver 2.02J)</description>
        <cloneof>mgcldtex</cloneof>
        <crc></crc>
        <manufacturer>Taito</manufacturer>
        <year>1996</year>
        <genre>Multiplay / Mini-Games</genre>
        <rating>AAMA - Green (Suitable For All Ages)</rating>
        <enabled>Yes</enabled>
    </game>

</menu>

 

The MAME xml list that im creating have a lots of this alphabetical "errors" that can't be handle in an easy way (because in the xml are +7000 games). So im hope that someone here knows a program that can handle that. If not, i will put here somes ideas for create this program (i think that create this program should be easy, but i don't know program):

1.- Check all blocks in a determinate xml file (a block for me is from here <game name="unknown" index="" image=""> ... to here </game>).

2.- Once that the program check all the blocks in the xml, then is needed reorganize them by alphabetical order according to the description tag/label inside each block.

3.- Export the new xml and thats all.

 

So finally, I don't know if this program exist. If someone knows about a program that can make this, please, say me.

 

Link to comment
Share on other sites

On 15/3/2018 at 6:49 PM, dragon57 said:

Microsoft Excel should be able to handle this

I tried with Excell. Is needed a lot of knowledge for import/export xml files. There is not an easy way just for order alphabetically the description tags and export that in a new xml file.

I tried too with OpenOffice (this is worst than with Excell).

I tried too with Don's HyperSpin Tools, i order the roms by description, but when i export the xml list, meh... Still beeing not organized by description, are organized by roms name.

So, i think that i just will create MAME 0.139 xml list (and all the genres xml list for this mame) in this disorganized way.

Is incredible that not exist a simple program that can handle that in an easy and faster way :blink:

Link to comment
Share on other sites

OK, I was just able to use Excel to sort the MAME.xml file I use and export it. I'll try to write up a procedure below.

First, open Excel to a blank sheet. Look at the ribbon and see if the Developer menu is turned on and visible along with the other standard menus, ie Home, Insert, Page Layout, etc. If it isn't turned on, go to File, Options, Customize Ribbon. (See below) Click on the Developer option, then click on OK.

5aaca48055812_Excel01.PNG.b8b035988e0216efc9ca34cef5ed6844.PNG

Next, you want to open the MAME.xml file using the standard Excel file selector. When Excel tries to open the file, the following panel should pop-up. Make sure you choose the third option like the pic below shows.

5aaca4f102a6d_Excel02.PNG.11767e9e8f62e4193d3c40c7c178df0f.PNG

You will probably get the following pop-up. Ignore it and click on OK.

5aaca539dba8b_Excel03.PNG.7aef55166317a5cf65c157b3bd31f3f9.PNG

Excel should now display the XML Source panel on the far right of an empty sheet. See pic below. Right click on the 'header' folder so header and all the fields below it are highlighted. See pic below.

5aaca58b723c9_Excel04.PNG.346657cb3660d1707828091691b2b46e.PNG

A menu will pop-up showing a 'Map element...' option. Select it and the following should pop-up. Click on OK.

5aaca6b73424c_Excel06.PNG.c4a02513c9bb0c56cb05b56ec2912664.PNG

Go to the bottom of the default sheet and click the + button to add another sheet to the Workbook. Activate the new sheet. Go back and right-click on the 'game' folder, select it, and the following should pop-up. Click on OK.

5aaca70bd74a6_Excel08.PNG.3ca3de3352e932069469e9a9e09fb4dd.PNG

Go to the Developer menu, then click on the 'Import' option. Select the same MAME.xml file again. Excel should now import all the data it needs to fully define your XML schema and data.

You can now sort on any field (description, I think you said), then go to the Developer 'Export' option to write out a new file.

Link to comment
Share on other sites

37 minutes ago, dragon57 said:

OK, I was just able to use Excel to sort the MAME.xml file I use and export it. I'll try to write up a procedure below.

[...]

Oh men, this works, thanks a lot! :good:

The only thing different that happens is the exported xml file is that dissapear the..  "index="" image=""> in the roms that have this fields empty. I dont know if this will be a problem, but thats can be fixed easy with a text editor.

Thanks again, you saved me a lot of time YEAHHH :D

Link to comment
Share on other sites

Yeah, sorry. I forgot to mention Excel doesn't export fields that are blank. I don't think it matters, but unfortunately my arcade is down and I can't verify this. Give it a go before you try to edit it and report back here so others will know.

Link to comment
Share on other sites

34 minutes ago, dragon57 said:

Yeah, sorry. I forgot to mention Excel doesn't export fields that are blank. I don't think it matters, but unfortunately my arcade is down and I can't verify this. Give it a go before you try to edit it and report back here so others will know.

Yes, this matters. For example, when i finally export the xml list with Excell, and i put the xml list in their corresponding folders of Database, when i run HyperSpin and i tried to acces to the MAME wheel, there was only a black screen. This can be fixed if you put "index="" image=""> " to all the roms again.

But i finded too that how you said, Excel doesn't export fields that are blank (like this for example: "<crc></crc"), excel just erase them. So, i didn't try yet, but the solution is really simple and will works.

Before than open the xml file to reorganize it alphabetically with Excel, i will make a copy of the file in my Desktop. Then i will open this copy with an text editor like SublimeText2, Notepad++, etc. Next step, with the text editor i will replace all the fields that Excel can take like empty and i'll put inside some text, for example:

I will replace this:

<crc></crc>

By this:

<crc>GiveMeAlphabeticalOrder</crc>

:rofl:

 

And i will do the same with every field that can be empty for Excell. Once finished, then i'll load the xml to Excel and export. And after that, i will edit the xml file again with a text editor for replace the fields that i filled with "GiveMeAlphabeticalOrder".

Link to comment
Share on other sites

  • 8 months later...
On 3/17/2018 at 6:31 AM, dragon57 said:

OK, I was just able to use Excel to sort the MAME.xml file I use and export it. I'll try to write up a procedure below.

First, open Excel to a blank sheet. Look at the ribbon and see if the Developer menu is turned on and visible along with the other standard menus, ie Home, Insert, Page Layout, etc. If it isn't turned on, go to File, Options, Customize Ribbon. (See below) Click on the Developer option, then click on OK.

5aaca48055812_Excel01.PNG.b8b035988e0216efc9ca34cef5ed6844.PNG

Next, you want to open the MAME.xml file using the standard Excel file selector. When Excel tries to open the file, the following panel should pop-up. Make sure you choose the third option like the pic below shows.

5aaca4f102a6d_Excel02.PNG.11767e9e8f62e4193d3c40c7c178df0f.PNG

You will probably get the following pop-up. Ignore it and click on OK.

5aaca539dba8b_Excel03.PNG.7aef55166317a5cf65c157b3bd31f3f9.PNG

Excel should now display the XML Source panel on the far right of an empty sheet. See pic below. Right click on the 'header' folder so header and all the fields below it are highlighted. See pic below.

5aaca58b723c9_Excel04.PNG.346657cb3660d1707828091691b2b46e.PNG

A menu will pop-up showing a 'Map element...' option. Select it and the following should pop-up. Click on OK.

5aaca6b73424c_Excel06.PNG.c4a02513c9bb0c56cb05b56ec2912664.PNG

Go to the bottom of the default sheet and click the + button to add another sheet to the Workbook. Activate the new sheet. Go back and right-click on the 'game' folder, select it, and the following should pop-up. Click on OK.

5aaca70bd74a6_Excel08.PNG.3ca3de3352e932069469e9a9e09fb4dd.PNG

Go to the Developer menu, then click on the 'Import' option. Select the same MAME.xml file again. Excel should now import all the data it needs to fully define your XML schema and data.

You can now sort on any field (description, I think you said), then go to the Developer 'Export' option to write out a new file.

Hi, sorry to revive this topic but want to thanks to dragon57 whi gave me the opportunity to sort my mame xml by description with ease.

the excel tutorial is marvelous thanks

regards

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...