Thanks for this!
I just having some troubles with that yet :p...
Originally Posted By qmc2
OK, that's in SVN r4716 smile! You can use 'qmc2NEO.queryLocalXml(id, query)' now to restrict the XQuery (query) to a single game/machine (id)... everything else is the same as in the global query.

Example:

Code:
<script>
        if ( "$EMULATOR_TYPE$" == "MESS" ) {
                document.write("<h3>" + tr('Software lists') + "</h3>");
                if ( qmc2NEO.queryLocalXml("$ID$", "doc($xmlDocument)//machine/softwarelist/@name/string()") ) {
                        var result = qmc2NEO.getXmlResult();
                        if ( result.length > 0 ) {
                                document.write("<p>" +  tr('Associated software-lists:'));
                                for (var i = 0; i < result.length; i++)
                                        document.write((i > 0 ? ", " : " ") + result[i]);
                                document.write("</p>");
                        } else
                                document.write("<p>" + tr('This system has no associated software-lists.') +"</p>");
                } else
                        document.write(tr('XML query error!'));
        }
</script>

I'm reusing a slightly modified function from the ROMAlyzer to accomplish this. There's implicit internal indexing whenever a game/machine is queried, so subsequent queries of the same game's/machine's XML data will be faster. This is much faster than a global query and should thus also be usable for bigger data as in MAME and UME.


I tried:
Code:
   if (qmc2NEO.queryLocalXml("$ID$", "doc($xmlDocument)//machine/driver/@emulation/string()") ) 
   {
      tdCor("Emulation", qmc2NEO.getXmlResult());         
   } 
   
   else
      document.write(tr('XML query error!'));

But I don't know why, it's giving me a runtime error in Windows7 x86 :p
I'm doing something wrong?

but:
Code:
if (qmc2NEO.queryXml("doc($xmlDocument)//machine[@name = \"$ID$\"]/driver/@emulation/string()") ) 
   {
      tdCor("Emulation", qmc2NEO.getXmlResult());         
   } 
   
   else
      document.write(tr('XML query error!'));

Works :p

If I don't did nothing wrong, I suspect that may the new LocalXml have a bug on windows...

Ps.: r4723


"A user interface is like a joke. If you have to explain it, it's not that good."