You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Philippe Lambert <pl...@solvision.net> on 2004/10/26 17:02:04 UTC

illegal character in file name

We experienced a problem while trying to use this code:

XMLPlatformUtils::Initialize();
XalanTransformer::initialize();

std::string strFile = "X:\dir\Report-#SeqNbr001.xml";
//... other variables decl 

int iParseResult  =
aXalanTransformer.parseSource(XSLTInputSource(strFile.c_str()),
theParsedSource, useXercesDOM);
if ( iParseResult != 0)
{
	//error management 
}


A error is signaled when the file name contains a (pound) # character.  Our
OS (win 2000) doesn't prohibit this character in path, so I'm surprised
Xalan does.  

Is it a known limitation?  Is there a list of prohibited characters?


Thank you


Philippe Lambert
Informaticien
SolVision
2111, Boul. Fernand-Lafontaine, Suite 130
Longueuil (Québec)
Canada, J4G 2J4
Tel.: (450) 679-9542, poste 231
Fax: (450) 679-9477
Email: plambert@solvision.net



Re: illegal character in file name

Posted by Matthew Hoyt <mh...@ca.ibm.com>.
Hi Philippe,

If you are using an XSLTInputsource, your file input must be system 
identifier (reference URI).    If your file name contains reserved 
characters, you must escape them:  i.e. replace '#' with '%23'.   For more 
details about what is allowed/not allowed see: 
http://www.w3.org/TR/2004/REC-xml-20040204/#dt-sysid

-Matt.

 



"Philippe Lambert" <pl...@solvision.net> 
10/26/2004 11:02 AM
Please respond to
xalan-c-users


To
<xa...@xml.apache.org>
cc
Stephane_April@us.ibm.com
Subject
illegal character in file name






We experienced a problem while trying to use this code:

XMLPlatformUtils::Initialize();
XalanTransformer::initialize();

std::string strFile = "X:\dir\Report-#SeqNbr001.xml";
//... other variables decl 

int iParseResult  =
aXalanTransformer.parseSource(XSLTInputSource(strFile.c_str()),
theParsedSource, useXercesDOM);
if ( iParseResult != 0)
{
                 //error management 
}


A error is signaled when the file name contains a (pound) # character. Our
OS (win 2000) doesn't prohibit this character in path, so I'm surprised
Xalan does. 

Is it a known limitation?  Is there a list of prohibited characters?


Thank you


Philippe Lambert
Informaticien
SolVision
2111, Boul. Fernand-Lafontaine, Suite 130
Longueuil (Québec)
Canada, J4G 2J4
Tel.: (450) 679-9542, poste 231
Fax: (450) 679-9477
Email: plambert@solvision.net




RE: illegal character in file name

Posted by Philippe Lambert <pl...@solvision.net>.
Yes, of course, URI.  I was out of my mind.

Explicit construction was for illustration only, but thank you for the
advice anyway.


Thanks a lot both of you.

Phil

-----Original Message-----
From: david_n_bertoni@us.ibm.com [mailto:david_n_bertoni@us.ibm.com]
Sent: 26 octobre, 2004 12:14
To: xalan-c-users@xml.apache.org
Subject: Re: illegal character in file name


> std::string strFile = "X:\dir\Report-#SeqNbr001.xml";
> //... other variables decl
>
> int iParseResult  =
> aXalanTransformer.parseSource(XSLTInputSource(strFile.c_str()),
> theParsedSource, useXercesDOM);
> if ( iParseResult != 0)
> {
>                //error management
> }
>
>
> A error is signaled when the file name contains a (pound) # character.
Our
> OS (win 2000) doesn't prohibit this character in path, so I'm surprised
> Xalan does.
>
> Is it a known limitation?  Is there a list of prohibited characters?

Xalan-C accepts URIs, not file names, and '#' is not allowed in a URI.

If you want to support files, you can use std::ifstream and std::ofstream
with XSLTInputSource and XSLTResultTarget.

> int iParseResult  =
> aXalanTransformer.parseSource(XSLTInputSource(strFile.c_str()),

Note also you do not need to explicitly create an XSLTInputSource, since
the compiler will automatically call the constructor for you.

Dave


Re: illegal character in file name

Posted by da...@us.ibm.com.
> std::string strFile = "X:\dir\Report-#SeqNbr001.xml";
> //... other variables decl 
> 
> int iParseResult  =
> aXalanTransformer.parseSource(XSLTInputSource(strFile.c_str()),
> theParsedSource, useXercesDOM);
> if ( iParseResult != 0)
> {
>                //error management 
> }
> 
> 
> A error is signaled when the file name contains a (pound) # character. 
Our
> OS (win 2000) doesn't prohibit this character in path, so I'm surprised
> Xalan does. 
> 
> Is it a known limitation?  Is there a list of prohibited characters?

Xalan-C accepts URIs, not file names, and '#' is not allowed in a URI.

If you want to support files, you can use std::ifstream and std::ofstream 
with XSLTInputSource and XSLTResultTarget.

> int iParseResult  =
> aXalanTransformer.parseSource(XSLTInputSource(strFile.c_str()),

Note also you do not need to explicitly create an XSLTInputSource, since 
the compiler will automatically call the constructor for you.

Dave