Good practices when writing a parser for a standard file format (such as ePub)

I am considering writing an Android reader software that can read ePubs and display them. I checked the ePub standard documents. However, these contain a lot of information. So I am wondering what is the process of implementing a standard for a file format. What are the steps to get a working implementation without passing by parts of the standard? Are there any best practices?

Also, is it even possible to program this alone in a reasonable time?

From what I have already found out, ePub is basically a zip archive. That means I could probably use zlib to decompress it. The content is in XHTML and CSS, so I believe it should be possible to display it in a WebView. The parts that are missing are writing the code that can read the metadata and manage the non-standard XHTML extensions.

1

Let’s try to answer your question a point at a time.

  1. I’m note sure to understand your question (I’m not an english mothertongue speaker…). If you are asking what is the process used to define a new file format like ePub, then the answer is: gather a few seasoned specialists around a table, feed them with hamburgers and problems and wait for a document. If you are asking how a working ePub reader is developed to serve as a reference implementation, then the answer is: have the specialists write one together with the reference document. Most of times, this implementation actually comes sooner than the reference document. If you are asking how to implement your own reader, see below.

  2. Yes, there are Best Practices for developing tools for XML/HTML and ePub. They are mostly the same used to develop any other kind of software. Any good book describing the BPs used in your preferred language (Java on Android) can give you all the info you need. To see which BPs are actually used in this specific field, you have to explore the world of XML and XML tools (parsers, converters and so on).

  3. Yes, it is surely possible to write an ePub reader by yourself in a reasonable amount of time. As you have already seen by yourself, a ePub reader is actually just a program that decompresses a zip file in a temporary storage area (in memory or on disk) and shows the pages in a web browser (WebView in Android) starting from index.html. Just do not try to (re)write the web browser yourself… Writing an ePub editor would be a completely different story.

  4. Well, XHTML is actually an “application” of XML. There is nothing into XHTML that is “non-standard”. There could not even be. XML is extensible by definition. It can accomodate every new tag or structure. Sure, there is a part of the ePub document that is not strictly related to XML and does not comply with XML standard but it is not actually non-standard. It is just another type of data. As a consequence, you can use any standard XML tool to deal with the XML/XHTML part of ePub.

By far, the best way to write your own ePub reader is:

  1. Find some high-level description of the file format (even the ePub wikipedia page should be enough)

  2. Study some existing, open source reader’s code. Just Google around for “java or android open source epub reader”.

  3. Try to reimplement the program functionalities one at a time (and keep asking for help/info).

Good luck.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật