io.virtualan.core.util.VirtualXPaths Maven / Gradle / Ivy
package io.virtualan.core.util;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import lombok.extern.slf4j.Slf4j;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
@Slf4j
public class VirtualXPaths {
private VirtualXPaths(){
}
public static List readXPaths(String xml) {
List xpaths = new ArrayList<>();
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
xr.setContentHandler(new FragmentContentHandler(xpaths, xr));
xr.parse(new InputSource(new StringReader(xml)));
}catch (Exception e) {
log.warn("unable to parse : {}", e.getMessage());
}
return xpaths;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy