Project

Profile

Help

Saxon and Secure Processing

Added by Anonymous about 19 years ago

Legacy ID: #3148016 Legacy Poster: hitman2005 (hitman2005)

Hi, I have some problem with Jaxp. First. I'm trying to invoke some parametric queries XSLT with Java using Saxon8.3 and Jdk1.4, but I got no idea how to do. I use the TransformFactory, creating a new istance and then writing the transform. Problem: I have to pass a parameter to the query to make it able to work on a document xml producing another documento xml: how can I do? My second problem is about Secure Processing. I have to set the EntityExpansionLimit to an higher level about 12800 but in jdk1.4 the class SecureProcessing doesnt't exist. I've tried with the setSecureProcessing, with XMLConstants and then granting the permission through java.policy, but nothing worth. Thank you very much Marco Tammuzzo


Replies (2)

RE: Saxon and Secure Processing - Added by Anonymous about 19 years ago

Legacy ID: #3148082 Legacy Poster: Michael Kay (mhkay)

You can declare a parameter in your stylesheet using a top-level xsl:param element, for example <xsl:param name="p" as="xs:string" required="yes"/> and then you can supply a value for the parameter using the setParameter() method on the JAXP Transformer class. The second question doesn't relate to Saxon (it relates to the XML parser) and I'm afraid I don't know the answer to it. Michael Kay

RE: Saxon and Secure Processing - Added by Anonymous about 19 years ago

Legacy ID: #3148152 Legacy Poster: Curtis (cdfisher07)

Here is a technique you might find useful for setting the parameters. This is 1.5 code so you may have to translate to 1.4. Create a HashMap in a servlet or other Java class and populate it like so... HashMap<String, String> params = new HashMap<String, String>(2); params.put("uid", request.getParameter("userid")); params.put("pwd", request.getParameter("pwd")); I then have another class that I instantiate from my servlet (keep in mind I am not trying to make an MVC complient application here, just an exercise) that contains the following method: public void setTemplateParameters(HashMap<String,String> templateParams) { for (Map.Entry <String, String> entry : templateParams.entrySet()) { transformer.setParameter(entry.getKey(),entry.getValue()); } } The above is 1.5 code so you will have to set it up to work with 1.4. My parameters are set, and I then invoke the different types of methods in the instantiated class to process my templates. Michael's book XSLT 2.0 contains various examples of the JAXP interface that saxon uses. Look up what you need and then open the Java classes under samples in the Saxon download and peruse the Servlet and TRAXExamples. You'll find a bunch of code that can be reused in your own design. Hope this helps... Curtis Fisher

    (1-2/2)

    Please register to reply