View Javadoc
1 /* 2 OctopusEntityResolver - Class used for validating XML files using schema. 3 4 Copyright (C) 2002-2003 Together 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License as published by the Free Software Foundation; either 9 version 2.1 of the License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with this library; if not, write to the Free Software 18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 20 OctopusEntityResolver.java 21 Date: 25.6.2004. 22 @version 1.0 23 @author: Zeljko Kovacevic zeljko@prozone.co.yu 24 */ 25 26 package org.webdocwf.util.loader; 27 28 import java.io.File; 29 import java.io.FileInputStream; 30 import java.io.FileNotFoundException; 31 32 import org.xml.sax.EntityResolver; 33 import org.xml.sax.InputSource; 34 35 /*** 36 * OctopusEntityResolver 37 * @author Zeljko Kovacevic 38 * @version 1.0 39 */ 40 public class OctopusEntityResolver implements EntityResolver { 41 42 //constructor 43 public OctopusEntityResolver() { 44 } 45 46 public InputSource resolveEntity (String publicId, String systemId ) 47 { 48 if ( true ) { 49 // for first mapping 50 String OCTOPUS_HOME = System.getProperty("OCTOPUS_HOME"); 51 if( OCTOPUS_HOME == null ){ 52 return new InputSource( getClass().getClassLoader().getResourceAsStream("xml/xmlschema/loaderJob.xsd")); 53 }else{ 54 try { 55 return new InputSource( new FileInputStream(new File(OCTOPUS_HOME + "/XmlTransform/xml/xmlschema/loaderJob.xsd"))); 56 } catch (Exception e) { 57 try { 58 return new InputSource( getClass().getClassLoader().getResourceAsStream("xml/xmlschema/loaderJob.xsd")); 59 }catch(Exception ex) { 60 return null; 61 } 62 } 63 } 64 } 65 66 else { 67 // use the default behaviour 68 return null; 69 } 70 } 71 } 72

This page was automatically generated by Maven