xerces parser won't open file with brace in the name

A

Andy Fish

Hi,

I am trying to parse a file using Xerces' DOMParser.parse(String systemId)

I have come across a problem where it refuses to open a file with curly
braces "{" or "}" in the file name. I just get a SAXException saying the
file does not exist

is it trying to do some kind of parameter substitution into the filename?

Andy
 
S

Steve W. Jackson

Andy Fish said:
:Hi,
:
:I am trying to parse a file using Xerces' DOMParser.parse(String systemId)
:
:I have come across a problem where it refuses to open a file with curly
:braces "{" or "}" in the file name. I just get a SAXException saying the
:file does not exist
:
:is it trying to do some kind of parameter substitution into the filename?
:
:Andy
:
:

This isn't an issue with the parser. Try simply reading that same file
as a stream of bytes, for instance, and you should find that it's
something else. Solve it there and you'll be able to parse it. How
it's solved probably depends on language, OS, filesystem, etc.

= Steve =
 
R

Richard Tobin

Andy Fish said:
I have come across a problem where it refuses to open a file with curly
braces "{" or "}" in the file name. I just get a SAXException saying the
file does not exist

System identifiers are URIs, and "{" and "}" are among the characters
that have to be escaped when used in URIs. The parser *ought* to do
this for you, but I wouldn't be surprised if it doesn't. Try using
%7B instead of { and %7D instead of } to see if that's the problem.

-- Richard
 
A

Andy Fish

not so, I'm afraid. This works fine:

parser.parse (new InputSource(new FileInputStream(filename)));

but these do not:

parser.parse (new InputSource(filename));
parser.parse (filename);

Anyway, thanks for the idea. At least I have my workaround now :)

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top