Project

General

Profile

« Previous | Next » 

Revision 52783

use HttpConnector to download XML instead of VTDGen parse URL method

View differences:

Gtr2Helper.java
7 7
import com.ximpleware.AutoPilot;
8 8
import com.ximpleware.VTDGen;
9 9
import com.ximpleware.VTDNav;
10
import eu.dnetlib.data.collector.plugins.HttpConnector;
10 11
import org.apache.commons.logging.Log;
11 12
import org.apache.commons.logging.LogFactory;
12 13
import org.apache.commons.lang3.*;
......
18 19
	private VTDNav mainVTDNav;
19 20
	private AutoPilot mainAutoPilot;
20 21
	private StringWriter writer;
22
	private HttpConnector connector;
21 23
	//private BlockingQueue<String> fragment = new ArrayBlockingQueue<String>(20);
22 24

  
23 25
	public String processProject(final VTDNav vn, final String namespaces) throws Exception {
......
70 72

  
71 73
	private VTDNav setNavigator(final String httpUrl) {
72 74
		VTDGen vg_tmp = new VTDGen();
73
		vg_tmp.parseHttpUrl(httpUrl, false);
74
		return vg_tmp.getNav();
75
		connector = new HttpConnector();
76
		try {
77
			byte[] bytes = connector.getInputSource(httpUrl).getBytes("UTF-8");
78
			vg_tmp.setDoc(bytes);
79
			vg_tmp.parse(false);
80
			//vg_tmp.parseHttpUrl(httpUrl, false);
81
			return vg_tmp.getNav();
82
		}catch (Throwable e){
83
			return null;
84
		}
75 85
	}
76 86

  
77 87
	private int evalXpath(final VTDNav fragmentVTDNav, final String xPath) throws Exception {

Also available in: Unified diff