Monday, 7 September 2009
Structural problems (like missing quotes, unclosed tags, etc) can be a pain for development because PHP doesn't tell you where the error is, it just breaks the code. This technique can help you with that, although not perfect, it was designed to give the confidence to publish your web service (or your XML doc) without killing yours and other people's systems.
PHP Debugging Tool
- Online demo at Bubaweb.com
Download PHP Class
- Download the class and use it as you please.
- Isolate the problem:
- Delete the first half of the XML.
- If the error disappeared, place it back on and delete just the first half of this half.
- Continue deleting and placing back chunks of the XML until you get the only line that is causing the problem.
- Now you can research on the single problem you have found.
- More accurately:
- If you can't find the problem using the previous approach, it is very likely that you have more than one bugs in the XML document to fix.
- Execute the '1. Fastest solution' (the previous bullet point) on just the half of the XML document. Try to debug only a chunk of it at a time until all problems are fixed.
- Use the online tool XML debugger:
- I've just developed to help on this process and is very simple to use.