I want to transform an XML file with javax.xml.transform.Transformer, but my web access passes through a proxy.
I’ve tried using a new URIResolver with the transformer, but that didn’t work. How can I instruct the transformer to use the proxy?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For general network access from the JDK, one option is to pass JDK args at startup.
Something like:
Often a better solution is set the option programatically in your application, using values you’ve read from your config file.
Something like:
See http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html for all the options
However, in the specific example of XML processing where you need to resolve XSD, DTD etc. It’s almost always better to have a local copy of the resource as you’ve tried and specify a javax.xml.stream.XMLResolver to your parser to load the local copy rather than the remote.