[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-j-dev
Subject:    Help needed for CatalogManager
From:       <markus.sticker.epos () zf ! com>
Date:       2015-10-14 13:35:09
Message-ID: BF53CA5B9B0DAE44A912C32CB11A44D13888B1CB () FRDS01163 ! emea ! zf-world ! com
[Download RAW message or body]

Hello,

I want to have the CatalogResolver for my Saxon Servlet.

This is a small part of my java code:

    public void init() throws ServletException {
        super.init();
        System.setProperty("javax.xml.transform.TransformerFactory", \
"net.sf.saxon.TransformerFactoryImpl");  }
...
      String propertyFile = "C:\\temp\\CatalogManager.properties";
      Transformer transformer = pss.newTransformer();
      CatalogManager catalogManager = new CatalogManager(propertyFile);
      CatalogResolver resolver = new CatalogResolver(catalogManager);
      transformer.setURIResolver(resolver);
      String mime = pss.getOutputProperties().getProperty(
          OutputKeys.MEDIA_TYPE);
      if (mime == null) {
        // guess
        res.setContentType("text/html");
      } else {
        res.setContentType(mime);
      }
      Enumeration p = req.getParameterNames();
      while (p.hasMoreElements()) {
        String name = (String) p.nextElement();
        if (!(name.equals("style") || name.equals("source"))) {
          String value = req.getParameter(name);
          transformer.setParameter(name, new StringValue(value));
        }
      }
      File sourceFile = new File(source);
      transformer.transform(new StreamSource(sourceFile),
          new StreamResult(out));


But the result I've got is that:

Cannot find C:\temp\CatalogManager.properties

I don't know what I did wrong.
Maybe somebody can give me a hint or a sample, how to do it right.
Thanks for your help.
Kind regards
Markus Sticker


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.E-MailFormatvorlage17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span lang="EN-US">I want to have the CatalogResolver for my \
Saxon Servlet.<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US">This is a small part of my java code:<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US" \
style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; public void init() \
throws ServletException {<o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
super.init();<o:p></o:p></span></p> <p class="MsoNormal" \
style="margin-left:35.4pt"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
System.setProperty(&quot;javax.xml.transform.TransformerFactory&quot;, \
&quot;net.sf.saxon.TransformerFactoryImpl&quot;);<o:p></o:p></span></p> <p \
class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US" \
style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; \
}<o:p></o:p></span></p> <p class="MsoNormal" style="margin-left:35.4pt"><span \
lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&#8230;<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String \
propertyFile = &quot;C:\\temp\\CatalogManager.properties&quot;;<o:p></o:p></span></p> \
<p class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transformer transformer = \
pss.newTransformer();<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
CatalogManager catalogManager = new \
CatalogManager(propertyFile);<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CatalogResolver resolver = new \
CatalogResolver(catalogManager);<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
transformer.setURIResolver(resolver);<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String mime = \
pss.getOutputProperties().getProperty(<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
OutputKeys.MEDIA_TYPE);<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (mime \
== null) {<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // guess<o:p></o:p></span></p> \
<p class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
res.setContentType(&quot;text/html&quot;);<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
res.setContentType(mime);<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Enumeration p = \
req.getParameterNames();<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (p.hasMoreElements()) \
{<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String name = (String) \
p.nextElement();<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if \
(!(name.equals(&quot;style&quot;) || name.equals(&quot;source&quot;))) \
{<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String value = \
req.getParameter(name);<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
transformer.setParameter(name, new StringValue(value));<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File sourceFile = new \
File(source);<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
transformer.transform(new StreamSource(sourceFile),<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new \
StreamResult(out));<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span lang="EN-US">But \
the result I&#8217;ve got is that:<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal" \
style="text-indent:35.4pt"><span lang="EN-US" style="font-family:&quot;Courier \
New&quot;">Cannot find C:\temp\CatalogManager.properties<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US">I don&#8217;t know what I did \
wrong.<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US">Maybe somebody \
can give me a hint or a sample, how to do it right.<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US">Thanks for your help.<o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US" style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;mso-fareast-language:DE">Kind \
regards<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;mso-fareast-language:DE">Markus \
Sticker</span><span style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,&quot;serif&quot;;mso-fareast-language:DE"><o:p></o:p></span></p> <p \
class="MsoNormal"><o:p>&nbsp;</o:p></p> </div>
</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic