I have a web service that I created using Eclipse 3.2 and using Apache
Tomcat 5.5.15, with Axis 1.3. I receive an xml file that I want to
validate. I had originally validated this against a schema file that I
knew would always exist using the following code:
if (schema == null)
{
return ret_val = BASS_Enumerations.UNDEFINED_ERROR;
}
try
{
Validator v = schema.newValidator();
v.validate(new StreamSource(xml));
}
which worked fine. Then I was informed that I couldn't use the schema
Name all the time that I needed to use the references in the name space to
validate because they would very some times. I then changed the code to
the following:
From what I read it apperars to be setup correctly. I would appreciate
any adivce that you can provide. I notice that the element that it
specifies in the error message is the same as the name space.
The namespace is not ment to be a physical location where you can download
the schema. You may need to have an XML Catalog that relates a particular
namespace to a particular XML Schema file. The other option is to use
the schemaLocation attribute to determine which schema file to be used,
but this is only a hint. Your better option is to use the Namespace if
possible and an XML Catalog.