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

Andy Fish

Usenet Archive
Joined
Dec 30, 2002
Messages
605
Reaction score
0
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
 

Steve W. Jackson

Usenet Archive
Joined
Feb 9, 2001
Messages
492
Reaction score
0
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 =
 

Richard Tobin

Usenet Archive
Joined
Jan 6, 2000
Messages
4,251
Reaction score
0
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
 

Andy Fish

Usenet Archive
Joined
Dec 30, 2002
Messages
605
Reaction score
0
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
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top