// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/Constants.java
// public class Constants {
//     public static final String[] VIDEO_COLUMNS = {
//             VideoContract.Videos.TABLE_NAME + "." + VideoContract.Videos._ID,
//             VideoContract.Videos.TITLE,
//             VideoContract.Videos.DESCRIPTION,
//             VideoContract.Videos.LINK,
//             VideoContract.Videos.THUMBNAIL_URL
//     };
//     public static final int COL_TITLE = 1;
//     public static final int COL_DESCRIPTION = 2;
//     public static final int COL_LINK = 3;
//     public static final int COL_THUMBNAIL_URL = 4;
//     public static String XMLFileName = "video_content.xml";
// }


import android.content.ContentValues;
import android.content.Context;
import android.os.AsyncTask;
import org.buildmlearn.toolkit.videocollectiontemplate.Constants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Vector;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
            videoValues.put(VideoContract.Videos.THUMBNAIL_URL, thumbnail_url);

            cVVector.add(videoValues);
        }
        // add to database
        if (cVVector.size() > 0) {
            ContentValues[] cvArray = new ContentValues[cVVector.size()];
            cVVector.toArray(cvArray);
            VideoDb db = new VideoDb(mContext);
            db.open();
            db.bulkInsert(cvArray);
            db.close();
        }
    }

    @Override
    protected Void doInBackground(String... params) {

        if (params.length == 0) {
            return null;
        }
        ArrayList<VideoModel> mList;

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

        dbf.setValidating(false);

        DocumentBuilder db;
        Document doc;
        try {
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/Constants.java
// public class Constants {
//     public static final String[] VIDEO_COLUMNS = {
//             VideoContract.Videos.TABLE_NAME + "." + VideoContract.Videos._ID,
//             VideoContract.Videos.TITLE,
//             VideoContract.Videos.DESCRIPTION,
//             VideoContract.Videos.LINK,
//             VideoContract.Videos.THUMBNAIL_URL
//     };
//     public static final int COL_TITLE = 1;
//     public static final int COL_DESCRIPTION = 2;
//     public static final int COL_LINK = 3;
//     public static final int COL_THUMBNAIL_URL = 4;
//     public static String XMLFileName = "video_content.xml";
// }


// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/videocollectiontemplate/data/FetchXMLTask.java
import android.content.ContentValues;
import android.content.Context;
import android.os.AsyncTask;
import org.buildmlearn.toolkit.videocollectiontemplate.Constants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Vector;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

            videoValues.put(VideoContract.Videos.THUMBNAIL_URL, thumbnail_url);

            cVVector.add(videoValues);
        }
        // add to database
        if (cVVector.size() > 0) {
            ContentValues[] cvArray = new ContentValues[cVVector.size()];
            cVVector.toArray(cvArray);
            VideoDb db = new VideoDb(mContext);
            db.open();
            db.bulkInsert(cvArray);
            db.close();
        }
    }

    @Override
    protected Void doInBackground(String... params) {

        if (params.length == 0) {
            return null;
        }
        ArrayList<VideoModel> mList;

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

        dbf.setValidating(false);

        DocumentBuilder db;
        Document doc;
        try {
            File fXmlFile = new File(Constants.XMLFileName);