Wednesday, 13 April 2016

XML : Need help creating an XML grammar verifier (C++)

I must create a program which takes in a file and prints the interpretation if the file is formatted correctly, and handle the errors otherwise. I think I can write the program once I have some idea where to start conceptually, but as of now I am in way over my head.

It must accept three tags,

  • A tab, "< tab >(no spaces)" indents the content by a single tab
  • Paragraph, "< p >" prints content followed by new line
  • List item, "< listItem >" prints text preceded by a bullet "*"

and < /tab > closes the content that will be tabbed, etc.

Content can also be inside multiple tags.

I am also encouraged to implement this recursively, and I don't quite understand how recursion would help in this case. If anyone could point me in a direction on how to get started, it would be greatly appreciated. I have so far tried using an input stream to read in a word, check if it is one of the tags, and then putting the following content into a queue, but I'm not sure where to go from there.

Thank you.

No comments:

Post a Comment