All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xmlcalabash.util.XProcLocationProvider Maven / Gradle / Ivy

package com.xmlcalabash.util;

import net.sf.saxon.event.SourceLocationProvider;
import java.util.Hashtable;

/**
 * Created by IntelliJ IDEA.
 * User: ndw
 * Date: Nov 23, 2008
 * Time: 5:12:19 PM
 * To change this template use File | Settings | File Templates.
 */
public class XProcLocationProvider implements SourceLocationProvider {
    Hashtable locationMap;
    Hashtable idMap;
    int nextId;

    public XProcLocationProvider() {
        locationMap = new Hashtable ();
        idMap = new Hashtable ();
        nextId = 0;
    }

    public int allocateLocation(String uri) {
        if (locationMap.containsKey(uri)) {
            return locationMap.get(uri);
        } else {
            int id = nextId++;
            idMap.put(id,uri);
            locationMap.put(uri,id);
            return id;
        }
    }


    public String getSystemId(long locationId) {
        int locId = (int) locationId;
        if (idMap.containsKey(locId)) {
            return idMap.get(locId);
        } else {
            return null;
        }
    }

    public int getLineNumber(long locationId) {
        return 0;
    }

    public int getColumnNumber(long locationId) {
        return 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy