Results 1 to 1 of 1
- 12-13-2007, 11:00 AM #1
Member
- Join Date
- Dec 2007
- Location
- Roggwil, Switzerland
- Posts
- 8
- Rep Power
- 0
problems with StreamSource and UNC
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:
test 1:Java Code: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()); } } }
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
Similar Threads
-
Problems in JSP : Need help
By raj4u in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 02-07-2008, 10:06 AM -
GUI problems.
By saytri in forum New To JavaReplies: 1Last Post: 12-16-2007, 10:27 PM -
gui problems
By bluebirdjc in forum Advanced JavaReplies: 2Last Post: 07-23-2007, 05:38 PM -
a few problems
By gary in forum AWT / SwingReplies: 0Last Post: 07-11-2007, 04:57 PM -
problems with JPA
By Ed in forum New To JavaReplies: 2Last Post: 07-04-2007, 05:34 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks