I'm writing a simple API to interface with my system. The first task I want my server script to do is verify the XML structure. I'm not sure if defining a xsd or schema is what I need to do as that seems to just define keys and fieldtypes.
My problem is that I use PHP to read the XML string that is being submitted and using strpos to check for the proper tags. This would work if I only had one type of XML call to my server script. However, I have a few and I define the call in the XML <call>UPDATE</call>. So, if I get an UPDATE call then I know there would be some required tags I would need to look for. So, I have to first pull the <call> tag out which requires me to start parsing the XML prematurely.
This still doesn't suppress the fatal error.
I need a way to send a error to the user or another way to get the <call> value from the XML request without parsing it with SimplXMLElement.
Right now, the API client sends the XML request with the <call> tag via cURL. The headers contain POST, content-type, and content-length. Is there a way maybe I can modify the header to contain the specific call that I can retrieve on my API server script?