hello
in order to achieve a xml-validation, i have to generate a StreamSource-instance and that's exactly the problem. but first some details: the application is being developped on a winxppro-pc, but productively runs on a win2003-server. for reliable test runs, a win2003-server is running on the winxppro-host using vmware.
now back to the problem. 4 directories are configurable, where unc-pathes should be possible as well. these pathes are loaded with a PropertyHandler from a .properties-file.
i have written a test-class to locate the problem:
import java.net.*;
import java.io.*;
import javax.xml.transform.*;
import javax.xml.validation.*;
import javax.xml.transform.stream.StreamSource;
public class URITest {
public static void main(String[] args){
PropertyHandler pHandler = new PropertyHandler("C:\\props.properties");
String xmlpath = "";
try{
xmlpath = pHandler.getStringProperty("xmlpath");
}
catch(Exception e){
System.out.println("ERROR1: " + e.getMessage());
}
String xsdPath = "C:\\test.xsd";
try{
SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
File schemaLocation = new File(xsdPath);
Schema schema = factory.newSchema(schemaLocation);
Validator validator = schema.newValidator();
Source source = new StreamSource(xmlpath + File.separator + "test.xml");
validator.validate(source);
System.out.println("end of procedure");
}
catch(Exception e){
System.out.println("ERROR2: " + e.getMessage());
}
}
}
test 1:
host: winxppro
user.dir: D:\Projekte\URITest2\dist
content of properties-file: xmlpath=\\\\Srvfile\\usermag\\test
output:
end of procedure ... all right, xml-file was found
test 2:
host: win2003server
user.dir: D:\uri
content of properties-file: xmlpath=\\\\localhost\\testsharing\\temp\\POLOPDF
output:
ERROR2: D:\uri\localhost\testsharing\temp\POLOPDF\test.xml (The system cannot find the path specified)
for some reason, the xml-path is seen relative to the working-dir. the result is an ioexception because the file wasn't found.
do somebody have an idea what's the problem and why the hell the 2 systems aren't working similar?
thx a lot!
daprodigy