miraodb
asked on
java.net.URISyntaxException: Illegal character in opaque part
hi,
i've been working on a project where i needed to transform xml into hmtl using xsl with saxon.
so i used the following code:
System.setProperty("javax. xml.transf orm.Transf ormerFacto ry", "net.sf.saxon.TransformerF actoryImpl ");
Source xmlSource = new StreamSource("C:\\installa xiom\\axio m_app\\cla ss\\XMLFil e.xml");
Source xsltSource = new StreamSource("C:\\installa xiom\\axio m_app\\cla ss\\XMLFil e.xsl");
Result result = new StreamResult(out);
TransformerFactory transFact = TransformerFactory.newInst ance( );
Transformer trans = transFact.newTransformer(x sltSource) ;
trans.transform(xmlSource, result);
it works fine and then i want to use the xmlfile and another xsl to create a new xml file as follows:
Source xmlSource2 = new StreamSource("C:\\installa xiom\\axio m_app\\cla ss\\XMLFil e.xml");
Source xsltSource2 = new StreamSource("C:\\installa xiom\\axio m_app\\cla ss\\RawToT reeDataXML .xsl");
Result result2 = new StreamResult("C:\\installa xiom\\axio m_app\\cla ss\\TreeDa taXML.xml" );
TransformerFactory transFact2 = TransformerFactory.newInst ance( );
Transformer trans2 = transFact2.newTransformer( xsltSource 2);
trans2.transform(xmlSource 2, result2);
but i get this error:
javax.servlet.ServletExcep tion: java.net.URISyntaxExceptio n: Illegal character in opaque part at index 2: C:\installaxiom\axiom_app\ class\Tree DataXML.xm l
which i don't understand coz i'm using on both xml the same encoding which is "iso-8859-1".
if i try to apply the xsl to the xml in command line it works fine.
any ideas?
thankx in advance to all
miraodb
i've been working on a project where i needed to transform xml into hmtl using xsl with saxon.
so i used the following code:
System.setProperty("javax.
Source xmlSource = new StreamSource("C:\\installa
Source xsltSource = new StreamSource("C:\\installa
Result result = new StreamResult(out);
TransformerFactory transFact = TransformerFactory.newInst
Transformer trans = transFact.newTransformer(x
trans.transform(xmlSource,
it works fine and then i want to use the xmlfile and another xsl to create a new xml file as follows:
Source xmlSource2 = new StreamSource("C:\\installa
Source xsltSource2 = new StreamSource("C:\\installa
Result result2 = new StreamResult("C:\\installa
TransformerFactory transFact2 = TransformerFactory.newInst
Transformer trans2 = transFact2.newTransformer(
trans2.transform(xmlSource
but i get this error:
javax.servlet.ServletExcep
which i don't understand coz i'm using on both xml the same encoding which is "iso-8859-1".
if i try to apply the xsl to the xml in command line it works fine.
any ideas?
thankx in advance to all
miraodb
ASKER
well i just tried and it still shows the same error.
anyway i didn't see why it would work for the first transformation and not for the second.
i really have no idea of what's goin' on !
miraodb
anyway i didn't see why it would work for the first transformation and not for the second.
i really have no idea of what's goin' on !
miraodb
Check the namespace URI / URL
Or check the any there exists any links to external documents such as Schemas
Or check the any there exists any links to external documents such as Schemas
ASKER
i'm using jsp to execute an xsl on an xsl, so when i get the error javax.servlet.ServletExcep tion: java.net.URISyntaxExceptio n: Illegal character in opaque part at index 2: C:\installaxiom\axiom_app\ class\Tree DataXML.xm l
the actual file treedata.xml doesn't exist yet ! so schemas shouldn't be a problem at this point.
and also it works fine under the command line.
the namespace of which one the original xml? it's:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
i don't think this should interfere here.
the actual file treedata.xml doesn't exist yet ! so schemas shouldn't be a problem at this point.
and also it works fine under the command line.
the namespace of which one the original xml? it's:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
i don't think this should interfere here.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thankx to both of you.
i splited the points.
miraodb
i splited the points.
miraodb
>>this works for absolute and relative paths...
Easier and less error-prone to do:
new StreamSource(new File("C:/installaxiom/axio m_app/clas s/XMLFile. xml").toUR L());
Easier and less error-prone to do:
new StreamSource(new File("C:/installaxiom/axio
:-)
If C is the boot volume, you should be able to drop "C:" from your path and start directly with "\\installaxiom".
Perhaps a long shot and I wouldn't be able to help you further if this didn't work, but it is easy to try it out...