This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes How are these files related? XML encoding issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How are these files related? XML encoding issue" Watch "How are these files related? XML encoding issue" New topic
Author

How are these files related? XML encoding issue

P Eld
Greenhorn

Joined: Feb 24, 2014
Posts: 2
Hi all, I'm new here. I've recently gotten into looking into XML file encoding and such and was wondering if I could get a little help on this.

There are these two files for a game I was playing (They are Similar, not Identical), and one of the files messed up on me and doing so messed up the game.

I tried doing what I could to fix it, but I couldn't figure it out. Basically, what I tried was seeing if I could convert the messed up file from ASCII to UTF-8, but it didn't match the format of the correct file that looked like gibberish.

The script for the two files are below:

GOOD file:
aXK/vG8bTrOohQhQDlp30akc82lSD4JEA9OdsSy5C2mqnKnILGx3jUZI5DplADoLsHbu2q0zYxuiKsdUp9gkszKTzRbAhLnfE1sKHkIkXJ3URinr39hH2/xRiWwNbTwUws08VEI3zspRbILYqwxUKxRy4WVBOGXmuwaKo9bmpmCMBvwlks9iFFNoTlxEuR1rtL/RAJ+HXwUNcozdH/L0WB3N0wW6U8jcZ+40rvadylAUlVn9Vi2PL9FRbHs1xs+MUQ65N+4PaLQZdxkG8OW+7R1Dd8RnzhaB4q6ML+qjefCjJK6dO3IOLIQVGAunzf04fJ3/xwOC3RSXp9X3/mKg3rZxTtDzu+xBcRd5hy58kvYmyhJVdoMdbQhcfYAsjaalFXvIz39JtRTk48Ydn9fZ5WU9symTvJO+4aw/enVAN0m6hovctlOOuVWHCgbkSDjRBBqjPfzHp0nDTfPOh3Brqv1fuHm9zxkU/4008nXPsPwad+/mVKrXB4QNVa6nqm1XggBKuoEDsxFnX0YZozu2tW6igqTiswy2hCGdJH32m/8m3RctZKP+jzx8xiEIXbolCYjQl+eLMCwFsvgBd11cA0eVIEHd9Y6ADZtIhPqgNIQhGkHu74e7nvxkhspOB9s1aAsejPSirStcF2YnLZQYXL/HEQYKDvL3ccFXqOatrMvDur/Q6IurVAEibE3D5biCyVTDW80IUiFOmHpXbO4T6NCwz0kxuluBM3ZNw3EhTFBpyaQNr+VV15Z/0tcyGtKhwh/g7QyodRwq2uDEBVIDYRcIwVdLYNr1ZZH2JRkG8PHJVMNbzQhSIU6Yelds7hPomRNzh+FqhC97d9f77Rp1qLmAHylqjCOce/cTyEz4kydx5vdrV/vornFs7Zc6G9qz2dmGVVakO5QSP1ISWSr3PG9KT0HTW2Xad8vcdD334PeRfV1ts/MmiI5yE0ljvPEzBJvJS/NZUsAMi3+Ppca6c7wveiwRYZPS8wR+jxk/zr7qFNFLYauxjvQmiEMLekLvgRjaMMmJgmu5AU/AMoYlkCCAauFWNTdHl+tdbZS7WPzgmWH9XgE9zafoz7VguVHwQYjWfsTvcE7ls/LJ1M2zV9PfRXE1LCyis28RbLGs//HZcASkkYJ+TKe+l1/91jhR59P91MtuqlskUUssJTCSdA==



BAD file:
<?xml version="1.0" encoding="utf-8"?>
<StatList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<pokeName>Pikachu</pokeName>
<name>Pikachu</name>
<gender>Male</gender>
<loyalty>0</loyalty>
<pokeball />
<tint>
<x>0</x>
<y>0</y>
<z>0</z>
</tint>
<shiny>false</shiny>
<status />
<level>96</level>
<experience>6297477</experience>
<currentHealth>43.4</currentHealth>
<currentStam>124</currentStam>
<currentMoves>
<Move>
<name>QuickAttack</name>
<level>1</level>
</Move>
<Move>
<name>ThunderShock</name>
<level>1</level>
</Move>
<Move>
<name>TailWhip</name>
<level>1</level>
</Move>
<Move>
<name>ThunderWave</name>
<level>1</level>
</Move>
</currentMoves>
<moveRoster />
</StatList>
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Welcome to the Ranch, P Eld!

The first file isn't XML at all, so XML encoding can't possibly be an issue. As for the second file, it's certainly XML. But encoding in ASCII versus UTF-8 can't be an issue because the file doesn't contain any non-ASCII characters as far as I can see.

Anyway if your game is expecting something like the first file, it's not at all surprising that the second file doesn't work as a substitute.
P Eld
Greenhorn

Joined: Feb 24, 2014
Posts: 2
Thanks for the welcome!

What kind of file could the first one be then? I mean, it had an XML file extension, and they both came from the same source. It's just that one somehow had converted to the other (I'm willing to bet my anti-virus software had something to do with it). It would be great if I could turn the second one back into the first.

I would post the files, but I'm not able to post them as attachments since the extension is .xml
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

The first file looks like it's something in Base64 encoding to me, but that's just a guess.
 
Consider Paul's rocket mass heater.
 
subject: How are these files related? XML encoding issue
 
Similar Threads
Validating against schema
problem in XML Parsing using XPathAPI
encoding in java
Problem with XML validation
Problem in XPath