Amadeus produces AIR file like below for every flight reservation.
I need to read reservation number and source and destination airports from this file.
I searched Google for "Amadeus air format" but haven't found format description.
Wikipedia entry about EDIFACt is a bit different, it does not describe this content.
Where to find information about the file structure ?
How to parse this file ?
I have not idea about the file structure, does it contain records like SQL table or is it some reservation protocol instructions like postscript file ?
Application should work in Microsoft Windows and preferably in Visual FoxPro or C# language.
FoxPro or Microsoft Visual Studio 2012 Express can used as programming environment
Google returns only Amadeus users guides and tutorials like in comment and in
http://www.amadeusschweiz.com/en/documentation/usermanuals.html
Those are user manuals. Most promising looks Amadeus Air user guide from this:
File which I received name was air.txt and first token in file is AIR-BLK206
Maybe BLK206 is some booking format descriptor. Google returns some
documens like my using this so it looks like it is commonly used.
This file probably describes how to reserve ticket, which produces air.txt file.
I seacrched this and ticket user guide for BLK but those do not contains this abbreviation.
Commands in user manual look different than those from this file.
How to use this information to extract reservation number and destination airport
from this file ?
I haven't found format description using Google. There are Amadeus user guides, tutorials and quick reference files similar which you posted but I don't understand how to use them to parse this file.
One message describes that this is form of EDIFACT. However EDIFACT message
sample in Wikipedia is also different.
I need to create quick prototype to customer which shows that we vćan read those files.
Maybe there are some programs which can used to display it in human readable form ?
You should consider contacting your local Amadeus Support for help regarding this. They offer excellent documentation around pretty much everything you need to know.
I'm 100% sure that what you're looking at not actually is EDIFACT. EDIFACT is very much delimited with pluses (+) and semicolon (;).
The example actually looks a lot more like a screen capture from the Amadeus Selling Platform with spaces replaced by semicolon(;). It's most likely a file in the Amadeus Interface Record format.
Also, parsing this file require you to know a great deal about how the Amadeus GDS works. And that's not very easy. A flight booking might seem like a trivial thing but it's a very complex world made up of strange ways to handle things.
Here is the product documentations (not including specifications) http://www.amadeus.com/travelagencies/x52025.html
Consider looking for your local sales office at http://www.amadeus.com/
Contact Amadeus. You'll need to sign a non-disclosure, and they'll send you the complete documentation. Note that AIR files contain more than only flight tickets. They can contain Exchange tickets, Refunds,TASF's, EMD's, MCO's, and hotel/(localised)train/car/boat bookings.
And note that the format of the AIR files can be tweaked using Amadeus ProPrinter.
From previous attempts to hack my way through "alien" file formats, my first piece of advice would be to get as many files as you can for flights you already know the details of. This will let you see any commonalities between the files to give you an indication of recurring patterns.
At first glance the ";" would seem to be a separator / delimiter for information - having never seen this format before it could be that the format is data-only with the reading application pulling out elements based on tacit knowledge of the file structure.
Match known information
Build patterns
the matter of parsing edifact-amadeus is much more complicated then getting the manual from amadeus. it takes inventing tree algorithms, managing large data files, timing procedures, etc. etc. if you do not have the time and drive go invent the wheel al over again, you'd better look for an existing solution. this is not a direct answer to the question you posed, but it is the outcome of some experience.
Air’s are data files and can be read using notepad or word pad or any such program
It includes data of Air, hote, train , car etc info in it and each has specific formats in which data is structured in the document
If you contact your local Amadeus office you can get the document which explains the data structure of each of these files(a 273 page document) the delimiter/separator in this file is “,”
The text AMD BLK 206 refers to Amadeus bulk file & 206 is the file structure which you should get clearly once you go through the document
Please go through this EDIFACT tutorial or basic guide which helps you understand the file structure and then you can easily parse it the way you like,
more over there are tools available to parse EDIFACT files like notepad++ or EDInotepad.
Related
I have been using E-IceBlue's Spire.XLS library (License Purchase Page | nuget Package), and while it is excellent I've hit a couple of hurdles.
The gist of my requirement is this:
I have to take a bunch of data from our intranet CMS, along with attachments users have uploaded to it, and email that information to a third-party outside of the company, periodically. We were originally sending the data and the user-uploaded attachments separately, but as the documents became more numerous and unwieldy - I then got the request to try and combine everything in to one file. The attachments were small enough to embed, so I achieved this by creating an Excel report using Spire.XLS -- which allows me to not only add OleObjects to the package, but to position them (anchor them) to a specific row or column as well - maintaining a nice visual link with the data from the CMS record. As such I can have all my data on a row in columns A through AB for example, and the attachments start appearing right at the end of the row in columns AC, AD etc.
In terms of how I implemented that - I grab my data from the CMS, iterate through each item (which includes attachment / File data), I get the default image / icon for the relevant file-type, create an OleObject on the Worksheet and then I position it -- something a bit like this:
MyAttachmentCollection attachments = GetAttachments(itemId);
foreach(File attachment in attachments) {
string fileType; string localFilePath;
// Use WebClient to download file locally..
/* --- pseudo-code omitted for brevity -- */
worksheet.OleObjects.Add(localFilePath, image, OleLinkType.Embed);
worksheet.OleObjects.Last().Location = worksheet.Range[row,col + 1];
worksheet.OleObjects.Last().ObjectType = fileType;
col++;
}
Nice and simple and the result is pretty good. Sadly, the success of it means that the powers that be have wanted to send more and more data this way, without ponying up the cash for a Spire.XLS license. The free license only allows 200 rows of data, or 5 worksheet tabs. This is a single-use case for us, so I think they're finding it hard to justify the license cost for this single development and its' future upkeep. We're public services too, so budget wise we have to try and do things on the cheap!
I'm aware that XLSX / Open XML spreadsheet documents are basically zipped/packaged storage containers, so I've taken a look at the contents of an Excel file that contains some attachments added in this way, and I've tried to go about understanding the various schemas and how I might replicate the effect, but I'm struggling to wrap my head around it to be honest and I'm wondering if any other libraries might exist that do this sort of leg work already?
One of the things I love about EPPlus (Old Codeplex Page | nuget Package) is being able to take a DataSet or DataTable and insert that directly in to a worksheet at a given cell reference. I also like that I can use built in Excel styles or define my own and apply those. I can create really lovely looking spreadsheets (sad I know!) while writing very little code. So initially, I looked in to whether I might be able to use or extend EPPlus... And as described in this answer, EPPlus does expose the underlying XML, but from what I can figure - I'd need to:
add the icon/image data to the package first (the actual visual representation of the file in the worksheet) and make that live in the drawings and/or media folder within the XLSX,
the drawing data would need to exist in the new format and the legacy (VML) format (unless Spire XLS is just being overly backwards-compat friendly?? Side note: -- I believe if you use the Office SDK / Excel Interop DLLs you can call for the image information to be generated - but as this is a server based solution I'm looking to avoid that if possible),
I would need to register relationship IDs for those in various XML files,
add the attachment as a BIN file (assuming that's just a binary dump?) and create a relationship ID for that,
and then somehow tie all that together in my worksheet XML...
...headache inducing! Unfortunately I'm not really au-fait with the OpenXML-SDK and I'm not sure how quickly I could pick it up. There's a very real risk I could put a lot of effort in, only to end up with a corrupt / non-compliant file. Unless all of this just seems more complicated than it really is??
The other library that I have used before is NPOI (GitHub repo | nuget Package) -- this is based on Java POI a Java API for Microsoft documents. It supports the older Microsoft Office formats as well as the newer ones.
I've seen some SO answers such as this one which indicate its possible to use POI to embed other MS family documents, but I don't know if the .NET fork (NPOI) is fully implementing this stuff. I've found very little evidence of people doing this using that particular library... it may just be that this requirement is somewhat rare so I can't find examples?
Another example of someone solving the embed problem in Java's POI is here - but that appears to be writing in the older office format and using OLE1.0 embeds.
Just posting as I figure it may be possible one of you super helpful guys out there has done exactly this sort of thing before! ;)
Thank you for reading, and sorry if I've been a bit verbose / wasted too much of your time with the wall of text! Any help greatly appreciated!
I have asp.net app in which I need to edit a word document and than send that document in email as an attachment.
I would like to know what will be the best way to edit the word document and than use it.
The document already has data and there are few variables such as "company name", "date", "amount", etc that I am searching in the document and I am replacing them with values from within the code.
The code works great when I am running it locally but from some people I received answers that editing word document on the server shouldn't be the way I am doing now but I need to use either openxml to edit the document or google docs.
Any idea what's the best way to tackle this?
I would vote for OpenXML, but be prepared to spend a good day or two reading how to use the API for .NET and be patient. =)
I remember using this tool -
http://openxmldeveloper.org/resources/dotnet/m/cc/303.aspx - quite a bit to find the relevant parts in the document to modify. You basically load a Word document and can "drilldown" to find the parts you want to modify. You can actually write some pretty clean code to search the document for your textual markers and then replace them with data.
(I hope I understood the question correctly. You said you already had working code, so I wasn't sure what the question was.)
You can use the Open XML Format SDK as per http://msdn.microsoft.com/en-us/library/dd440953%28v=office.12%29.aspx
For what you're doing though, I think your approach is fine.
I have a fair amount of screwdrivers, but if I noticed a lose screw in the stool in front of me, I might just use the knife on the table because it will do the job perfectly adequately and save me a trip to the toolbox. It's not a tool designed for that job, but it is a tool that would do the job just as well and with less effort.
Now, if I decided to set about a day's worth of DIY with only the knife instead of the set of screw-drivers, that would be going to the other extreme. Here I'd have long-ago crossed the line where using the tools designed for a given job would have made my life much easier.
It's just the same with software tools.
One of the very points of XML formats is that we can do simple tasks with it treating it just as text. Yeah, we none of us want to be the guy with a 3-page-long regular expression with which they're trying to parse a complicated XML document, but when the problem naturally breaks down to a simple text substitution, do a simple text substitution.
I'm trying to do a semi-automated graph layout program. After reading the input, the program should generate a graph (with a specified layout). The tricky part is that the user should be able to choose a subset of the nodes and rearrange those with another algorithm (while saving the rest in their original position). I've went through graphviz and while this option is possible it is very limited (using "pin" only with the 'neato' and 'fdp' algorithms... i would prefer my graph to be oriented)
another requirement would be the price.. I've seen that yworks can do what i need but its paid for...
at this point I'll take any language I can get thanx
currently I'm trying out graphsharp but the documentation is very poor
For python see answers to this question
For java see ansers to this question
If you're happy with semi-automated graph layout, then what you might do is the following (which I did in the past):
download yEd (also from yworks)
save a graph and look at the file: its XML, and the format is not too complex
write some code that save your graph into an XML file compatible with yEd
open your file form yEd, and use built-in layout algorithms
save again your file from yEd
I hope this helps.
I'm starting to wonder if this is even possible. I've searched for solutions on Google and come up with nothing that works exactly how I'd like it to.
I think it'd benefit to explain what that entails. I work for database group at my university's IT department. My main job is to take specs of a report in a docx file, copy that over to dreamweaver, fix some formatting, and put it onto their website. My issue is that it's ridiculously tedious to do this over and over. I figured, hey, I haven't written anything in C# for some time now, perhaps I could write an application to grab a docx file, convert it to HTML, fix the CSS, stick the header, and footer from the webpage on there, and save the result. I originally planned to have it do one by one, but it probably wouldn't be difficult to have it input a list of files and batch convert.
I've found these relevant topics on how to accomplish this, but they don't fit my needs well enough.
http://www.techrepublic.com/blog/howdoi/how-do-i-modify-word-documents-using-c/190
This is probably fine for a few documents, but since it's just automating an instance of Word, I feel like it'd be slow and memory intensive. I'd prefer to avoid opening and closing an instance of Word 50+ times.
http://openxmldeveloper.org/articles/333.aspx
This is what I started using. XSLT had the benefit of not needing word to be installed nor ran for each file. After some searching I got a proof of concept working. It takes in a docx file, decompresses it, grabs the document.xml from that, and uses the DocX2Html.xsl file I scavenged from OpenXML viewer. I believe that was originally provided by MS for sharepoint servers to provide the ability to render word documents in a browser. Or something along those lines.
After adjusting that code to fit my needs, and having issues with the objXSLT.Load () method, I ended up using IlMerge to make the XSL into a DLL. No idea why I kept getting a compile error when using the plain old XSL file, but the DLL worked fine, so I was satisfied. Here (http://pastebin.com/a5HBAakJ) is my current code. It does the job of converting docx to HTML just fine (other than random spaces between some words), but the result file has ridiculously ugly HTML syntax. An example of this monstrosity can be found here (http://pastebin.com/b8sPGmFE).
Does anyone know how I could remedy this? I'm thinking perhaps I need to make a new XSL file, as the one MS provided is what's responsible for sticking all those tags and extra code in there. My issue with that is that I don't know anything about how to do that. Perhaps there's an alternative version already out there. All I'd need is one that will preserve tables and text formatting. Images aren't needed.
This looks like just what you need: http://msdn.microsoft.com/en-us/library/ff628051(v=office.14).aspx
The author Eric White blogged about his experiences developing that tool. You can see that list of posts on his blog here: http://blogs.msdn.com/b/ericwhite/archive/2008/10/20/eric-white-s-blog-s-table-of-contents.aspx#Open_XML_to_XHtml
Since I'm a big fan of Aspose.Words, a commercial library to create/process Word documents, I would do something like:
Open the Word document with Aspose.Words.
Save the Word document as HTML.
Use something like SgmlReader or HTML Agility Pack (or even Regular Expressions if it is suitable) to remove unwanted HTML tags/attributes.
Since you wrote you work at an university, I'm not sure whether commercial packages are an option, though.
Hi not sure what the rules are on promoting your own solutions, so do let me know if I am out of line.
I am a web developer who had the same issues, so I created my own tool:
http://www.convertwordtohtml.com
We are also working on a new version that will have even better conversion quality and one click conversion eg you can right click on a word file and it will be directly converted to html and the code placed into the clipboard. The current version also supports command line access and the new version will have a server version to.
There is a free trial version downloadable from the site , and if you have any questions do contact me any time.
Given a list of mailing addresses, I need to open an existing Word document, which is formatted for printing labels, and then insert each address into a different cell of the table. The current solution opens the Word application and moves the cursor to insert the text. However, after reading about the security issues and problems associated with opening the newer versions of Word from a web application, I have decided that I need to use another method.
I have looked into using Office Open XML, but I have not found any good resources that provide concrete information on exactly how to use it. Also, someone suggested that I use SQL reporting services, but searching for information on how to use them, lead me nowhere.
Which method do you think is the most appropriate for my problem?
Code samples and links to good tutorials would be extremely helpful.
Thanks for all the answers, but I really did not want to pay for a plugin and using Word automation was out of the question. So I kept searching and eventually, through some trial and error, found some answers.
After throughly searching through Microsoft's site, I found some newer articles on the Office Open XML SDK. I downloaded the new tools and just started going through each them.
I then found the Document Reflector, which creates a class to generate XML code based off an existing Word Document (.docx). Using my Label Template Document and the code this tool generated, I went through and added a loop that appends table cells for each address. It actually proved to be fairly simple and way faster than using Word automation.
So, if you're still using Word automation check out the Office Open XML tools. Their surprisingly extensive for a free download from Microsoft.
Office Open XML SDK 2.0 Download
I use the Words plugin from Aspose.com to do mail merges (programming guide).
You can take a look show 137 and 138 on dnrTV (www.dnrtv.com). In these video's Beth Massi shows how to do some editing and mail merging with OpenXML. She does this by using the Open XML SDK and xml literals in VB. It requires no third party components. Also it doesn't require MS Office to be installed on the machine.
This video inspired me as a C# developed (and no VB experience) to do some XML manipulation in a separate dll in VB. I call into this dll from my C# application.
It is worth a try.
We have the product Aspose that tvanfosson has mentioned. The edition that we purchased works with SQL Reporting Services so it can be used with the scheduler for creating output. It is really a great product and we used in a system that needed to support Korean characters in the final document. It works great and was under $1K with support. Not bad.
The advantage of using a product like this is that you can continue to manage your data and the skill set required to produce the documents is at a level where a variety of developers can support its use.
Vanstee,
If you really want to do this in code, check out this post I just found on Google
http://kellychronicles.spaces.live.com/blog/cns!A0D71E1614E8DBF8!1364.entry
If you are using reporting services cant you just move the information in the word doc into a database table and read it from there, taking word out of the equation?