Add JAXP 1.4 API

git-svn-id: https://svn.apache.org/repos/asf/servicemix/smx4/specs/trunk@709694 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/jaxp-api-1.3/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java b/jaxp-api-1.3/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
index 9f08d92..04cf4bb 100644
--- a/jaxp-api-1.3/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
+++ b/jaxp-api-1.3/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
@@ -122,6 +122,15 @@
         if (className == null) {
             String      service = "META-INF/services/" + property;
             
+	        try {
+	            // If we are deployed into an OSGi environment, leverage it
+	            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(service);
+	            if (spiClass != null) {
+	                return (XMLReader) spiClass.newInstance();
+	            }
+	        } catch (Throwable e) {
+	        }
+
             InputStream is = null;
             
             // First try the Context ClassLoader
diff --git a/jaxp-api-1.4/pom.xml b/jaxp-api-1.4/pom.xml
new file mode 100644
index 0000000..54b1157
--- /dev/null
+++ b/jaxp-api-1.4/pom.xml
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.specs</groupId>
+        <artifactId>specs</artifactId>
+        <version>1.2-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.specs</groupId>
+    <artifactId>org.apache.servicemix.specs.jaxp-api-1.4</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.2-SNAPSHOT</version>
+    <name>Apache ServiceMix Specs :: JAXP API 1.4</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix.specs</groupId>
+            <artifactId>org.apache.servicemix.specs.locator</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>xml-apis</groupId>
+            <artifactId>xml-apis</artifactId>
+            <version>1.4.01-r709679</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Export-Package>
+                            javax.xml*;version=1.3;-split-package:=merge-first,
+                            org.w3c.dom*;version=1.0;-split-package:=merge-first,
+                            org.xml.sax*;version=2.0.2;-split-package:=merge-first,
+                        </Export-Package>
+                        <Import-Package>
+                            *
+                        </Import-Package>
+                        <Private-Package>org.apache.servicemix.specs.locator;-split-package:=merge-first</Private-Package>
+                        <Bundle-Activator>org.apache.servicemix.specs.locator.Activator</Bundle-Activator>
+                        <Implementation-Title>Apache ServiceMix</Implementation-Title>
+                        <Implementation-Version>${project.version}</Implementation-Version>
+                    </instructions>
+                    <unpackBundle>true</unpackBundle>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <artifactSet>
+                                <includes>
+                                    <include>org.apache.servicemix.specs:org.apache.servicemix.specs.locator</include>
+                                </includes>
+                            </artifactSet>
+                            <filters>
+                                <filter>
+                                    <artifact>${project.groupId}:${project.artifactId}</artifact>
+                                    <excludes>
+                                        <exclude>org/apache/servicemix/**</exclude>
+                                    </excludes>
+                                </filter>
+                            </filters>
+                            <createSourcesJar>${createSourcesJar}</createSourcesJar>
+                            <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+                            <createDependencyReducedPom>true</createDependencyReducedPom>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>deploy</id>
+            <properties>
+                <createSourcesJar>true</createSourcesJar>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-source-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>attach-sources</id>
+                                <phase>process-classes</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>unpack-sources</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>unpack</goal>
+                                </goals>
+                                <configuration>
+                                    <artifactItems>
+                                        <artifactItem>
+                                            <groupId>org.apache.servicemix.specs</groupId>
+                                            <artifactId>org.apache.servicemix.specs.locator</artifactId>
+                                            <classifier>sources</classifier>
+                                        </artifactItem>
+                                    </artifactItems>
+                                    <outputDirectory>${project.build.directory}/sources</outputDirectory>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-javadoc-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>package</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <minmemory>128m</minmemory>
+                            <maxmemory>512m</maxmemory>
+                            <sourcepath>${project.build.directory}/sources</sourcepath>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/datatype/FactoryFinder.java b/jaxp-api-1.4/src/main/java/javax/xml/datatype/FactoryFinder.java
new file mode 100644
index 0000000..c8116b5
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/datatype/FactoryFinder.java
@@ -0,0 +1,396 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: FactoryFinder.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.datatype;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * <p>Implement pluggabile Datatypes.</p>
+ * 
+ * <p>This class is duplicated for each JAXP subpackage so keep it in
+ * sync.  It is package private for secure class loading.</p>
+ *
+ * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
+ * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $
+ * @since 1.5
+ */
+final class FactoryFinder {
+	
+	/**
+	 * <p>Name of class to display in output messages.</p>
+	 */
+	private static final String CLASS_NAME = "javax.xml.datatype.FactoryFinder";
+	
+    /**
+     * <p>Debug flag to trace loading process.</p>
+     */
+    private static boolean debug = false;
+    
+    /**
+     * <p>Cache properties for performance.</p>
+     */
+	private static Properties cacheProps = new Properties();
+	
+	/**
+	 * <p>First time requires initialization overhead.</p>
+	 */
+	private static boolean firstTime = true;
+    
+    /**
+     * Default columns per line.
+     */
+    private static final int DEFAULT_LINE_LENGTH = 80;
+	
+	/**
+	 * <p>Check to see if debugging enabled by property.</p>
+	 * 
+	 * <p>Use try/catch block to support applets, which throws
+     * SecurityException out of this code.</p>
+	 * 
+	 */
+    static {
+        try {
+            String val = SecuritySupport.getSystemProperty("jaxp.debug");
+            // Allow simply setting the prop to turn on debug
+            debug = val != null && (! "false".equals(val));
+        } catch (Exception x) {
+            debug = false;
+        }
+    }
+    
+    private FactoryFinder() {}
+
+	/**
+	 * <p>Output debugging messages.</p>
+	 * 
+	 * @param msg <code>String</code> to print to <code>stderr</code>.
+	 */
+    private static void debugPrintln(String msg) {
+        if (debug) {
+            System.err.println(
+            	CLASS_NAME
+            	+ ":"
+            	+ msg);
+        }
+    }
+
+    /**
+     * <p>Find the appropriate <code>ClassLoader</code> to use.</p>
+     * 
+     * <p>The context ClassLoader is prefered.</p>
+     * 
+     * @return <code>ClassLoader</code> to use.
+     * 
+     * @throws ConfigurationError If a valid <code>ClassLoader</code> cannot be identified. 
+     */
+    private static ClassLoader findClassLoader()
+        throws ConfigurationError {
+        ClassLoader classLoader;
+
+        // Figure out which ClassLoader to use for loading the provider
+        // class.  If there is a Context ClassLoader then use it.
+
+        classLoader = SecuritySupport.getContextClassLoader();            
+
+        if (debug) debugPrintln(
+            "Using context class loader: "
+            + classLoader);
+
+        if (classLoader == null) {
+            // if we have no Context ClassLoader
+            // so use the current ClassLoader
+            classLoader = FactoryFinder.class.getClassLoader();
+            if (debug) debugPrintln(
+                "Using the class loader of FactoryFinder: "
+                + classLoader);                
+        }
+                    
+        return classLoader;
+    }
+
+    /**
+     * <p>Create an instance of a class using the specified ClassLoader.</p>
+     * 
+     * @param className Name of class to create.
+     * @param classLoader ClassLoader to use to create named class.
+     * 
+     * @return New instance of specified class created using the specified ClassLoader.
+     * 
+     * @throws ConfigurationError If class could not be created.
+     */
+    private static Object newInstance(
+    	String className,
+        ClassLoader classLoader)
+        throws ConfigurationError {
+        	
+        try {
+            Class spiClass;
+            if (classLoader == null) {
+                spiClass = Class.forName(className);
+            } else {
+                spiClass = classLoader.loadClass(className);
+            }
+            
+            if (debug) {
+            	debugPrintln("Loaded " + className + " from " + which(spiClass));
+            }
+             
+            return spiClass.newInstance();
+        } catch (ClassNotFoundException x) {
+            throw new ConfigurationError(
+                "Provider " + className + " not found", x);
+        } catch (Exception x) {
+            throw new ConfigurationError(
+                "Provider " + className + " could not be instantiated: " + x,
+                x);
+        }
+    }
+
+    /**
+     * Finds the implementation Class object in the specified order.  Main
+     * entry point.
+     * Package private so this code can be shared.
+     *
+     * @param factoryId Name of the factory to find, same as a property name
+     * @param fallbackClassName Implementation class name, if nothing else is found.  Use null to mean no fallback.
+     *
+     * @return Class Object of factory, never null
+     * 
+     * @throws ConfigurationError If Class cannot be found.
+     */
+    static Object find(String factoryId, String fallbackClassName)
+        throws ConfigurationError {
+        	
+        ClassLoader classLoader = findClassLoader();
+
+        try {
+            // If we are deployed into an OSGi environment, leverage it
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            if (spiClass != null) {
+                return spiClass.newInstance();
+            }
+        } catch (Throwable e) {
+        }
+
+        // Use the system property first
+        try {
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
+            if (systemProp != null) {
+                if (debug) debugPrintln("found " + systemProp + " in the system property " + factoryId);
+                return newInstance(systemProp, classLoader);
+            }
+        } catch (SecurityException se) {
+        	; // NOP, explicitly ignore SecurityException
+        }
+
+        // try to read from $java.home/lib/jaxp.properties
+        try {
+            String javah = SecuritySupport.getSystemProperty("java.home");
+            String configFile = javah + File.separator + "lib" + File.separator + "jaxp.properties";
+			String factoryClassName = null;
+			if (firstTime) {
+				synchronized (cacheProps) {
+					if (firstTime) {
+						File f = new File(configFile);
+						firstTime = false;
+						if (SecuritySupport.doesFileExist(f)) {
+							if (debug) debugPrintln("Read properties file " + f);
+							cacheProps.load(SecuritySupport.getFileInputStream(f));
+						}
+					}
+				}
+			}
+			factoryClassName = cacheProps.getProperty(factoryId);
+            if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties"); 
+			
+			if (factoryClassName != null) {
+				return newInstance(factoryClassName, classLoader);
+			}
+        } catch (Exception ex) {
+            if (debug) {
+            	ex.printStackTrace();
+            } 
+        }
+        
+        // Try Jar Service Provider Mechanism
+        Object provider = findJarServiceProvider(factoryId);
+        if (provider != null) {
+            return provider;
+        }
+
+        if (fallbackClassName == null) {
+            throw new ConfigurationError(
+                "Provider for " + factoryId + " cannot be found", null);
+        }
+
+        if (debug) debugPrintln("loaded from fallback value: " + fallbackClassName);
+        return newInstance(fallbackClassName, classLoader);
+    }
+
+    /*
+     * Try to find provider using Jar Service Provider Mechanism
+     *
+     * @return instance of provider class if found or null
+     */
+    private static Object findJarServiceProvider(String factoryId)
+        throws ConfigurationError
+    {
+
+        String serviceId = "META-INF/services/" + factoryId;
+        InputStream is = null;
+
+        // First try the Context ClassLoader
+        ClassLoader cl = SecuritySupport.getContextClassLoader();
+        if (cl != null) {
+            is = SecuritySupport.getResourceAsStream(cl, serviceId);
+
+            // If no provider found then try the current ClassLoader
+            if (is == null) {
+                cl = FactoryFinder.class.getClassLoader();
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
+            }
+        } else {
+            // No Context ClassLoader, try the current
+            // ClassLoader
+            cl = FactoryFinder.class.getClassLoader();
+            is = SecuritySupport.getResourceAsStream(cl, serviceId);
+        }
+
+        if (is == null) {
+            // No provider found
+            return null;
+        }
+
+        if (debug) debugPrintln("found jar resource=" + serviceId +
+               " using ClassLoader: " + cl);
+
+        BufferedReader rd;
+        try {
+            rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
+        } catch (java.io.UnsupportedEncodingException e) {
+            rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
+        }
+        
+        String factoryClassName = null;
+        try {
+            // XXX Does not handle all possible input as specified by the
+            // Jar Service Provider specification
+            factoryClassName = rd.readLine();
+        } 
+        catch (IOException x) {
+            // No provider found
+            return null;
+        }
+        finally {
+            try { 
+                // try to close the reader. 
+                rd.close(); 
+            } 
+            // Ignore the exception. 
+            catch (IOException exc) {}
+        }
+
+        if (factoryClassName != null &&
+            ! "".equals(factoryClassName)) {
+            if (debug) debugPrintln("found in resource, value="
+                   + factoryClassName);
+
+            return newInstance(factoryClassName, cl);
+        }
+
+        // No provider found
+        return null;
+    }
+    
+	/**
+	 * <p>Configuration Error.</p>
+	 */
+    static class ConfigurationError extends Error {
+        
+        private static final long serialVersionUID = -3644413026244211347L;
+    	
+    	/**
+    	 * <p>Exception that caused the error.</p>
+    	 */
+        private Exception exception;
+
+        /**
+         * <p>Construct a new instance with the specified detail string and
+         * exception.</p>
+         * 
+         * @param msg Detail message for this error.
+         * @param x Exception that caused the error.
+         */
+        ConfigurationError(String msg, Exception x) {
+            super(msg);
+            this.exception = x;
+        }
+
+		/**
+		 * <p>Get the Exception that caused the error.</p>
+		 * 
+		 * @return Exception that caused the error.
+		 */
+        Exception getException() {
+            return exception;
+        }
+    }
+
+
+
+    /**
+     * Returns the location where the given Class is loaded from.
+     * 
+     * @param clazz Class to find load location.
+     * 
+     * @return Location where class would be loaded from.
+     */
+    private static String which(Class clazz) {
+        try {
+            String classnameAsResource = clazz.getName().replace('.', '/') + ".class";
+    
+            ClassLoader loader = clazz.getClassLoader();
+            
+            URL it;
+    
+            if (loader != null) {
+            	it = loader.getResource(classnameAsResource);
+            } else {
+            	it = ClassLoader.getSystemResource(classnameAsResource);
+            } 
+    
+            if (it != null) {
+            	return it.toString();
+            } 
+        } catch (Throwable t) {
+            // work defensively.
+            if (debug) {
+            	t.printStackTrace();
+            } 
+        }
+        return "unknown location";
+    }
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/datatype/SecuritySupport.java b/jaxp-api-1.4/src/main/java/javax/xml/datatype/SecuritySupport.java
new file mode 100644
index 0000000..da82748
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/datatype/SecuritySupport.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: SecuritySupport.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.datatype;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in sync.
+ * It is package private and therefore is not exposed as part of the JAXP
+ * API.
+ *
+ * Security related methods that only work on J2SE 1.2 and newer.
+ */
+final class SecuritySupport  {
+    
+    private SecuritySupport() {}
+    
+    static ClassLoader getContextClassLoader() {
+	return (ClassLoader)
+		AccessController.doPrivileged(new PrivilegedAction() {
+	    public Object run() {
+		ClassLoader cl = null;
+		try {
+		    cl = Thread.currentThread().getContextClassLoader();
+		} catch (SecurityException ex) { }
+		return cl;
+	    }
+	});
+    }
+
+    static String getSystemProperty(final String propName) {
+	return (String)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return System.getProperty(propName);
+                }
+            });
+    }
+
+    static FileInputStream getFileInputStream(final File file)
+        throws FileNotFoundException
+    {
+	try {
+            return (FileInputStream)
+                AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                    public Object run() throws FileNotFoundException {
+                        return new FileInputStream(file);
+                    }
+                });
+	} catch (PrivilegedActionException e) {
+	    throw (FileNotFoundException)e.getException();
+	}
+    }
+
+    static InputStream getResourceAsStream(final ClassLoader cl,
+                                           final String name)
+    {
+        return (InputStream)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    InputStream ris;
+                    if (cl == null) {
+                        ris = ClassLoader.getSystemResourceAsStream(name);
+                    } else {
+                        ris = cl.getResourceAsStream(name);
+                    }
+                    return ris;
+                }
+            });
+    }
+
+    static boolean doesFileExist(final File f) {
+    return ((Boolean)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+                }
+            })).booleanValue();
+    }
+
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/parsers/FactoryFinder.java b/jaxp-api-1.4/src/main/java/javax/xml/parsers/FactoryFinder.java
new file mode 100644
index 0000000..c2428ba
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/parsers/FactoryFinder.java
@@ -0,0 +1,338 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: FactoryFinder.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.parsers;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in
+ * sync.  It is package private.
+ *
+ * This code is designed to implement the JAXP 1.1 spec pluggability
+ * feature and is designed to run on JDK version 1.1 and later including
+ * JVMs that perform early linking like the Microsoft JVM in IE 5.  Note
+ * however that it must be compiled on a JDK version 1.2 or later system
+ * since it calls Thread#getContextClassLoader().  The code also runs both
+ * as part of an unbundled jar file and when bundled as part of the JDK.
+ */
+final class FactoryFinder {
+    
+    /** Temp debug code - this will be removed after we test everything
+     */
+    private static boolean debug = false;
+    static Properties cacheProps= new Properties();
+    static boolean firstTime = true;
+    
+    /**
+     * Default columns per line.
+     */
+    private static final int DEFAULT_LINE_LENGTH = 80;
+
+    // Define system property "jaxp.debug" to get output
+    static {
+        // Use try/catch block to support applets, which throws
+        // SecurityException out of this code.
+        try {
+            String val = SecuritySupport.getSystemProperty("jaxp.debug");
+            // Allow simply setting the prop to turn on debug
+            debug = val != null && (! "false".equals(val));
+        } catch (SecurityException se) {
+            debug = false;
+        }
+    }
+    
+    private FactoryFinder() {}
+
+    private static void dPrint(String msg) {
+        if (debug) {
+            System.err.println("JAXP: " + msg);
+        }
+    }
+    
+    /**
+     * Create an instance of a class using the specified ClassLoader and
+     * optionally fall back to the current ClassLoader if not found.
+     *
+     * @param className Name of the concrete class corresponding to the
+     * service provider
+     *
+     * @param cl ClassLoader to use to load the class, null means to use
+     * the bootstrap ClassLoader
+     *
+     * @param doFallback true if the current ClassLoader should be tried as
+     * a fallback if the class is not found using cl
+     */
+    private static Object newInstance(String className, ClassLoader cl,
+                                      boolean doFallback)
+        throws ConfigurationError
+    {
+        // assert(className != null);
+
+        try {
+            Class providerClass;
+            if (cl == null) {
+                // If classloader is null Use the bootstrap ClassLoader.  
+                // Thus Class.forName(String) will use the current
+                // ClassLoader which will be the bootstrap ClassLoader.
+                providerClass = Class.forName(className);
+            } else {
+                try {
+                    providerClass = cl.loadClass(className);
+                } catch (ClassNotFoundException x) {
+                    if (doFallback) {
+                        // Fall back to current classloader
+                        cl = FactoryFinder.class.getClassLoader();
+                        if (cl != null) {
+                            providerClass = cl.loadClass(className);
+                        }
+                        else {
+                            providerClass = Class.forName(className);
+                        }
+                    } else {
+                        throw x;
+                    }
+                }
+            }
+                        
+            Object instance = providerClass.newInstance();
+            if (debug) dPrint("created new instance of " + providerClass +
+                   " using ClassLoader: " + cl);
+            return instance;
+        } catch (ClassNotFoundException x) {
+            throw new ConfigurationError(
+                "Provider " + className + " not found", x);
+        } catch (Exception x) {
+            throw new ConfigurationError(
+                "Provider " + className + " could not be instantiated: " + x,
+                x);
+        }
+    }
+    
+    /**
+     * Finds the implementation Class object in the specified order.  Main
+     * entry point.
+     * @return Class object of factory, never null
+     *
+     * @param factoryId             Name of the factory to find, same as
+     *                              a property name
+     * @param fallbackClassName     Implementation class name, if nothing else
+     *                              is found.  Use null to mean no fallback.
+     *
+     * Package private so this code can be shared.
+     */
+    static Object find(String factoryId, String fallbackClassName)
+        throws ConfigurationError
+    {        
+
+        // Figure out which ClassLoader to use for loading the provider
+        // class.  If there is a Context ClassLoader then use it.
+        
+        ClassLoader classLoader = SecuritySupport.getContextClassLoader();
+        
+        if (classLoader == null) {
+            // if we have no Context ClassLoader
+            // so use the current ClassLoader
+            classLoader = FactoryFinder.class.getClassLoader();
+        }
+
+        if (debug) dPrint("find factoryId =" + factoryId);
+        
+        try {
+            // If we are deployed into an OSGi environment, leverage it
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            if (spiClass != null) {
+                return spiClass.newInstance();
+            }
+        } catch (Throwable e) {
+        }
+
+        // Use the system property first
+        try {
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
+            if( systemProp!=null) {                
+                if (debug) dPrint("found system property, value=" + systemProp);
+                return newInstance(systemProp, classLoader, true );
+            }
+        } catch (SecurityException se) {
+            //if first option fails due to any reason we should try next option in the
+            //look up algorithm.
+        }
+
+        // try to read from $java.home/lib/jaxp.properties
+        try {
+            String javah = SecuritySupport.getSystemProperty("java.home");
+            String configFile = javah + File.separator +
+                "lib" + File.separator + "jaxp.properties";
+            String factoryClassName = null;
+            if(firstTime){
+                synchronized(cacheProps){
+                    if(firstTime){
+                        File f=new File( configFile );
+                        firstTime = false;
+                        if(SecuritySupport.doesFileExist(f)){
+                            if (debug) dPrint("Read properties file "+f);
+                            //cacheProps.load( new FileInputStream(f));
+                            cacheProps.load(SecuritySupport.getFileInputStream(f));
+                        }
+                    }
+                }
+            }
+            factoryClassName = cacheProps.getProperty(factoryId);            
+
+            if(factoryClassName != null){
+                if (debug) dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+                return newInstance(factoryClassName, classLoader, true);
+            }
+        } catch(Exception ex ) {
+            if( debug ) ex.printStackTrace();
+        }
+
+        // Try Jar Service Provider Mechanism
+        Object provider = findJarServiceProvider(factoryId);
+        if (provider != null) {
+            return provider;
+        }
+        if (fallbackClassName == null) {
+            throw new ConfigurationError(
+                "Provider for " + factoryId + " cannot be found", null);
+        }
+
+        if (debug) dPrint("loaded from fallback value: " + fallbackClassName);
+        return newInstance(fallbackClassName, classLoader, true);
+    }
+    
+    /*
+     * Try to find provider using Jar Service Provider Mechanism
+     *
+     * @return instance of provider class if found or null
+     */
+    private static Object findJarServiceProvider(String factoryId)
+        throws ConfigurationError
+    {
+
+        String serviceId = "META-INF/services/" + factoryId;
+        InputStream is = null;
+
+        // First try the Context ClassLoader
+        ClassLoader cl = SecuritySupport.getContextClassLoader();
+        if (cl != null) {
+            is = SecuritySupport.getResourceAsStream(cl, serviceId);
+
+            // If no provider found then try the current ClassLoader
+            if (is == null) {
+                cl = FactoryFinder.class.getClassLoader();
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
+            }
+        } else {
+            // No Context ClassLoader, try the current
+            // ClassLoader
+            cl = FactoryFinder.class.getClassLoader();
+            is = SecuritySupport.getResourceAsStream(cl, serviceId);
+        }
+
+        if (is == null) {
+            // No provider found
+            return null;
+        }
+
+        if (debug) dPrint("found jar resource=" + serviceId +
+               " using ClassLoader: " + cl);
+
+        // Read the service provider name in UTF-8 as specified in
+        // the jar spec.  Unfortunately this fails in Microsoft
+        // VJ++, which does not implement the UTF-8
+        // encoding. Theoretically, we should simply let it fail in
+        // that case, since the JVM is obviously broken if it
+        // doesn't support such a basic standard.  But since there
+        // are still some users attempting to use VJ++ for
+        // development, we have dropped in a fallback which makes a
+        // second attempt using the platform's default encoding. In
+        // VJ++ this is apparently ASCII, which is a subset of
+        // UTF-8... and since the strings we'll be reading here are
+        // also primarily limited to the 7-bit ASCII range (at
+        // least, in English versions), this should work well
+        // enough to keep us on the air until we're ready to
+        // officially decommit from VJ++. [Edited comment from
+        // jkesselm]
+        BufferedReader rd;
+        try {
+            rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
+        } catch (java.io.UnsupportedEncodingException e) {
+            rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
+        }
+        
+        String factoryClassName = null;
+        try {
+            // XXX Does not handle all possible input as specified by the
+            // Jar Service Provider specification
+            factoryClassName = rd.readLine();
+        } 
+        catch (IOException x) {
+            // No provider found
+            return null;
+        }
+        finally {
+            try { 
+                // try to close the reader. 
+                rd.close(); 
+            } 
+            // Ignore the exception. 
+            catch (IOException exc) {}
+        }
+
+        if (factoryClassName != null &&
+            ! "".equals(factoryClassName)) {
+            if (debug) dPrint("found in resource, value="
+                   + factoryClassName);
+
+        // Note: here we do not want to fall back to the current
+        // ClassLoader because we want to avoid the case where the
+        // resource file was found using one ClassLoader and the
+        // provider class was instantiated using a different one.
+        return newInstance(factoryClassName, cl, false);
+        }
+
+        // No provider found
+        return null;
+    }
+
+    static class ConfigurationError extends Error {
+        private Exception exception;
+
+        /**
+         * Construct a new instance with the specified detail string and
+         * exception.
+         */
+        ConfigurationError(String msg, Exception x) {
+            super(msg);
+            this.exception = x;
+        }
+
+        Exception getException() {
+            return exception;
+        }
+    }
+
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/parsers/ScuritySupport.java b/jaxp-api-1.4/src/main/java/javax/xml/parsers/ScuritySupport.java
new file mode 100644
index 0000000..95e92be
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/parsers/ScuritySupport.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: SecuritySupport.java,v 1.2.24.1 2005/03/29 23:25:08 jsuttor Exp $
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in sync.
+ * It is package private and therefore is not exposed as part of the JAXP
+ * API.
+ *
+ * Security related methods that only work on J2SE 1.2 and newer.
+ */
+final class SecuritySupport  {
+    
+    private SecuritySupport() {}
+    
+    static ClassLoader getContextClassLoader() {
+	return (ClassLoader)
+		AccessController.doPrivileged(new PrivilegedAction() {
+	    public Object run() {
+		ClassLoader cl = null;
+		try {
+		    cl = Thread.currentThread().getContextClassLoader();
+		} catch (SecurityException ex) { }
+		return cl;
+	    }
+	});
+    }
+
+    static String getSystemProperty(final String propName) {
+	return (String)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return System.getProperty(propName);
+                }
+            });
+    }
+
+    static FileInputStream getFileInputStream(final File file)
+        throws FileNotFoundException
+    {
+	try {
+            return (FileInputStream)
+                AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                    public Object run() throws FileNotFoundException {
+                        return new FileInputStream(file);
+                    }
+                });
+	} catch (PrivilegedActionException e) {
+	    throw (FileNotFoundException)e.getException();
+	}
+    }
+
+    static InputStream getResourceAsStream(final ClassLoader cl,
+                                           final String name)
+    {
+        return (InputStream)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    InputStream ris;
+                    if (cl == null) {
+                        ris = ClassLoader.getSystemResourceAsStream(name);
+                    } else {
+                        ris = cl.getResourceAsStream(name);
+                    }
+                    return ris;
+                }
+            });
+    }
+
+    static boolean doesFileExist(final File f) {
+    return ((Boolean)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+                }
+            })).booleanValue();
+    }
+
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/stream/FactoryLocator.java b/jaxp-api-1.4/src/main/java/javax/xml/stream/FactoryLocator.java
new file mode 100644
index 0000000..a4f5ff7
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/stream/FactoryLocator.java
@@ -0,0 +1,134 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package javax.xml.stream;
+
+import java.io.InputStream;
+import java.io.File;
+import java.io.FileInputStream;
+
+import java.util.Properties;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+/*
+ * Here is the beef on the finding the Factory Class
+ * 
+ * 1. Use the javax.xml.stream.XMLInputFactory system property. 2. Use the
+ * properties file "lib/stax.properties" in the JRE directory. This
+ * configuration file is in standard java.util.Properties format and contains
+ * the fully qualified name of the implementation class with the key being the
+ * system property defined above. 3. Use the Services API (as detailed in the
+ * JAR specification), if available, to determine the classname. The Services
+ * API will look for a classname in the file
+ * META-INF/services/javax.xml.stream.XMLInputFactory in jars available to the
+ * runtime. Platform default XMLInputFactory instance.
+ * 
+ * If the user provided a classloader we'll use that...if not, we'll assume the 
+ * classloader of this class.
+ */
+
+class FactoryLocator {
+	static Object locate(String factoryId) throws FactoryConfigurationError {
+		return locate(factoryId, null);
+	}
+
+	static Object locate(String factoryId, String altClassName)
+			throws FactoryConfigurationError {
+		return locate(factoryId, altClassName,
+                              Thread.currentThread().getContextClassLoader());
+	}
+
+	static Object locate(String factoryId, String altClassName,
+                         ClassLoader classLoader) throws FactoryConfigurationError {
+        try {
+            // If we are deployed into an OSGi environment, leverage it
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            if (spiClass != null) {
+                return spiClass.newInstance();
+            }
+        } catch (Throwable e) {
+        }
+
+        try {
+			String prop = System.getProperty(factoryId);
+			if (prop != null) {
+				return loadFactory(prop, classLoader);
+			}
+		} catch (Exception e) {
+		}
+
+		try {
+			String configFile = System.getProperty("java.home")
+					+ File.separator + "lib" + File.separator
+					+ "stax.properties";
+			File f = new File(configFile);
+			if (f.exists()) {
+				Properties props = new Properties();
+				props.load(new FileInputStream(f));
+				String factoryClassName = props.getProperty(factoryId);
+				return loadFactory(factoryClassName, classLoader);
+			}
+		} catch (Exception e) {
+		}
+
+		String serviceId = "META-INF/services/" + factoryId;
+		try {
+			InputStream is = null;
+
+			if (classLoader == null) {
+				is = ClassLoader.getSystemResourceAsStream(serviceId);
+			} else {
+				is = classLoader.getResourceAsStream(serviceId);
+			}
+
+			if (is != null) {
+				BufferedReader br = new BufferedReader(new InputStreamReader(
+						is, "UTF-8"));
+				String factoryClassName = br.readLine();
+				br.close();
+
+				if (factoryClassName != null && !"".equals(factoryClassName)) {
+					return loadFactory(factoryClassName, classLoader);
+				}
+			}
+		} catch (Exception ex) {
+		}
+
+		if (altClassName == null) {
+			throw new FactoryConfigurationError("Unable to locate factory for "
+					+ factoryId + ".", null);
+		}
+		return loadFactory(altClassName, classLoader);
+	}
+
+	private static Object loadFactory(String className, ClassLoader classLoader)
+			throws FactoryConfigurationError {
+		try {
+			Class factoryClass = classLoader == null ? Class.forName(className)
+					: classLoader.loadClass(className);
+
+			return factoryClass.newInstance();
+		} catch (ClassNotFoundException x) {
+			throw new FactoryConfigurationError("Requested factory "
+					+ className + " cannot be located.  Classloader ="
+					+ classLoader.toString(), x);
+		} catch (Exception x) {
+			throw new FactoryConfigurationError("Requested factory "
+					+ className + " could not be instantiated: " + x, x);
+		}
+	}
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/transform/FactoryFinder.java b/jaxp-api-1.4/src/main/java/javax/xml/transform/FactoryFinder.java
new file mode 100644
index 0000000..f273187
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/transform/FactoryFinder.java
@@ -0,0 +1,338 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: FactoryFinder.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.transform;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in
+ * sync.  It is package private.
+ *
+ * This code is designed to implement the JAXP 1.1 spec pluggability
+ * feature and is designed to run on JDK version 1.1 and later including
+ * JVMs that perform early linking like the Microsoft JVM in IE 5.  Note
+ * however that it must be compiled on a JDK version 1.2 or later system
+ * since it calls Thread#getContextClassLoader().  The code also runs both
+ * as part of an unbundled jar file and when bundled as part of the JDK.
+ */
+final class FactoryFinder {
+    
+    /** Temp debug code - this will be removed after we test everything
+     */
+    private static boolean debug = false;
+    static Properties cacheProps= new Properties();
+    static boolean firstTime = true;
+    
+    /**
+     * Default columns per line.
+     */
+    private static final int DEFAULT_LINE_LENGTH = 80;
+
+    // Define system property "jaxp.debug" to get output
+    static {
+        // Use try/catch block to support applets, which throws
+        // SecurityException out of this code.
+        try {
+            String val = SecuritySupport.getSystemProperty("jaxp.debug");
+            // Allow simply setting the prop to turn on debug
+            debug = val != null && (! "false".equals(val));
+        } catch (SecurityException se) {
+            debug = false;
+        }
+    }
+    
+    private FactoryFinder() {}
+
+    private static void dPrint(String msg) {
+        if (debug) {
+            System.err.println("JAXP: " + msg);
+        }
+    }
+    
+    /**
+     * Create an instance of a class using the specified ClassLoader and
+     * optionally fall back to the current ClassLoader if not found.
+     *
+     * @param className Name of the concrete class corresponding to the
+     * service provider
+     *
+     * @param cl ClassLoader to use to load the class, null means to use
+     * the bootstrap ClassLoader
+     *
+     * @param doFallback true if the current ClassLoader should be tried as
+     * a fallback if the class is not found using cl
+     */
+    private static Object newInstance(String className, ClassLoader cl,
+                                      boolean doFallback)
+        throws ConfigurationError
+    {
+        // assert(className != null);
+
+        try {
+            Class providerClass;
+            if (cl == null) {
+                // If classloader is null Use the bootstrap ClassLoader.  
+                // Thus Class.forName(String) will use the current
+                // ClassLoader which will be the bootstrap ClassLoader.
+                providerClass = Class.forName(className);
+            } else {
+                try {
+                    providerClass = cl.loadClass(className);
+                } catch (ClassNotFoundException x) {
+                    if (doFallback) {
+                        // Fall back to current classloader
+                        cl = FactoryFinder.class.getClassLoader();
+                        if (cl != null) {
+                            providerClass = cl.loadClass(className);
+                        }
+                        else {
+                            providerClass = Class.forName(className);
+                        }
+                    } else {
+                        throw x;
+                    }
+                }
+            }
+                        
+            Object instance = providerClass.newInstance();
+            if (debug) dPrint("created new instance of " + providerClass +
+                   " using ClassLoader: " + cl);
+            return instance;
+        } catch (ClassNotFoundException x) {
+            throw new ConfigurationError(
+                "Provider " + className + " not found", x);
+        } catch (Exception x) {
+            throw new ConfigurationError(
+                "Provider " + className + " could not be instantiated: " + x,
+                x);
+        }
+    }
+    
+    /**
+     * Finds the implementation Class object in the specified order.  Main
+     * entry point.
+     * @return Class object of factory, never null
+     *
+     * @param factoryId             Name of the factory to find, same as
+     *                              a property name
+     * @param fallbackClassName     Implementation class name, if nothing else
+     *                              is found.  Use null to mean no fallback.
+     *
+     * Package private so this code can be shared.
+     */
+    static Object find(String factoryId, String fallbackClassName)
+        throws ConfigurationError
+    {        
+
+        // Figure out which ClassLoader to use for loading the provider
+        // class.  If there is a Context ClassLoader then use it.
+        
+        ClassLoader classLoader = SecuritySupport.getContextClassLoader();
+        
+        if (classLoader == null) {
+            // if we have no Context ClassLoader
+            // so use the current ClassLoader
+            classLoader = FactoryFinder.class.getClassLoader();
+        }
+
+        if (debug) dPrint("find factoryId =" + factoryId);
+        
+        try {
+            // If we are deployed into an OSGi environment, leverage it
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(factoryId);
+            if (spiClass != null) {
+                return spiClass.newInstance();
+            }
+        } catch (Throwable e) {
+        }
+
+        // Use the system property first
+        try {
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
+            if( systemProp!=null) {                
+                if (debug) dPrint("found system property, value=" + systemProp);
+                return newInstance(systemProp, classLoader, true );
+            }
+        } catch (SecurityException se) {
+            //if first option fails due to any reason we should try next option in the
+            //look up algorithm.
+        }
+
+        // try to read from $java.home/lib/jaxp.properties
+        try {
+            String javah = SecuritySupport.getSystemProperty("java.home");
+            String configFile = javah + File.separator +
+                "lib" + File.separator + "jaxp.properties";
+            String factoryClassName = null;
+            if(firstTime){
+                synchronized(cacheProps){
+                    if(firstTime){
+                        File f=new File( configFile );
+                        firstTime = false;
+                        if(SecuritySupport.doesFileExist(f)){
+                            if (debug) dPrint("Read properties file "+f);
+                            //cacheProps.load( new FileInputStream(f));
+                            cacheProps.load(SecuritySupport.getFileInputStream(f));
+                        }
+                    }
+                }
+            }
+            factoryClassName = cacheProps.getProperty(factoryId);            
+
+            if(factoryClassName != null){
+                if (debug) dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+                return newInstance(factoryClassName, classLoader, true);
+            }
+        } catch(Exception ex ) {
+            if( debug ) ex.printStackTrace();
+        }
+
+        // Try Jar Service Provider Mechanism
+        Object provider = findJarServiceProvider(factoryId);
+        if (provider != null) {
+            return provider;
+        }
+        if (fallbackClassName == null) {
+            throw new ConfigurationError(
+                "Provider for " + factoryId + " cannot be found", null);
+        }
+
+        if (debug) dPrint("loaded from fallback value: " + fallbackClassName);
+        return newInstance(fallbackClassName, classLoader, true);
+    }
+    
+    /*
+     * Try to find provider using Jar Service Provider Mechanism
+     *
+     * @return instance of provider class if found or null
+     */
+    private static Object findJarServiceProvider(String factoryId)
+        throws ConfigurationError
+    {
+
+        String serviceId = "META-INF/services/" + factoryId;
+        InputStream is = null;
+
+        // First try the Context ClassLoader
+        ClassLoader cl = SecuritySupport.getContextClassLoader();
+        if (cl != null) {
+            is = SecuritySupport.getResourceAsStream(cl, serviceId);
+
+            // If no provider found then try the current ClassLoader
+            if (is == null) {
+                cl = FactoryFinder.class.getClassLoader();
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
+            }
+        } else {
+            // No Context ClassLoader, try the current
+            // ClassLoader
+            cl = FactoryFinder.class.getClassLoader();
+            is = SecuritySupport.getResourceAsStream(cl, serviceId);
+        }
+
+        if (is == null) {
+            // No provider found
+            return null;
+        }
+
+        if (debug) dPrint("found jar resource=" + serviceId +
+               " using ClassLoader: " + cl);
+
+        // Read the service provider name in UTF-8 as specified in
+        // the jar spec.  Unfortunately this fails in Microsoft
+        // VJ++, which does not implement the UTF-8
+        // encoding. Theoretically, we should simply let it fail in
+        // that case, since the JVM is obviously broken if it
+        // doesn't support such a basic standard.  But since there
+        // are still some users attempting to use VJ++ for
+        // development, we have dropped in a fallback which makes a
+        // second attempt using the platform's default encoding. In
+        // VJ++ this is apparently ASCII, which is a subset of
+        // UTF-8... and since the strings we'll be reading here are
+        // also primarily limited to the 7-bit ASCII range (at
+        // least, in English versions), this should work well
+        // enough to keep us on the air until we're ready to
+        // officially decommit from VJ++. [Edited comment from
+        // jkesselm]
+        BufferedReader rd;
+        try {
+            rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
+        } catch (java.io.UnsupportedEncodingException e) {
+            rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
+        }
+        
+        String factoryClassName = null;
+        try {
+            // XXX Does not handle all possible input as specified by the
+            // Jar Service Provider specification
+            factoryClassName = rd.readLine();
+        } 
+        catch (IOException x) {
+            // No provider found
+            return null;
+        }
+        finally {
+            try { 
+                // try to close the reader. 
+                rd.close(); 
+            } 
+            // Ignore the exception. 
+            catch (IOException exc) {}
+        }
+
+        if (factoryClassName != null &&
+            ! "".equals(factoryClassName)) {
+            if (debug) dPrint("found in resource, value="
+                   + factoryClassName);
+
+        // Note: here we do not want to fall back to the current
+        // ClassLoader because we want to avoid the case where the
+        // resource file was found using one ClassLoader and the
+        // provider class was instantiated using a different one.
+        return newInstance(factoryClassName, cl, false);
+        }
+
+        // No provider found
+        return null;
+    }
+
+    static class ConfigurationError extends Error {
+        private Exception exception;
+
+        /**
+         * Construct a new instance with the specified detail string and
+         * exception.
+         */
+        ConfigurationError(String msg, Exception x) {
+            super(msg);
+            this.exception = x;
+        }
+
+        Exception getException() {
+            return exception;
+        }
+    }
+
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/transform/SecuritySupport.java b/jaxp-api-1.4/src/main/java/javax/xml/transform/SecuritySupport.java
new file mode 100644
index 0000000..570dc5e
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/transform/SecuritySupport.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: SecuritySupport.java,v 1.2.24.1 2005/03/29 23:32:22 jsuttor Exp $
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in sync.
+ * It is package private and therefore is not exposed as part of the JAXP
+ * API.
+ *
+ * Security related methods that only work on J2SE 1.2 and newer.
+ */
+final class SecuritySupport  {
+    
+    private SecuritySupport() {}
+    
+    static ClassLoader getContextClassLoader() {
+	return (ClassLoader)
+		AccessController.doPrivileged(new PrivilegedAction() {
+	    public Object run() {
+		ClassLoader cl = null;
+		try {
+		    cl = Thread.currentThread().getContextClassLoader();
+		} catch (SecurityException ex) { }
+		return cl;
+	    }
+	});
+    }
+
+    static String getSystemProperty(final String propName) {
+	return (String)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return System.getProperty(propName);
+                }
+            });
+    }
+
+    static FileInputStream getFileInputStream(final File file)
+        throws FileNotFoundException
+    {
+	try {
+            return (FileInputStream)
+                AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                    public Object run() throws FileNotFoundException {
+                        return new FileInputStream(file);
+                    }
+                });
+	} catch (PrivilegedActionException e) {
+	    throw (FileNotFoundException)e.getException();
+	}
+    }
+
+    static InputStream getResourceAsStream(final ClassLoader cl,
+                                           final String name)
+    {
+        return (InputStream)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    InputStream ris;
+                    if (cl == null) {
+                        ris = ClassLoader.getSystemResourceAsStream(name);
+                    } else {
+                        ris = cl.getResourceAsStream(name);
+                    }
+                    return ris;
+                }
+            });
+    }
+
+    static boolean doesFileExist(final File f) {
+    return ((Boolean)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+                }
+            })).booleanValue();
+    }
+
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/validation/SchemaFactoryFinder.java b/jaxp-api-1.4/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
new file mode 100644
index 0000000..5362a77
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/validation/SchemaFactoryFinder.java
@@ -0,0 +1,471 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: SchemaFactoryFinder.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.validation;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+
+/**
+ * Implementation of {@link SchemaFactory#newInstance(String)}.
+ * 
+ * @author <a href="Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a>
+ * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $
+ * @since 1.5
+ */
+final class SchemaFactoryFinder  {
+
+    /** debug support code. */
+    private static boolean debug = false;
+
+    /**
+     * <p>Cache properties for performance.</p>
+     */
+	private static Properties cacheProps = new Properties();
+    
+	/**
+	 * <p>First time requires initialization overhead.</p>
+	 */
+	private static boolean firstTime = true;
+    
+    /**
+     * Default columns per line.
+     */
+    private static final int DEFAULT_LINE_LENGTH = 80;
+    
+    static {
+        // Use try/catch block to support applets
+        try {
+            String val = SecuritySupport.getSystemProperty("jaxp.debug");
+            // Allow simply setting the prop to turn on debug
+            debug = val != null && (! "false".equals(val));
+        } catch (Exception _) {
+            debug = false;
+        }
+    }
+
+    /**
+     * <p>Conditional debug printing.</p>
+     * 
+     * @param msg to print
+     */
+    private static void debugPrintln(String msg) {
+        if (debug) {
+            System.err.println("JAXP: " + msg);
+        }
+    }
+    
+    /**
+     * <p><code>ClassLoader</code> to use to find <code>SchemaFactory</code>.</p>
+     */
+    private final ClassLoader classLoader;
+    
+    /**
+     * <p>Constructor that specifies <code>ClassLoader</code> to use
+     * to find <code>SchemaFactory</code>.</p>
+     * 
+     * @param loader
+     *      to be used to load resource, {@link SchemaFactory}, and
+     *      {@link SchemaFactoryLoader} implementations during
+     *      the resolution process.
+     *      If this parameter is null, the default system class loader
+     *      will be used.
+     */
+    public SchemaFactoryFinder(ClassLoader loader) {
+        this.classLoader = loader;
+        if( debug ) {
+            debugDisplayClassLoader();
+        }
+    }
+    
+    private void debugDisplayClassLoader() {
+        try {
+            if( classLoader == SecuritySupport.getContextClassLoader() ) {
+                debugPrintln("using thread context class loader ("+classLoader+") for search");
+                return;
+            }
+        } catch( Throwable _ ) {
+            ; // getContextClassLoader() undefined in JDK1.1 
+        }
+        
+        if( classLoader==ClassLoader.getSystemClassLoader() ) {
+            debugPrintln("using system class loader ("+classLoader+") for search");
+            return;
+        }
+
+        debugPrintln("using class loader ("+classLoader+") for search");
+    }
+    
+    /**
+     * <p>Creates a new {@link SchemaFactory} object for the specified
+     * schema language.</p>
+     * 
+     * @param schemaLanguage
+     *      See {@link SchemaFactory Schema Language} table in <code>SchemaFactory</code>
+     *      for the list of available schema languages.
+     * 
+     * @return <code>null</code> if the callee fails to create one.
+     * 
+     * @throws NullPointerException
+     *      If the <tt>schemaLanguage</tt> parameter is null.
+     */
+    public SchemaFactory newFactory(String schemaLanguage) {
+        if(schemaLanguage==null)        throw new NullPointerException();
+        SchemaFactory f = _newFactory(schemaLanguage);
+        if (debug) {
+            if (f != null) {
+                debugPrintln("factory '" + f.getClass().getName() + "' was found for " + schemaLanguage);
+            } else {
+                debugPrintln("unable to find a factory for " + schemaLanguage);
+            }
+        }
+        return f;
+    }
+    
+    /**
+     * <p>Lookup a <code>SchemaFactory</code> for the given <code>schemaLanguage</code>.</p>
+     * 
+     * @param schemaLanguage Schema language to lookup <code>SchemaFactory</code> for.
+     *  
+     * @return <code>SchemaFactory</code> for the given <code>schemaLanguage</code>.
+     */
+    private SchemaFactory _newFactory(String schemaLanguage) {
+        SchemaFactory sf;
+        String propertyName = SERVICE_CLASS.getName() + ":" + schemaLanguage;
+        
+        try {
+            // If we are deployed into an OSGi environment, leverage it
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(SERVICE_CLASS.getName());
+            if (spiClass != null) {
+                return (SchemaFactory) spiClass.newInstance();
+            }
+        } catch (Throwable e) {
+        }
+
+        // system property look up
+        try {
+            if (debug) debugPrintln("Looking up system property '"+propertyName+"'" );
+            String r = SecuritySupport.getSystemProperty(propertyName);
+            if (r != null) {
+                if (debug) debugPrintln("The value is '"+r+"'");
+                sf = createInstance(r);
+                if(sf!=null)    return sf;
+            } 
+            else if (debug) {
+                debugPrintln("The property is undefined.");
+            }
+        } catch( Throwable t ) {
+            if( debug ) {
+                debugPrintln("failed to look up system property '"+propertyName+"'" );
+                t.printStackTrace();
+            }
+        }
+
+        String javah = SecuritySupport.getSystemProperty( "java.home" );
+        String configFile = javah + File.separator +
+        "lib" + File.separator + "jaxp.properties";
+
+        String factoryClassName = null ;
+
+        // try to read from $java.home/lib/jaxp.properties
+        try {
+            if(firstTime){
+                synchronized(cacheProps){
+                    if(firstTime){
+                        File f=new File( configFile );
+                        firstTime = false;
+                        if(SecuritySupport.doesFileExist(f)){
+                            if (debug) debugPrintln("Read properties file " + f);                                
+                            cacheProps.load(SecuritySupport.getFileInputStream(f));
+                        }
+                    }
+                }
+            }
+            factoryClassName = cacheProps.getProperty(propertyName);            
+            if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties"); 
+
+            if (factoryClassName != null) {
+                sf = createInstance(factoryClassName);
+                if(sf != null){
+                    return sf;
+                }
+            }
+        } catch (Exception ex) {
+            if (debug) {
+                ex.printStackTrace();
+            } 
+        }
+
+        /**
+        // try to read from $java.home/lib/jaxp.properties
+        try {
+            String javah = ss.getSystemProperty( "java.home" );
+            String configFile = javah + File.separator +
+            "lib" + File.separator + "jaxp.properties";
+            File f = new File( configFile );
+            if( ss.doesFileExist(f)) {
+                sf = loadFromProperty(
+                        propertyName,f.getAbsolutePath(), new FileInputStream(f));
+                if(sf!=null)    return sf;
+            } else {
+                debugPrintln("Tried to read "+ f.getAbsolutePath()+", but it doesn't exist.");
+            }
+        } catch(Throwable e) {
+            if( debug ) {
+                debugPrintln("failed to read $java.home/lib/jaxp.properties");
+                e.printStackTrace();
+            }
+        }
+         */
+        
+        // try META-INF/services files
+        Iterator sitr = createServiceFileIterator();
+        while(sitr.hasNext()) {
+            URL resource = (URL)sitr.next();
+            if (debug) debugPrintln("looking into " + resource);
+            try {
+                sf = loadFromServicesFile(schemaLanguage,resource.toExternalForm(),SecuritySupport.getURLInputStream(resource));
+                if(sf!=null)    return sf;
+            } catch(IOException e) {
+                if( debug ) {
+                    debugPrintln("failed to read "+resource);
+                    e.printStackTrace();
+                }
+            }
+        }
+        
+        // platform default
+        if (schemaLanguage.equals("http://www.w3.org/2001/XMLSchema")) {
+            if (debug) debugPrintln("attempting to use the platform default XML Schema validator");
+            return createInstance("org.apache.xerces.jaxp.validation.XMLSchemaFactory");
+        }
+        
+        if (debug) debugPrintln("all things were tried, but none was found. bailing out.");
+        return null;
+    }
+    
+    /**
+     * <p>Creates an instance of the specified and returns it.</p>
+     * 
+     * @param className
+     *      fully qualified class name to be instanciated.
+     * 
+     * @return null
+     *      if it fails. Error messages will be printed by this method. 
+     */
+    private SchemaFactory createInstance( String className ) {
+        try {
+            if (debug) debugPrintln("instanciating "+className);
+            Class clazz;
+            if( classLoader!=null )
+                clazz = classLoader.loadClass(className);
+            else
+                clazz = Class.forName(className);
+            if(debug)       debugPrintln("loaded it from "+which(clazz));
+            Object o = clazz.newInstance();
+            
+            if( o instanceof SchemaFactory )
+                return (SchemaFactory)o;
+            
+            if (debug) debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName());
+        } catch( Throwable t ) {
+            debugPrintln("failed to instanciate "+className);
+            if(debug)   t.printStackTrace();
+        }
+        return null;
+    }
+    
+    /** Iterator that lazily computes one value and returns it. */
+    private static abstract class SingleIterator implements Iterator {
+        private boolean seen = false;
+        
+        public final void remove() { throw new UnsupportedOperationException(); }
+        public final boolean hasNext() { return !seen; }
+        public final Object next() {
+            if(seen)    throw new NoSuchElementException();
+            seen = true;
+            return value();
+        }
+        
+        protected abstract Object value();
+    }
+    
+    /**
+     * Returns an {@link Iterator} that enumerates all 
+     * the META-INF/services files that we care.
+     */
+    private Iterator createServiceFileIterator() {
+        if (classLoader == null) {
+            return new SingleIterator() {
+                protected Object value() {
+                    ClassLoader classLoader = SchemaFactoryFinder.class.getClassLoader();
+                    //return (ClassLoader.getSystemResource( SERVICE_ID ));
+                    return SecuritySupport.getResourceAsURL(classLoader, SERVICE_ID);
+                }
+            };
+        } else {
+            try {
+                //final Enumeration e = classLoader.getResources(SERVICE_ID);
+                final Enumeration e = SecuritySupport.getResources(classLoader, SERVICE_ID);
+                if(debug && !e.hasMoreElements()) {
+                    debugPrintln("no "+SERVICE_ID+" file was found");
+                }
+                
+                // wrap it into an Iterator.
+                return new Iterator() {
+                    public void remove() {
+                        throw new UnsupportedOperationException();
+                    }
+
+                    public boolean hasNext() {
+                        return e.hasMoreElements();
+                    }
+
+                    public Object next() {
+                        return e.nextElement();
+                    }
+                };
+            } catch (IOException e) {
+                if (debug) {
+                    debugPrintln("failed to enumerate resources "+SERVICE_ID);
+                    e.printStackTrace();
+                }
+                return new ArrayList().iterator();  // empty iterator
+            }
+        }
+    }
+    
+    /** Searches for a SchemaFactory for a given schema language in a META-INF/services file. */
+    private SchemaFactory loadFromServicesFile(String schemaLanguage, String resourceName, InputStream in) {
+
+        if (debug) debugPrintln("Reading "+resourceName );
+        
+        // Read the service provider name in UTF-8 as specified in
+        // the jar spec.  Unfortunately this fails in Microsoft
+        // VJ++, which does not implement the UTF-8
+        // encoding. Theoretically, we should simply let it fail in
+        // that case, since the JVM is obviously broken if it
+        // doesn't support such a basic standard.  But since there
+        // are still some users attempting to use VJ++ for
+        // development, we have dropped in a fallback which makes a
+        // second attempt using the platform's default encoding. In
+        // VJ++ this is apparently ASCII, which is a subset of
+        // UTF-8... and since the strings we'll be reading here are
+        // also primarily limited to the 7-bit ASCII range (at
+        // least, in English versions), this should work well
+        // enough to keep us on the air until we're ready to
+        // officially decommit from VJ++. [Edited comment from
+        // jkesselm]
+        BufferedReader rd;
+        try {
+            rd = new BufferedReader(new InputStreamReader(in, "UTF-8"), DEFAULT_LINE_LENGTH);
+        } catch (java.io.UnsupportedEncodingException e) {
+            rd = new BufferedReader(new InputStreamReader(in), DEFAULT_LINE_LENGTH);
+        }
+        
+        String factoryClassName = null;
+        SchemaFactory resultFactory = null;
+        // See spec for provider-configuration files: http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Provider%20Configuration%20File
+        while (true) {
+            try {
+                factoryClassName = rd.readLine();   
+            } catch (IOException x) {
+                // No provider found
+                break;
+            }
+            if (factoryClassName != null) {
+                // Ignore comments in the provider-configuration file
+                int hashIndex = factoryClassName.indexOf('#');
+                if (hashIndex != -1) {
+                    factoryClassName = factoryClassName.substring(0, hashIndex);
+                }
+                
+                // Ignore leading and trailing whitespace
+                factoryClassName = factoryClassName.trim();
+                
+                // If there's no text left or if this was a blank line, go to the next one.
+                if (factoryClassName.length() == 0) {
+                    continue;
+                }
+                
+                try {
+                    // Found the right SchemaFactory if its isSchemaLanguageSupported(schemaLanguage) method returns true.
+                    SchemaFactory foundFactory = (SchemaFactory) createInstance(factoryClassName);
+                    if (foundFactory.isSchemaLanguageSupported(schemaLanguage)) {
+                        resultFactory = foundFactory;
+                        break;
+                    }
+                }
+                catch (Exception e) {}
+            }
+            else {
+                break;
+            }
+        }
+        
+        try {
+            // try to close the reader.
+            rd.close();
+        }
+        // Ignore the exception.
+        catch (IOException exc) {}
+        
+        return resultFactory;
+    }
+    
+    private static final Class SERVICE_CLASS = SchemaFactory.class;
+    private static final String SERVICE_ID = "META-INF/services/" + SERVICE_CLASS.getName();
+    
+    
+    
+    private static String which( Class clazz ) {
+        return which( clazz.getName(), clazz.getClassLoader() );
+    }
+
+    /**
+     * <p>Search the specified classloader for the given classname.</p>
+     *
+     * @param classname the fully qualified name of the class to search for
+     * @param loader the classloader to search
+     * 
+     * @return the source location of the resource, or null if it wasn't found
+     */
+    private static String which(String classname, ClassLoader loader) {
+
+        String classnameAsResource = classname.replace('.', '/') + ".class";
+        
+        if( loader==null )  loader = ClassLoader.getSystemClassLoader();
+        
+        //URL it = loader.getResource(classnameAsResource);
+        URL it = SecuritySupport.getResourceAsURL(loader, classnameAsResource);
+        if (it != null) {
+            return it.toString();
+        } else {
+            return null;
+        }
+    }
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/validation/SecuritySupport.java b/jaxp-api-1.4/src/main/java/javax/xml/validation/SecuritySupport.java
new file mode 100644
index 0000000..fea9147
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/validation/SecuritySupport.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: SecuritySupport.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Enumeration;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in sync.
+ * It is package private and therefore is not exposed as part of the JAXP
+ * API.
+ *
+ * Security related methods that only work on J2SE 1.2 and newer.
+ */
+final class SecuritySupport  {
+    
+    private SecuritySupport() {}
+    
+    static ClassLoader getContextClassLoader() {
+	return (ClassLoader)
+		AccessController.doPrivileged(new PrivilegedAction() {
+	    public Object run() {
+		ClassLoader cl = null;
+		try {
+		    cl = Thread.currentThread().getContextClassLoader();
+		} catch (SecurityException ex) { }
+		return cl;
+	    }
+	});
+    }
+
+    static String getSystemProperty(final String propName) {
+	return (String)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return System.getProperty(propName);
+                }
+            });
+    }
+
+    static FileInputStream getFileInputStream(final File file)
+        throws FileNotFoundException
+    {
+	try {
+            return (FileInputStream)
+                AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                    public Object run() throws FileNotFoundException {
+                        return new FileInputStream(file);
+                    }
+                });
+	} catch (PrivilegedActionException e) {
+	    throw (FileNotFoundException)e.getException();
+	}
+    }
+
+    static InputStream getURLInputStream(final URL url)
+        throws IOException
+    {
+	try {
+            return (InputStream)
+                AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                    public Object run() throws IOException {
+                        return url.openStream();
+                    }
+                });
+	} catch (PrivilegedActionException e) {
+	    throw (IOException)e.getException();
+	}
+    }
+
+    static URL getResourceAsURL(final ClassLoader cl,
+                                final String name)
+    {
+        return (URL)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    URL url;
+                    if (cl == null) {
+                        url = ClassLoader.getSystemResource(name);
+                    } else {
+                        url = cl.getSystemResource(name);
+                    }
+                    return url;
+                }
+            });
+    }
+
+    static Enumeration getResources(final ClassLoader cl,
+                                    final String name) throws IOException
+    {
+        try{
+        return (Enumeration)
+            AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                public Object run() throws IOException{
+                    Enumeration enumeration;
+                    if (cl == null) {
+                        enumeration = ClassLoader.getSystemResources(name);
+                    } else {
+                        enumeration = cl.getSystemResources(name);
+                    }
+                    return enumeration;
+                }
+            });
+        }catch(PrivilegedActionException e){
+            throw (IOException)e.getException();
+        }
+    }
+    
+    static InputStream getResourceAsStream(final ClassLoader cl,
+                                           final String name)
+    {
+        return (InputStream)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    InputStream ris;
+                    if (cl == null) {
+                        ris = ClassLoader.getSystemResourceAsStream(name);
+                    } else {
+                        ris = cl.getResourceAsStream(name);
+                    }
+                    return ris;
+                }
+            });
+    }
+
+    static boolean doesFileExist(final File f) {
+    return ((Boolean)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+                }
+            })).booleanValue();
+    }
+
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/xpath/SecuritySupport.java b/jaxp-api-1.4/src/main/java/javax/xml/xpath/SecuritySupport.java
new file mode 100644
index 0000000..c392de1
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/xpath/SecuritySupport.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: SecuritySupport.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.xpath;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Enumeration;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in sync.
+ * It is package private and therefore is not exposed as part of the JAXP
+ * API.
+ *
+ * Security related methods that only work on J2SE 1.2 and newer.
+ */
+final class SecuritySupport  {
+    
+    private SecuritySupport() {}
+    
+    static ClassLoader getContextClassLoader() {
+	return (ClassLoader)
+		AccessController.doPrivileged(new PrivilegedAction() {
+	    public Object run() {
+		ClassLoader cl = null;
+		try {
+		    cl = Thread.currentThread().getContextClassLoader();
+		} catch (SecurityException ex) { }
+		return cl;
+	    }
+	});
+    }
+
+    static String getSystemProperty(final String propName) {
+	return (String)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return System.getProperty(propName);
+                }
+            });
+    }
+
+    static FileInputStream getFileInputStream(final File file)
+        throws FileNotFoundException
+    {
+	try {
+            return (FileInputStream)
+                AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                    public Object run() throws FileNotFoundException {
+                        return new FileInputStream(file);
+                    }
+                });
+	} catch (PrivilegedActionException e) {
+	    throw (FileNotFoundException)e.getException();
+	}
+    }
+
+    static InputStream getURLInputStream(final URL url)
+        throws IOException
+    {
+	try {
+            return (InputStream)
+                AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                    public Object run() throws IOException {
+                        return url.openStream();
+                    }
+                });
+	} catch (PrivilegedActionException e) {
+	    throw (IOException)e.getException();
+	}
+    }
+
+    static URL getResourceAsURL(final ClassLoader cl,
+                                final String name)
+    {
+        return (URL)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    URL url;
+                    if (cl == null) {
+                        url = ClassLoader.getSystemResource(name);
+                    } else {
+                        url = cl.getSystemResource(name);
+                    }
+                    return url;
+                }
+            });
+    }
+
+    static Enumeration getResources(final ClassLoader cl,
+                                    final String name) throws IOException
+    {
+        try{
+        return (Enumeration)
+            AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                public Object run() throws IOException{
+                    Enumeration enumeration;
+                    if (cl == null) {
+                        enumeration = ClassLoader.getSystemResources(name);
+                    } else {
+                        enumeration = cl.getSystemResources(name);
+                    }
+                    return enumeration;
+                }
+            });
+        }catch(PrivilegedActionException e){
+            throw (IOException)e.getException();
+        }
+    }
+    
+    static InputStream getResourceAsStream(final ClassLoader cl,
+                                           final String name)
+    {
+        return (InputStream)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    InputStream ris;
+                    if (cl == null) {
+                        ris = ClassLoader.getSystemResourceAsStream(name);
+                    } else {
+                        ris = cl.getResourceAsStream(name);
+                    }
+                    return ris;
+                }
+            });
+    }
+
+    static boolean doesFileExist(final File f) {
+    return ((Boolean)
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+                }
+            })).booleanValue();
+    }
+
+}
diff --git a/jaxp-api-1.4/src/main/java/javax/xml/xpath/XPathFactoryFinder.java b/jaxp-api-1.4/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
new file mode 100644
index 0000000..ee254af
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
@@ -0,0 +1,437 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathFactoryFinder.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.xpath;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+
+import javax.xml.validation.SchemaFactory;
+
+/**
+ * Implementation of {@link XPathFactory#newInstance(String)}.
+ * 
+ * @author <a href="Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a>
+ * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $
+ * @since 1.5
+ */
+final class XPathFactoryFinder {
+    
+    /** debug support code. */
+    private static boolean debug = false;
+    
+    /**
+     * Default columns per line.
+     */
+    private static final int DEFAULT_LINE_LENGTH = 80;
+    
+    static {
+        // Use try/catch block to support applets
+        try {
+            String val = SecuritySupport.getSystemProperty("jaxp.debug");
+            // Allow simply setting the prop to turn on debug
+            debug = val != null && (! "false".equals(val));
+        } catch (Exception _) {
+            debug = false;
+        }
+    }
+
+    /**
+     * <p>Cache properties for performance.</p>
+     */
+	private static Properties cacheProps = new Properties();
+    
+	/**
+	 * <p>First time requires initialization overhead.</p>
+	 */
+	private static boolean firstTime = true;
+    
+    /**
+     * <p>Conditional debug printing.</p>
+     * 
+     * @param msg to print
+     */
+    private static void debugPrintln(String msg) {
+        if (debug) {
+            System.err.println("JAXP: " + msg);
+        }
+    }
+    
+    /**
+     * <p><code>ClassLoader</code> to use to find <code>SchemaFactory</code>.</p>
+     */
+    private final ClassLoader classLoader;
+    
+    /**
+     * <p>Constructor that specifies <code>ClassLoader</code> to use
+     * to find <code>SchemaFactory</code>.</p>
+     * 
+     * @param loader
+     *      to be used to load resource, {@link SchemaFactory}, and
+     *      {@link SchemaFactoryLoader} implementations during
+     *      the resolution process.
+     *      If this parameter is null, the default system class loader
+     *      will be used.
+     */
+    public XPathFactoryFinder(ClassLoader loader) {
+        this.classLoader = loader;
+        if( debug ) {
+            debugDisplayClassLoader();
+        }
+    }
+    
+    private void debugDisplayClassLoader() {
+        try {
+            if( classLoader == SecuritySupport.getContextClassLoader() ) {
+                debugPrintln("using thread context class loader ("+classLoader+") for search");
+                return;
+            }
+        } catch( Throwable _ ) {
+            ; // getContextClassLoader() undefined in JDK1.1 
+        }
+        
+        if( classLoader==ClassLoader.getSystemClassLoader() ) {
+            debugPrintln("using system class loader ("+classLoader+") for search");
+            return;
+        }
+
+        debugPrintln("using class loader ("+classLoader+") for search");
+    }
+    
+    /**
+     * <p>Creates a new {@link XPathFactory} object for the specified
+     * schema language.</p>
+     * 
+     * @param uri
+     *       Identifies the underlying object model.
+     * 
+     * @return <code>null</code> if the callee fails to create one.
+     * 
+     * @throws NullPointerException
+     *      If the parameter is null.
+     */
+    public XPathFactory newFactory(String uri) {
+        if(uri==null)        throw new NullPointerException();
+        XPathFactory f = _newFactory(uri);
+        if (debug) {
+            if (f != null) {
+                debugPrintln("factory '" + f.getClass().getName() + "' was found for " + uri);
+            } else {
+                debugPrintln("unable to find a factory for " + uri);
+            }
+        }
+        return f;
+    }
+    
+    /**
+     * <p>Lookup a {@link XPathFactory} for the given object model.</p>
+     * 
+     * @param uri identifies the object model.
+     *  
+     * @return {@link XPathFactory} for the given object model.
+     */
+    private XPathFactory _newFactory(String uri) {
+        XPathFactory sf;
+        
+        String propertyName = SERVICE_CLASS.getName() + ":" + uri;
+        
+        try {
+            // If we are deployed into an OSGi environment, leverage it
+            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(propertyName);
+            if (spiClass != null) {
+                return (XPathFactory) spiClass.newInstance();
+            }
+        } catch (Throwable e) {
+        }
+
+        // system property look up
+        try {
+            if (debug) debugPrintln("Looking up system property '"+propertyName+"'" );
+            String r = SecuritySupport.getSystemProperty(propertyName);
+            if(r!=null) {
+                if (debug) debugPrintln("The value is '"+r+"'");
+                sf = createInstance(r);
+                if(sf!=null)    return sf;
+            } 
+            else if (debug) {
+                debugPrintln("The property is undefined.");
+            }
+        } catch( Throwable t ) {
+            if( debug ) {
+                debugPrintln("failed to look up system property '"+propertyName+"'" );
+                t.printStackTrace();
+            }
+        }
+        
+        String javah = SecuritySupport.getSystemProperty( "java.home" );
+        String configFile = javah + File.separator +
+        "lib" + File.separator + "jaxp.properties";
+
+        String factoryClassName = null ;
+
+        // try to read from $java.home/lib/jaxp.properties
+        try {
+            if(firstTime){
+                synchronized(cacheProps){
+                    if(firstTime){
+                        File f=new File( configFile );
+                        firstTime = false;
+                        if(SecuritySupport.doesFileExist(f)){
+                            if (debug) debugPrintln("Read properties file " + f);                                
+                            cacheProps.load(SecuritySupport.getFileInputStream(f));
+                        }
+                    }
+                }
+            }
+            factoryClassName = cacheProps.getProperty(propertyName);            
+            if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties"); 
+
+            if (factoryClassName != null) {
+                sf = createInstance(factoryClassName);
+                if(sf != null){
+                    return sf;
+                }
+            }
+        } catch (Exception ex) {
+            if (debug) {
+                ex.printStackTrace();
+            } 
+        }
+                    
+        // try META-INF/services files
+        Iterator sitr = createServiceFileIterator();
+        while(sitr.hasNext()) {
+            URL resource = (URL)sitr.next();
+            if (debug) debugPrintln("looking into " + resource);
+            try {
+                sf = loadFromServicesFile(uri, resource.toExternalForm(), SecuritySupport.getURLInputStream(resource));
+                if(sf!=null)    return sf;
+            } catch(IOException e) {
+                if( debug ) {
+                    debugPrintln("failed to read "+resource);
+                    e.printStackTrace();
+                }
+            }
+        }
+        
+        // platform default
+        if(uri.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) {
+            if (debug) debugPrintln("attempting to use the platform default W3C DOM XPath lib");
+            return createInstance("org.apache.xpath.jaxp.XPathFactoryImpl");
+        }
+        
+        if (debug) debugPrintln("all things were tried, but none was found. bailing out.");
+        return null;
+    }
+    
+    /**
+     * <p>Creates an instance of the specified and returns it.</p>
+     * 
+     * @param className
+     *      fully qualified class name to be instanciated.
+     * 
+     * @return null
+     *      if it fails. Error messages will be printed by this method. 
+     */
+    private XPathFactory createInstance( String className ) {
+        try {
+            if (debug) debugPrintln("instanciating "+className);
+            Class clazz;
+            if( classLoader!=null )
+                clazz = classLoader.loadClass(className);
+            else
+                clazz = Class.forName(className);
+            if(debug)       debugPrintln("loaded it from "+which(clazz));
+            Object o = clazz.newInstance();
+            
+            if( o instanceof XPathFactory )
+                return (XPathFactory)o;
+            
+            if (debug) debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName());
+        } catch( Throwable t ) {
+            if (debug) {
+                debugPrintln("failed to instanciate "+className);
+                t.printStackTrace();
+            }
+        }
+        return null;
+    }
+    
+    /** Iterator that lazily computes one value and returns it. */
+    private static abstract class SingleIterator implements Iterator {
+        private boolean seen = false;
+        
+        public final void remove() { throw new UnsupportedOperationException(); }
+        public final boolean hasNext() { return !seen; }
+        public final Object next() {
+            if(seen)    throw new NoSuchElementException();
+            seen = true;
+            return value();
+        }
+        
+        protected abstract Object value();
+    }
+    
+    /** Searches for a XPathFactory for a given uri in a META-INF/services file. */
+    private XPathFactory loadFromServicesFile(String uri, String resourceName, InputStream in) {
+
+        if (debug) debugPrintln("Reading " + resourceName );
+        
+        BufferedReader rd;
+        try {
+            rd = new BufferedReader(new InputStreamReader(in, "UTF-8"), DEFAULT_LINE_LENGTH);
+        } catch (java.io.UnsupportedEncodingException e) {
+            rd = new BufferedReader(new InputStreamReader(in), DEFAULT_LINE_LENGTH);
+        }
+        
+        String factoryClassName = null;
+        XPathFactory resultFactory = null;
+        // See spec for provider-configuration files: http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Provider%20Configuration%20File
+        while (true) {
+            try {
+                factoryClassName = rd.readLine();   
+            } catch (IOException x) {
+                // No provider found
+                break;
+            }
+            if (factoryClassName != null) {
+                // Ignore comments in the provider-configuration file
+                int hashIndex = factoryClassName.indexOf('#');
+                if (hashIndex != -1) {
+                    factoryClassName = factoryClassName.substring(0, hashIndex);
+                }
+                
+                // Ignore leading and trailing whitespace
+                factoryClassName = factoryClassName.trim();
+                
+                // If there's no text left or if this was a blank line, go to the next one.
+                if (factoryClassName.length() == 0) {
+                    continue;
+                }
+                
+                try {
+                    // Found the right XPathFactory if its isObjectModelSupported(String uri) method returns true.
+                    XPathFactory foundFactory = (XPathFactory) createInstance(factoryClassName);
+                    if (foundFactory.isObjectModelSupported(uri)) {
+                        resultFactory = foundFactory;
+                        break;
+                    }
+                }
+                catch (Exception e) {}
+            }
+            else {
+                break;
+            }
+        }
+        
+        try {
+            // try to close the reader.
+            rd.close();
+        }
+        // Ignore the exception.
+        catch (IOException exc) {}
+        
+        return resultFactory;
+    }
+        
+    /**
+     * Returns an {@link Iterator} that enumerates all 
+     * the META-INF/services files that we care.
+     */
+    private Iterator createServiceFileIterator() {
+        if (classLoader == null) {
+            return new SingleIterator() {
+                protected Object value() {
+                    ClassLoader classLoader = XPathFactoryFinder.class.getClassLoader();
+                    return SecuritySupport.getResourceAsURL(classLoader, SERVICE_ID);
+                    //return (ClassLoader.getSystemResource( SERVICE_ID ));
+                }
+            };
+        } else {
+            try {
+                //final Enumeration e = classLoader.getResources(SERVICE_ID);
+                final Enumeration e = SecuritySupport.getResources(classLoader, SERVICE_ID);
+                if (debug && !e.hasMoreElements()) {
+                    debugPrintln("no "+SERVICE_ID+" file was found");
+                }
+                
+                // wrap it into an Iterator.
+                return new Iterator() {
+                    public void remove() {
+                        throw new UnsupportedOperationException();
+                    }
+
+                    public boolean hasNext() {
+                        return e.hasMoreElements();
+                    }
+
+                    public Object next() {
+                        return e.nextElement();
+                    }
+                };
+            } catch (IOException e) {
+                if (debug) {
+                    debugPrintln("failed to enumerate resources "+SERVICE_ID);
+                    e.printStackTrace();
+                }
+                return new ArrayList().iterator();  // empty iterator
+            }
+        }
+    }
+    
+    private static final Class SERVICE_CLASS = XPathFactory.class;
+    private static final String SERVICE_ID = "META-INF/services/" + SERVICE_CLASS.getName();
+    
+    
+    
+    private static String which( Class clazz ) {
+        return which( clazz.getName(), clazz.getClassLoader() );
+    }
+
+    /**
+     * <p>Search the specified classloader for the given classname.</p>
+     *
+     * @param classname the fully qualified name of the class to search for
+     * @param loader the classloader to search
+     * 
+     * @return the source location of the resource, or null if it wasn't found
+     */
+    private static String which(String classname, ClassLoader loader) {
+
+        String classnameAsResource = classname.replace('.', '/') + ".class";
+        
+        if( loader==null )  loader = ClassLoader.getSystemClassLoader();
+        
+        //URL it = loader.getResource(classnameAsResource);
+        URL it = SecuritySupport.getResourceAsURL(loader, classnameAsResource);
+        if (it != null) {
+            return it.toString();
+        } else {
+            return null;
+        }
+    }
+}
diff --git a/jaxp-api-1.4/src/main/java/org/w3c/dom/html/HTMLDOMImplementation.java b/jaxp-api-1.4/src/main/java/org/w3c/dom/html/HTMLDOMImplementation.java
new file mode 100644
index 0000000..9828407
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/org/w3c/dom/html/HTMLDOMImplementation.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
+ * details.
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.DOMImplementation;
+
+/**
+ *  The <code>HTMLDOMImplementation</code> interface extends the 
+ * <code>DOMImplementation</code> interface with a method for creating an 
+ * HTML document instance.
+ * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
+ * @since DOM Level 2
+ */
+public interface HTMLDOMImplementation extends DOMImplementation {
+    /**
+     *  Creates an <code>HTMLDocument</code> object with the minimal tree made 
+     * of the following elements: <code>HTML</code> , <code>HEAD</code> , 
+     * <code>TITLE</code> , and <code>BODY</code> .
+     * @param title  The title of the document to be set as the content of the 
+     *   <code>TITLE</code> element, through a child <code>Text</code> node.
+     * @return  A new <code>HTMLDocument</code> object.
+     */
+    public HTMLDocument createHTMLDocument(String title);
+
+}
+
diff --git a/jaxp-api-1.4/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java b/jaxp-api-1.4/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
new file mode 100644
index 0000000..58344f1
--- /dev/null
+++ b/jaxp-api-1.4/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java
@@ -0,0 +1,264 @@
+// XMLReaderFactory.java - factory for creating a new reader.
+// http://www.saxproject.org
+// Written by David Megginson
+// and by David Brownell
+// NO WARRANTY!  This class is in the Public Domain.
+// $Id: XMLReaderFactory.java 670295 2008-06-22 01:46:43Z mrglavas $
+
+package org.xml.sax.helpers;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import org.xml.sax.XMLReader;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Factory for creating an XML reader.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class contains static methods for creating an XML reader
+ * from an explicit class name, or based on runtime defaults:</p>
+ *
+ * <pre>
+ * try {
+ *   XMLReader myReader = XMLReaderFactory.createXMLReader();
+ * } catch (SAXException e) {
+ *   System.err.println(e.getMessage());
+ * }
+ * </pre>
+ *
+ * <p><strong>Note to Distributions bundled with parsers:</strong>
+ * You should modify the implementation of the no-arguments
+ * <em>createXMLReader</em> to handle cases where the external
+ * configuration mechanisms aren't set up.  That method should do its
+ * best to return a parser when one is in the class path, even when
+ * nothing bound its class name to <code>org.xml.sax.driver</code> so
+ * those configuration mechanisms would see it.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson, David Brownell
+ * @version 2.0.1 (sax2r2)
+ */
+final public class XMLReaderFactory
+{
+    /**
+     * Private constructor.
+     *
+     * <p>This constructor prevents the class from being instantiated.</p>
+     */
+    private XMLReaderFactory ()
+    {
+    }
+    
+    private static final String property = "org.xml.sax.driver";
+    
+    /**
+     * Default columns per line.
+     */
+    private static final int DEFAULT_LINE_LENGTH = 80;
+    
+    /**
+     * Attempt to create an XMLReader from system defaults.
+     * In environments which can support it, the name of the XMLReader
+     * class is determined by trying each these options in order, and
+     * using the first one which succeeds:</p> <ul>
+     *
+     * <li>If the system property <code>org.xml.sax.driver</code>
+     * has a value, that is used as an XMLReader class name. </li>
+     *
+     * <li>The JAR "Services API" is used to look for a class name
+     * in the <em>META-INF/services/org.xml.sax.driver</em> file in
+     * jarfiles available to the runtime.</li>
+     *
+     * <li> SAX parser distributions are strongly encouraged to provide
+     * a default XMLReader class name that will take effect only when
+     * previous options (on this list) are not successful.</li>
+     *
+     * <li>Finally, if {@link ParserFactory#makeParser()} can
+     * return a system default SAX1 parser, that parser is wrapped in
+     * a {@link ParserAdapter}.  (This is a migration aid for SAX1
+     * environments, where the <code>org.xml.sax.parser</code> system
+     * property will often be usable.) </li>
+     *
+     * </ul>
+     *
+     * <p> In environments such as small embedded systems, which can not
+     * support that flexibility, other mechanisms to determine the default
+     * may be used. </p>
+     *
+     * <p>Note that many Java environments allow system properties to be
+     * initialized on a command line.  This means that <em>in most cases</em>
+     * setting a good value for that property ensures that calls to this
+     * method will succeed, except when security policies intervene.
+     * This will also maximize application portability to older SAX
+     * environments, with less robust implementations of this method.
+     * </p>
+     *
+     * @return A new XMLReader.
+     * @exception org.xml.sax.SAXException If no default XMLReader class
+     *            can be identified and instantiated.
+     * @see #createXMLReader(java.lang.String)
+     */
+    public static XMLReader createXMLReader ()
+    throws SAXException
+    {
+        String		className = null;
+        ClassLoader	loader = NewInstance.getClassLoader ();
+        
+        // 1. try the JVM-instance-wide system property
+        try { className = SecuritySupport.getSystemProperty (property); }
+        catch (Exception e) { /* normally fails for applets */ }
+        
+        // 2. if that fails, try META-INF/services/
+        if (className == null || className.length() == 0) {
+            String      service = "META-INF/services/" + property;
+            
+	        try {
+	            // If we are deployed into an OSGi environment, leverage it
+	            Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(service);
+	            if (spiClass != null) {
+	                return (XMLReader) spiClass.newInstance();
+	            }
+	        } catch (Throwable e) {
+	        }
+
+            InputStream is = null;
+            className = null;
+            
+            // First try the Context ClassLoader
+            ClassLoader cl = SecuritySupport.getContextClassLoader();
+            if (cl != null) {
+                is = SecuritySupport.getResourceAsStream(cl, service);
+                
+                // If no provider found then try the current ClassLoader
+                if (is == null) {
+                    cl = XMLReaderFactory.class.getClassLoader();
+                    is = SecuritySupport.getResourceAsStream(cl, service);
+                }
+            } else {
+                // No Context ClassLoader or JDK 1.1 so try the current
+                // ClassLoader
+                cl = XMLReaderFactory.class.getClassLoader();
+                is = SecuritySupport.getResourceAsStream(cl, service);
+            }
+            
+            if (is != null) {
+                
+                // Read the service provider name in UTF-8 as specified in
+                // the jar spec.  Unfortunately this fails in Microsoft
+                // VJ++, which does not implement the UTF-8
+                // encoding. Theoretically, we should simply let it fail in
+                // that case, since the JVM is obviously broken if it
+                // doesn't support such a basic standard.  But since there
+                // are still some users attempting to use VJ++ for
+                // development, we have dropped in a fallback which makes a
+                // second attempt using the platform's default encoding. In
+                // VJ++ this is apparently ASCII, which is a subset of
+                // UTF-8... and since the strings we'll be reading here are
+                // also primarily limited to the 7-bit ASCII range (at
+                // least, in English versions), this should work well
+                // enough to keep us on the air until we're ready to
+                // officially decommit from VJ++. [Edited comment from
+                // jkesselm]
+                BufferedReader rd;
+                try {
+                    rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
+                } catch (java.io.UnsupportedEncodingException e) {
+                    rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
+                }
+                
+                try {
+                    // XXX Does not handle all possible input as specified by the
+                    // Jar Service Provider specification
+                    className = rd.readLine();
+                } 
+                catch (Exception x) {
+                    // No provider found
+                } 
+                finally {
+                    try { 
+                        // try to close the reader. 
+                        rd.close(); 
+                    } 
+                    // Ignore the exception. 
+                    catch (IOException exc) {}
+                }
+            }
+        }
+        
+        // 3. Distro-specific fallback
+        if (className == null) {
+            // BEGIN DISTRIBUTION-SPECIFIC
+            
+            // EXAMPLE:
+            // className = "com.example.sax.XmlReader";
+            // or a $JAVA_HOME/jre/lib/*properties setting...
+            className = "org.apache.xerces.parsers.SAXParser";
+            
+            // END DISTRIBUTION-SPECIFIC
+        }
+        
+        // do we know the XMLReader implementation class yet?
+        if (className != null)
+            return loadClass (loader, className);
+        
+        // 4. panic -- adapt any SAX1 parser
+        try {
+            return new ParserAdapter (ParserFactory.makeParser ());
+        } catch (Exception e) {
+            throw new SAXException ("Can't create default XMLReader; "
+                    + "is system property org.xml.sax.driver set?");
+        }
+    }
+    
+    
+    /**
+     * Attempt to create an XML reader from a class name.
+     *
+     * <p>Given a class name, this method attempts to load
+     * and instantiate the class as an XML reader.</p>
+     *
+     * <p>Note that this method will not be usable in environments where
+     * the caller (perhaps an applet) is not permitted to load classes
+     * dynamically.</p>
+     *
+     * @return A new XML reader.
+     * @exception org.xml.sax.SAXException If the class cannot be
+     *            loaded, instantiated, and cast to XMLReader.
+     * @see #createXMLReader()
+     */
+    public static XMLReader createXMLReader (String className)
+    throws SAXException
+    {
+        return loadClass (NewInstance.getClassLoader (), className);
+    }
+    
+    private static XMLReader loadClass (ClassLoader loader, String className)
+    throws SAXException
+    {
+        try {
+            return (XMLReader) NewInstance.newInstance (loader, className);
+        } catch (ClassNotFoundException e1) {
+            throw new SAXException("SAX2 driver class " + className +
+                    " not found", e1);
+        } catch (IllegalAccessException e2) {
+            throw new SAXException("SAX2 driver class " + className +
+                    " found but cannot be loaded", e2);
+        } catch (InstantiationException e3) {
+            throw new SAXException("SAX2 driver class " + className +
+                    " loaded but cannot be instantiated (no empty public constructor?)",
+                    e3);
+        } catch (ClassCastException e4) {
+            throw new SAXException("SAX2 driver class " + className +
+                    " does not implement XMLReader", e4);
+        }
+    }
+}
diff --git a/pom.xml b/pom.xml
index 690e04a..dac74d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,7 @@
         <module>jaxb-api-2.0</module>
         <module>jaxb-api-2.1</module>
         <module>jaxp-api-1.3</module>
+        <module>jaxp-api-1.4</module>
         <module>jaxws-api-2.0</module>
         <module>jaxws-api-2.1</module>
         <module>jbi-api-1.0</module>