// Path: src/it/sasabz/android/sasabus/SASAbus.java
// public class SASAbus extends Application {
//     private int dbDownloadAttempts;
//     
//     private static Context context = null;
//  
//     @Override
//     public void onCreate() 
//     {
//         // Init values which could be loaded from files stored in res/raw
//         setDbDownloadAttempts(0);
//         super.onCreate();
//         context = this.getApplicationContext();
//     }
// 
//     @Override
//     public void onTerminate()
//     {
//     	//do nothing
//     	MySQLiteDBAdapter.closeAll();
//     }
//     
//     /**
//      * @return the Strings and Variables stored in the Context;
//      */
//     public static Context getContext()
//     {
//     	return context;
//     }
//     
// 	/**
// 	 * @param dbDownloadAttempts the dbDownloadAttempts to set
// 	 */
// 	public void setDbDownloadAttempts(int dbDownloadAttempts) {
// 		this.dbDownloadAttempts = dbDownloadAttempts;
// 	}
// 
// 	/**
// 	 * @return the dbDownloadAttempts
// 	 */
// 	public int getDbDownloadAttempts() {
// 		return dbDownloadAttempts;
// 	}
//  
// 
// }
// 
// Path: src/it/sasabz/android/sasabus/classes/network/SASAbusXML.java
// public class SASAbusXML {
// 
// 	public Document getDomElement(String xml)
// 	{
//         Document doc = null;
//         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
//         try {
//  
//             DocumentBuilder db = dbf.newDocumentBuilder();
//  
//             InputSource is = new InputSource();
//                 is.setCharacterStream(new StringReader(xml));
//                 doc = db.parse(is);
//  
//             } catch (ParserConfigurationException e) {
//                 Log.e("Error: ", e.getMessage());
//                 return null;
//             } catch (SAXException e) {
//                 Log.e("Error: ", e.getMessage());
//                 return null;
//             } catch (IOException e) {
//                 Log.e("Error: ", e.getMessage());
//                 return null;
//             }
//             return doc;
//     }
// 	
// 	
// 	public String getValue(Element item, String str) {
// 	    NodeList n = item.getElementsByTagName(str);
// 	    return this.getElementValue(n.item(0));
// 	}
// 	
// 	
// 	public final String getElementValue( Node elem ) {
// 	         Node child;
// 	         if( elem != null){
// 	             if (elem.hasChildNodes()){
// 	                 for( child = elem.getFirstChild(); child != null; child = child.getNextSibling() ){
// 	                     if( child.getNodeType() == Node.TEXT_NODE  ){
// 	                         return child.getNodeValue();
// 	                     }
// 	                 }
// 	             }
// 	         }
// 	         return "";
// 	  } 
// 	
// }


import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import it.sasabz.android.sasabus.R;
import it.sasabz.android.sasabus.SASAbus;
import it.sasabz.android.sasabus.classes.network.SASAbusXML;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

		String ret = "";
		if(!haveNetworkConnection())
		{
			return ret;
		}
		try {
			HttpClient http = new DefaultHttpClient();
			HttpPost post = new HttpPost(SASAbus.getContext().getString(R.string.xml_server));
			StringEntity se = new StringEntity(xml, HTTP.UTF_8);
			se.setContentType("text/xml");
			post.setEntity(se);
			
			HttpResponse response = http.execute(post);
			if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
			{
				ret = EntityUtils.toString(response.getEntity());
			}
		} catch (ClientProtocolException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return ret;
	}
	
	
	public static boolean containsError(String xml)
	{

// Path: src/it/sasabz/android/sasabus/SASAbus.java
// public class SASAbus extends Application {
//     private int dbDownloadAttempts;
//     
//     private static Context context = null;
//  
//     @Override
//     public void onCreate() 
//     {
//         // Init values which could be loaded from files stored in res/raw
//         setDbDownloadAttempts(0);
//         super.onCreate();
//         context = this.getApplicationContext();
//     }
// 
//     @Override
//     public void onTerminate()
//     {
//     	//do nothing
//     	MySQLiteDBAdapter.closeAll();
//     }
//     
//     /**
//      * @return the Strings and Variables stored in the Context;
//      */
//     public static Context getContext()
//     {
//     	return context;
//     }
//     
// 	/**
// 	 * @param dbDownloadAttempts the dbDownloadAttempts to set
// 	 */
// 	public void setDbDownloadAttempts(int dbDownloadAttempts) {
// 		this.dbDownloadAttempts = dbDownloadAttempts;
// 	}
// 
// 	/**
// 	 * @return the dbDownloadAttempts
// 	 */
// 	public int getDbDownloadAttempts() {
// 		return dbDownloadAttempts;
// 	}
//  
// 
// }
// 
// Path: src/it/sasabz/android/sasabus/classes/network/SASAbusXML.java
// public class SASAbusXML {
// 
// 	public Document getDomElement(String xml)
// 	{
//         Document doc = null;
//         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
//         try {
//  
//             DocumentBuilder db = dbf.newDocumentBuilder();
//  
//             InputSource is = new InputSource();
//                 is.setCharacterStream(new StringReader(xml));
//                 doc = db.parse(is);
//  
//             } catch (ParserConfigurationException e) {
//                 Log.e("Error: ", e.getMessage());
//                 return null;
//             } catch (SAXException e) {
//                 Log.e("Error: ", e.getMessage());
//                 return null;
//             } catch (IOException e) {
//                 Log.e("Error: ", e.getMessage());
//                 return null;
//             }
//             return doc;
//     }
// 	
// 	
// 	public String getValue(Element item, String str) {
// 	    NodeList n = item.getElementsByTagName(str);
// 	    return this.getElementValue(n.item(0));
// 	}
// 	
// 	
// 	public final String getElementValue( Node elem ) {
// 	         Node child;
// 	         if( elem != null){
// 	             if (elem.hasChildNodes()){
// 	                 for( child = elem.getFirstChild(); child != null; child = child.getNextSibling() ){
// 	                     if( child.getNodeType() == Node.TEXT_NODE  ){
// 	                         return child.getNodeValue();
// 	                     }
// 	                 }
// 	             }
// 	         }
// 	         return "";
// 	  } 
// 	
// }


// Path: src/it/sasabz/android/sasabus/classes/hafas/XMLRequest.java
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import it.sasabz.android.sasabus.R;
import it.sasabz.android.sasabus.SASAbus;
import it.sasabz.android.sasabus.classes.network.SASAbusXML;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

		String ret = "";
		if(!haveNetworkConnection())
		{
			return ret;
		}
		try {
			HttpClient http = new DefaultHttpClient();
			HttpPost post = new HttpPost(SASAbus.getContext().getString(R.string.xml_server));
			StringEntity se = new StringEntity(xml, HTTP.UTF_8);
			se.setContentType("text/xml");
			post.setEntity(se);
			
			HttpResponse response = http.execute(post);
			if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
			{
				ret = EntityUtils.toString(response.getEntity());
			}
		} catch (ClientProtocolException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return ret;
	}
	
	
	public static boolean containsError(String xml)
	{

		SASAbusXML parser = new SASAbusXML();
