Xerces not validating document correctly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tarunprabhu
    New Member
    • Oct 2008
    • 2

    Xerces not validating document correctly

    Hi,

    I am using Xerces 2.8.

    When I try to validate a file which is in the same folder as the xsd, it works fine. But if I try to validate an XML file which is in some other folder, it gives me a whole load of "unknown element" errors for every element in my XML file.

    This is the code that I am using:

    Code:
        
    XMLPlatformUtils::Initialize();
        
        XercesDOMParser *parser = new XercesDOMParser;
        parser->setValidationScheme(XercesDOMParser::Val_Always);
        parser->setDoNamespaces(true);
        parser->setDoSchema(true);
        parser->setValidationSchemaFullChecking(true);
        
        parser -> setExternalSchemaLocation ("http://blah blah.xsd");
            
        ParseErrorHandler *handler = new ParseErrorHandler();
        parser->setErrorHandler(handler);
        
        parser->parse(filename);
    The filename is being passed correctly.
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    The parser is not getting the schema.

    Do you have spaces in the filename? Try replacing with %20.

    Comment

    • tarunprabhu
      New Member
      • Oct 2008
      • 2

      #3
      Originally posted by jkmyoung
      The parser is not getting the schema.

      Do you have spaces in the filename? Try replacing with %20.
      Ok, I had to specify the full path to the xsd. How stupid! Thanks anyway.

      Comment

      Working...