Parse XML

Estou com o seguinte problema, estou precisando enviar uma String para
fazer o parse só que no codigo que peguei aqui no site do GUJ apenas aceita
tipo File alguem sabe como posso fazer para conseguir o que eu preciso:

public List lerUsuariosGuj(String xml) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( xml ); Element elem = doc.getDocumentElement(); // pega todos os elementos usuario do XML NodeList nl = elem.getElementsByTagName("annotation"); // prepara o vetor List annotation = new ArrayList(); //percorre cada elemento annotation encontrado for( int i=0; i<nl.getLength(); i++ ) { Element tagUsuario = (Element) nl.item( i ); // pega os dados cadastrado para o annotation atual String x = tagUsuario.getAttribute("x") ; String y = tagUsuario.getAttribute("y"); String width = tagUsuario.getAttribute("width"); String height = tagUsuario.getAttribute("height"); String classe = tagUsuario.getAttribute("class"); System.out.println("X: "+x); System.out.println("Y: "+y); System.out.println("WIDTH: "+width); System.out.println("HEIGTH: "+height); System.out.println("Classe: "+classe); NodeList nl1 = tagUsuario.getElementsByTagName("param"); List params = new ArrayList(); for (int j = 0; j < nl1.getLength(); j++) { Element param = (Element) nl1.item( j ); String name = param.getAttribute("name") ; String value = param.getAttribute("value") ; ParamAnnotation parametro = new ParamAnnotation(name, value); params.add(parametro); } // cria uma nova instancia do FormAnnotation com os dados do xml FormAnnotation anotacoes = new FormAnnotation( x, y, width, height, classe, params ); // adiciona o usuario na coleção (list) de annotation annotation.add(anotacoes); } return annotation; }

Document doc = db.parse( new InputSource (new StringReader (xml)) );

Opa vlw funcionou perfeitamente…