473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Set path for DTD in java app

Obscure subject I know.

I have an application which loads data from an xml file. That xml file has
an associated dtd to ensure that it is correctly formatted. The dtd is in
the same folder as the xml file. The application does not know the path of
xml file and searches for it a run time. When it opens the xml file, it
assumes that the dtd file is in the folder of the default path of the
application rather than the same folder as the xml file. How do I get the
xml parser to check for the dtd in the same path as the xml file?
Jul 17 '05 #1
1 3785
Moth wrote:
Obscure subject I know.

I have an application which loads data from an xml file. That xml file has
an associated dtd to ensure that it is correctly formatted. The dtd is in
the same folder as the xml file. The application does not know the path of
xml file and searches for it a run time. When it opens the xml file, it
assumes that the dtd file is in the folder of the default path of the
application rather than the same folder as the xml file. How do I get the
xml parser to check for the dtd in the same path as the xml file?


Try using org.xml.sax.InputSource.setSystemId() to set the location of
the XML before parsing.

HTH,
Ray

--
XML is the programmer's duct tape.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hal Vaughan | last post by:
I want to have a config file for my program, which means I need to know where the config file is. If I type: java myclass and it runs myclass.class, is there any way to obtain the location of...
0
by: Hal Vaughan | last post by:
While experimenting with System.getProperty() and System.setProperty(), I've noticed that I can change properties, but those changes do not last once the JVM they're modified in terminates. I...
1
by: Hal Vaughan | last post by:
Is there any way to get the directory or full path Java was called from? For example, if I was in the directory "/home/me" and ran "java foo" is there anything that would tell me that Java was...
0
by: Peter Bassett | last post by:
My java program ListFiles lists all .jpg files in a folder. It accepts 1 argument, the folder containing the files. When I run this from c:\java and include the long pathname as the argument, it...
70
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the...
34
by: Reinhold Birkenfeld | last post by:
Hi, the arguments in the previous thread were convincing enough, so I made the Path class inherit from str/unicode again. It still can be found in CVS:...
0
by: atlantis | last post by:
Hi, I have a very strange problem with xsl:import when usig RELATIVE path on AIX 5.2 server. I have two XSL files in the same directory: "ists_xslt3.xsl" and "ists_xslt3_layout.xsl". This...
5
by: Russ | last post by:
I have a Python program that I want to run in Jython so I can get Java bytecode output. The program runs fine in Python, but when I change the first line of the main program to make it run in...
0
by: Brad Baker | last post by:
Our developers are calling a java application from an ASP/ASP.net page. Excerpt as follows: ---- Dim a_jvmargs(1) a_jvmargs(0)= "-Djava.class.path=C:\Program...
10
by: anklos | last post by:
Hi, everyone~ I met a problem: the defualt java version on the unix sever is 1.4, but I'd like to export the 1.6 version on the sever (the 1.6 java exists on the sever) I wrote the code like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.