In WebSpeed, the first time you access the X-document handle or any of its attributes, you trigger a load of the document, which precedes your access. For example, if you set the SCHEMA-PATH attribute of X-document (of WEB-CONTEXT) before accessing X-document (of WEB-CONTEXT) or any of its attributes, when the document arrives, WebSpeed first loads the document, then sets SCHEMA-PATH to your value. So at load time, SCHEMA-PATH might not contain your value, which might cause WebSpeed not to find your DTD, which might cause validation of the document to fail.
In WebSpeed, instead of accessing the SCHEMA-PATH attribute of X-document (of WEB-CONTEXT), access XML-SCHEMA-PATH. For example, if you want a WebSpeed application to set the DTD search path (perhaps based on a Web request) of an XML document, instead of having the application set the SCHEMA-PATH attribute of X-document (of WEB-CONTEXT), have the application set the XML-SCHEMA-PATH attribute (of WEB-CONTEXT).