Code example for InputSource

Methods: getSystemId, setSystemId

0
        this.sourceJarFile = new ZipFile(jarFile);
 
        InputStream stream = sourceJarFile.getInputStream(jarFileEntry);
        if(stream != null)
        { 
            InputSource inputSource = new InputSource(stream);
            inputSource.setSystemId(sourceJarFile.getName() + "!" + jarFileEntry.getName());
 
            this.inputSrcTracker = new FileTracker();
            ((FileTracker) this.inputSrcTracker).setFile(jarFile);
            if(parentSrcTracker != null)
                this.inputSrcTracker.setParent(parentSrcTracker);
 
            return inputSource;
        } 
        else 
            throw new FileNotFoundException("Zip entry '" + jarFileEntry.getName() + "' not found in zip file '" + jarFile.getAbsolutePath() + "'.");
    } 
 
    public void init(InputSource inputSource) throws ParserConfigurationException, SAXException
    { 
        this.inputSource = inputSource;
        this.errors = new ArrayList();
        this.warnings = new ArrayList();
 
        if(inputSource.getSystemId() == null)
            throw new ParserConfigurationException("Please set the system id.");
 
        SAXParser saxParser = getParserFactory().newSAXParser();
        parser = saxParser.getXMLReader();
    }