ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello. I am looking for a good data file parser. I want to store a
hierarchical data in it. Also, I suppose that data could be binary.
I need in a fast utility and it must be amongst standard POSIX parsers.
Thank you very much for these documentation. But I do not insist on XML indeed.
I mentioned it only as a variant. I completele do not know XML. It is said XML
is a great thing for such purpose and therefore I remembered it. But I want to
know whether it is really standard lightweight and fast utility or there is
something else? However thank you very much.
The big advantage of XML would be that you can make the
data self-contained, that is, you have a chance to include
a description of the methods required to use the data with
the data which would make it re-usable in let's say 100 years
from now.
The downside is increased size and a bigger overhead in
handling.
No. The overhead in handling adn size increasing is exactly what I do NOT want
at all. I forgot to say. I want to embed a hierarchical data storage system
into my program written in a very non-object oriented language - C. If XML
requires more high language (like java) it cannot satisfy me. I could write
my own parser but I am sure it exists already and there is no need in my work.
I would like to use a very simple parser with a hierarchical structure, that is
a key word of my searching. I would like to store a very complex data, so
hierarchy is the very thing I need.
When you say hierarchical data, what exactly are you after?
Maybe there are other libraries out there that provide what
you need, and you wouldn't have to reinvent the wheel?
I mean my data could be divided into several sections. Each section must be
able to contain either data itself or another section. I would like to use
data of different types and have a simple way to handle all these data, i.e.
remove/add/modify it. And invention of a wheel is most undesired for me.
Therefore I am here. Please, give me a piece of advise.
If you want a "standard format" for representing data, XML is a strong contender - even for binary data.
If you want a "standard format" for representing a hierarchy (a hierarchy that happens to contain different kinds of data) - XML is a really, really excellent choice.
If you want cross-platform, cross-language - again, XML is a strong contender.
At the opposite end of the spectrum, you could easily just create your own data format. It'd be a lot simpler to code, and it could yield vastly smaller, more compact files (depending on the size of your binary data items).
There are pros and cons to each choice ... and, unfortunately, there aren't a lot of alternatives in between. Based on what you've said, it sounds like you get to pick between "learn XML" and "roll your own fomat".
The actual XML itself isn't difficult at all - it looks very, very similar to HTML, only it can store data.
The recall of it isn't that hard either - most libraries will place it in a nice structure for you.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.