First I have to say, that reading this Forum was a real joy for me! Quite a few things to learn and a rather kind of communication. I like that pretty much!
Now to my question:
I'm writing a program that needs to post commands to a server. These commands are designed in a special flavour of XML.
All this works pretty nice.
Now I would like to validate my commands BEFORE I send them to the server. Checking if it is wellformed should be rather simple. But the problem is the logical validation. Imagine a simple example:
Example 1: A simple wellformed XML-command (simplified)
This command would be valid XML. But it might NOT be a valid command. For example there might be a parameter3 required. Or the values would need to be in a special charset or whatever. All these requirements are defined in a XML-Scheme.Code:<root> <command> <createsomething> <parameter1>value1</parameter1> <parameter2>value2</parameter2> </createsomething> </command> <root>
So what I need to do:
- read the scheme
- analyze it
- validate the XML using it
I guess, the real tough part will be, analyzing it.. Imagine the scheme contains something like "if". How can I create some kind of code, that changes, depending on input (the scheme)??
I can't imagine, how to do this and need your help...
BTW: I can't use libxml2 or any other "extra library" that I would have to install.. And the target system is a old linuxbox. *sigh*
Thanks in advance!