I wanted to parse x12 format file to json file using java.
I didn't find any information regarding this on internet.
can someone please tell me how to do this or any jar file which can be able to do this is also fine.
How to do it:
Obtain documentation on your x12 file (do you mean HIPAA data exchange?). It will tell you about the different records, their layout and sequencing
Define target schema for the JSON you want to produce. Surely you don't want to produce just any JSON
Define mapping. Draw spaghetti on a whiteboard, piece of paper, or something like Altova Mapforce, until you have all elements connected.
Choose your transformation approach depending on the dataset size - streaming or object to JSON serialization
Implement
Look for performance bottlenecks. Introduce optimizations to speed up processing.
Related
First I want to say I checked this nice question:
JSON to JSON transformer
I want to do something similar, however, I would like to know if there is a solution that will generate the transformation automatically, knowing I have an Input.json and a Output.json sample available at hand.
So I would give the program both json (input, output) and it generate for me the JsonPatch transformations that were done so that input + transformation = output.
Maybe this tool does not exist, but it would save me a lot of time! In java would also be a big plus :)
I am attempting to parse a KML file which has some non-standard tags:
<Placemark id="plot">
<Type1> Type 1 </Type1>
<SA>62</SA>
<Type2> Type 2 </Type2>
I'm attempting to read/parse the file, obtain the representative elements as described above and then all the coordinates, and finally write the output to a text file for downstream use. I'm able to parse the file and get the coordinates with no issues but have been unable to determine a way to get the custom elements, and I need the data to format the output file correctly. The elements are not wrapped in an extendeddata structure or any other grouping.
I am hoping someone has run into this before and can offer some guidance on the best way to read the data via supplied methods for javaapiforkml.
You can have a look at OSMBonusPack KML parser, mainly here.
It's open source, so you can pick the classes you need, remove all Android-specific features, and add handling for your custom tags.
I am writing an application that stores references for books, journals, sites and so on. I mean I have already done most.
What I want is a suggestion regarding what is the best way to implement above specs?
What format text file should I use to store the library? Not file type but format. I am using simple text file at the moment. But planning to implement format as in below.
<book><Art of Human Hacking><New York><2011><1>
<journal><Achieving Maximum Speed In 802.11n><London><2009><260-265>
1st tag <book> and <journal> are type identifier. I have used ArrayList. Should I use multi dimensional ArrayList and store each item like below?
[[Art of Human Hacking,New York,2011,1][Achieving Maximum Speed In 802.11n,London,2009,260-265]]
I have used StringTokenizer and I cannot differentiate spaces. How do I fix this?
I have already implemented all features including listing all, listing unique, searching, editing, removing, adding. But everything is done to content without spaces.
You should use an existing serializer instead of writing your own, unless the project forbids it.
For compatability and human readability, CSV would be your best bet. Use an existing CSV parser to get your escaping correct (not that hard to write yourself, but difficult enough to warrant using an existing parser to avoid bugs). Google turned up: http://sourceforge.net/projects/javacsv/
If human editing is not a priority, then JSON is also a good format (it is human readable, but not quite as simple as CSV, and won't display in excel for instance).
Then you have binary protocols, such as native Java serialization, or even Google protocol buffers. These may be faster, but obviously lose the ability to view the data store and would probably complicate your debugging.
Hy...I try to explain better my question...
Im using boost serialization text archive before sending data over TCP connection...
Now I need to pass the received data to a Java application...so I would know if the serialized stream is composed only by the data or by the data + boost serialization(tag, code, etc.)...
In this case my only chance to transfer the data to the java application, is to filter them before transfering?thanks...
As far as i know Boost serialization text archive uses custom formatting.
For instance it puts serialization archive version number in the output. So you will have to filter these kind of data with Java.
Even if you have used boost binary archive you would not be able to deserialize it with Java.
So the answer to your question is boost serialization mechanism and Java are not compatible.
Try using JSON as serialization format if you have to use text based communicatoin which makes life easier.
Has anybody written any classes for reading and writing Palm Database (PDB) files in Java? (I mean on a server, not on the Palm device itself.) I tried to google, but all I got were Protein Data Bank references.
I wrote a Perl program that does it using Palm::PDB.pm, but I want to turn it into a servlet for a GWT app.
The jSyncManager project at http://www.jsyncmanager.org/ is under the LGPL and includes classes to read and write PDB files -- look in jSyncManager/API/Protocol/Util/DLPDatabase.java in its source code. It looks like the core code you need from this could be isolated from the rest of the library with a little effort.
There are a few ways that you can go about this;
Easiest but slowest: Find a perl-> java bridge. This will not be quick, but it will work and it should involve the least amount of work.
Find a C++/C# implementation that you have the source to and convert it (this should be the fastest solution)
Find a Java reader ... there seems to be a few listed under google... however I do not have any experience with these.
Depending on what your intended usage is, you might look into writing a simple reader yourself. The format is pretty simple and you only need to handle a couple of simple fields to parse it.
Basically there is a header for the entire file which has a 2 byte integer at the end which specifies the number of record. So just skip your way through the bytes for all the other fields in the header and then read the last field which is the number of records in the file. Be aware that the PDB format writes integers with most significant byte first.
Following this, there will be a record header for each record, the first field of which is the actual offset into the file for the record itself. Again, be aware of the byte order.
So, now you have the offsets into the file for each record in the file, which should make it very easy to read the actual records as long as you know the format of these for the type of PDB file you are trying to read.
Wikipedia has a nice overview of the header formats.
Maybe JPilot can help? They must have a lot of Java code dealing with Palm OS data.