1 18 19 package org.apache.jmeter.protocol.http.modifier; 20 21 import java.io.IOException ; 22 import java.util.List ; 23 24 import org.apache.jmeter.util.JMeterUtils; 25 import org.xml.sax.InputSource ; 26 import org.xml.sax.SAXException ; 27 import org.xml.sax.XMLReader ; 28 29 36 public class UserParameterXMLParser 37 { 38 40 46 public List getXMLParameters(String xmlURI) 47 throws SAXException , IOException 48 { 49 XMLReader reader = JMeterUtils.getXMLParser(); 51 UserParameterXMLContentHandler threadParametersContentHandler = 53 new UserParameterXMLContentHandler(); 54 UserParameterXMLErrorHandler parameterErrorHandler = 55 new UserParameterXMLErrorHandler(); 56 57 reader.setContentHandler(threadParametersContentHandler); 59 60 reader.setErrorHandler(parameterErrorHandler); 62 63 reader.setFeature("http://xml.org/sax/features/validation", true); 65 66 InputSource inputSource = new InputSource (xmlURI); 68 reader.parse(inputSource); 69 70 return threadParametersContentHandler.getParsedParameters(); 71 } 72 } 73 | Popular Tags |