Using the converter is very simple. You just need to focus on the following
controls. First you need to pick which direction you want the conversion to
go, binary to XML or XML to binary.
Then you need to put your source data in the top textbox, and the schema in
the bottom textbox. If your source data is binary (unless it also happened
to be text too), it is difficult to put it in the textbox. You may want to
upload it by hitting the browse button.
Another way to get around the problem is to use a hexadecimal representation
of your binary data and put it into the top textbox. That is why you need
to use the radio buttons to specify whether the data is binary or hexadecimal.
A text file is a special case of a binary file. If you specify that the data
to be printable text, so there is no difference in the conversion whether
you specify binary or printable text. However the converter can display the result
better if it knows the result consists of printable text.
The binary data source file:
Data will be in
binary
hexadecimal
printable text
Data converted
from XML to binary
from binary to XML
Data output
plain text
converter textboxXML
form generator textbox
Debugging
off
on
After you make all the specification, you can hit the Generate button to do the
conversion using the non-debug option.
The parser may detect XML error in the schema. And if you are converting from XML
to binary. The error may indicated the line number that has problem. The data
line number button and schema line number button let you see the line number
to locate the error.
If you are converting XML to binary, the output you get depends on depends on
the output data type you choose. For hexadecimal data, you get a hex dump of the binary
data in a text page. If you choose to output binary, it comes back as a binary file
that you can save. The file name say Generated.pl, but it is not a perl file, rather
it is a binary file generated by the perl CGI code. There is one more data
type for output and that is printable text. Of course text data is also binary, but if
you know the output is plain text and you choose printable text, the output would not
go to a file, but can comeback as a text page. It may be more convenient this
way.
If the result is XML, you can choose the result to be of the type text/XML, where
most browsers will display it in a better form. You can let the result be a plain text
page, where it is easier to copy the data afterwards. You can choose the result to
to go to the form generator textbox, if you want to edit the XML with the form editor.
You can also choose the result to
go to the converter textbox, which is useful if you want to make some modification
and immediately convert it back to binary. Note that this does not use AJAX, because
my understanding is that AJAX does not support file upload. This means that you can
undo your conversion just by going back to the previous page.
If you are still developing your schema and the format commands to describe the binary data.
Then it may be helpful to choose debugging. The output would give you the detail
how each element map to and from binary data. When you choose the debugging
option, XML to binary always come back as hexadecimal. You will not get a binary file.
The binary to form generator option is also not available with debugging.
Here is an example of debugging information when generating XML
country="US" is fixed
<name>Alice Smith</name< according to data 0x0B416C69636520536D697468 ("`Alice Smith")
Choice is street according to data 0x53 ("S")
<street<123 Maple Street</street< according to data 0x3136313233204D61706C6520537472656574 ("16123 Maple Street")
<city<Mill Valley</city< according to data 0x4D696C6C2056616C6C6579202020202020202020 ("Mill Valley ")
<state<CA</state< according to data 0x4341 ("CA")
<zip<90952</zip< according to data 0x393039353200 ("90952`")
Here is example of debugging information when generating hexadecimal output of same piece of data
<name<Alice Smith</name< generates data 0x0B ("`")
then generates data 0x416C69636520536D697468 ("Alice Smith")
Choice of street generates data 0x53 ("S")
<street<123 Maple Street</street< generates data 0x3136 ("16")
then generates data 0x313233204D61706C6520537472656574 ("123 Maple Street")
<city<Mill Valley</city< generates data 0x4D696C6C2056616C6C6579202020202020202020 ("Mill Valley ")
<state<CA</state< generates data 0x4341 ("CA")
<zip<90952</zip< generates data 0x393039353200 ("90952`")
There are a few more controls in the bottom. They are just convenient way for you to change the
storage format commands of the first appinfo format. You could have accomplish the same thing
if you edit the schema directly. However, if you are not familiar with the commands, the selection
list let you pick the command, and suggested value give you an idea what to enter.