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.
Can you tell us how you distinguish between tokenizers and parsers in the context of XML? SAX-based parsers tend to break up an XML document according to functional elements, although I'm not sure if that corresponds to your concept of a token.
--- rod.
Sorry for not being clear. I am looking for a program which will accept an xml file, and will return the tags of the document (splitted). It will also be preferable if the tokenizer performs any syntactic validation. I do not know if you are any familiar with Flex. I am looking for a program like that for XML in Java.
Hope that this is clearer.
Sure, I've used flex numerous times before. It is not a tokenizer, but a program that generates tokenizers. As I understand it, you need it to generate a tokenizer that is Java source code, as opposed to it's usual C/C++ source code generation. Sorry that I don't know of any such program.
Still, it sounds like what you are after is what a SAX-based parser does (which includes validation). In case you are not already familiar with the idiom, SAX parsers allow you to specify callbacks which you provide, and which the parser calls upon seeing specified XML elements. The elements could be start tags, end tags, attributes, cdata, etc. Your callbacks are passed the instance data associated with each call, for processing according to your needs.
Perhaps someone else knows of something more closely matching what you are looking for.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.