Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-13-2007, 12:00 PM
Member
 
Join Date: Dec 2007
Location: Roggwil, Switzerland
Posts: 8
daprodigy is on a distinguished road
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:

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()); } } }
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems in JSP : Need help raj4u JavaServer Pages (JSP) and JSTL 1 02-07-2008 11:06 AM
GUI problems. saytri New To Java 1 12-16-2007 11:27 PM
gui problems bluebirdjc Advanced Java 2 07-23-2007 06:38 PM
a few problems gary AWT / Swing 0 07-11-2007 05:57 PM
problems with JPA Ed New To Java 2 07-04-2007 06:34 AM


All times are GMT +3. The time now is 07:30 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org