1
$\begingroup$

What are xml datasets? Is it possible to convert them to csv files? I'm working on a Java program and I sometimes download datasets wich are in a binary format, are those xml?

Thank you.

$\endgroup$

1 Answer 1

3
$\begingroup$

XML is a markup language similar to html. One uses tags with attributes to build data structures. For example,

<sampleXML>
  <Menu>
    <Food>
      <item1>Spaghetti Bolognese</item1>
      <item2>Spaghetti Carbonara</item2>
    </Food>
    <Drinks>
      <item1 class = 'drinks'>Sprite</item1>
    </Drinks>
  </Menu>
</sampleXML>

As you can see XML employs tags such as <Food></Food> and attributes such as class = 'drinks' which is exactly what HTML has. To access the XML data in java you got couple choices. You can read it in as a string and parse it using built in DOM parser. Or you can use JAXB to map XML directly to Java objects.

Surely you can convert XML to a csv file. There are free websites online for that. Just google "XML to csv converter."

Binary files are not XML, but can be. This needs little explanation. The letters and words you see here are ASCII characters. This is human readable text. Each ASCII character has a binary representation. For example, j in binary is 1101010. A binary file is any file in computer language (0 an 1). A binary file can also be a combination of text and binary. You can convert binary to ASCII and those files you download may indeed be XML I described above. To convert binary to ASCII just google it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.