[jboss-svn-commits] JBoss Common SVN: r2864 - in jbossxb/tags: 2.0.0.CR10 and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jun 11 05:48:58 EDT 2008
Author: alex.loubyansky at jboss.com
Date: 2008-06-11 05:48:58 -0400 (Wed, 11 Jun 2008)
New Revision: 2864
Added:
jbossxb/tags/2.0.0.CR10/
jbossxb/tags/2.0.0.CR10/pom.xml
jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/Unmarshaller.java
jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java
jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java
jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.java
Removed:
jbossxb/tags/2.0.0.CR10/pom.xml
jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/Unmarshaller.java
jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java
jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java
jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.java
Log:
[maven-release-plugin] copy for tag 2.0.0.CR10
Copied: jbossxb/tags/2.0.0.CR10 (from rev 2861, jbossxb/trunk)
Deleted: jbossxb/tags/2.0.0.CR10/pom.xml
===================================================================
--- jbossxb/trunk/pom.xml 2008-06-10 21:47:59 UTC (rev 2861)
+++ jbossxb/tags/2.0.0.CR10/pom.xml 2008-06-11 09:48:58 UTC (rev 2864)
@@ -1,143 +0,0 @@
-<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">
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>3</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jbossxb</artifactId>
- <packaging>jar</packaging>
- <version>2.0.0-SNAPSHOT</version>
- <name>JBoss XML Binding</name>
- <url>http://www.jboss.org</url>
- <description>JBoss XML Binding</description>
- <scm>
- <connection>scm:svn:https://svn.jboss.org/repos/common/jbossxb/trunk</connection>
- </scm>
- <build>
- <finalName>jboss-xml-binding</finalName>
- <plugins>
- <plugin>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!-- The tagBase property is needed during the release process so that the maven release plugin
- will create the release tag in the appropriate location. -->
- <tagBase>https://svn.jboss.org/repos/common/jbossxb/tags</tagBase>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <testFailureIgnore>true</testFailureIgnore>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <includes>
- <include>**/*TestCase.java</include>
- </includes>
- <forkMode>pertest</forkMode> <!-- required to correctly run the PojoServer tests -->
- </configuration>
- </plugin>
- </plugins>
- </build>
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>2.0.5.GA</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <version>2.2.5.GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- <version>2.0.0.Beta12</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>apache-xerces</groupId>
- <artifactId>xml-apis</artifactId>
- <version>2.9.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>apache-xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.9.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>wutka-dtdparser</groupId>
- <artifactId>dtdparser121</artifactId>
- <version>1.2.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.activation</groupId>
- <artifactId>activation</artifactId>
- <version>1.0.2</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>1.1.0.GA</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-</project>
\ No newline at end of file
Copied: jbossxb/tags/2.0.0.CR10/pom.xml (from rev 2863, jbossxb/trunk/pom.xml)
===================================================================
--- jbossxb/tags/2.0.0.CR10/pom.xml (rev 0)
+++ jbossxb/tags/2.0.0.CR10/pom.xml 2008-06-11 09:48:58 UTC (rev 2864)
@@ -0,0 +1,143 @@
+<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">
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>3</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbossxb</artifactId>
+ <packaging>jar</packaging>
+ <version>2.0.0.CR10</version>
+ <name>JBoss XML Binding</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss XML Binding</description>
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/common/jbossxb/tags/2.0.0.CR10</connection>
+ </scm>
+ <build>
+ <finalName>jboss-xml-binding</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- The tagBase property is needed during the release process so that the maven release plugin
+ will create the release tag in the appropriate location. -->
+ <tagBase>https://svn.jboss.org/repos/common/jbossxb/tags</tagBase>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <testFailureIgnore>true</testFailureIgnore>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <forkMode>pertest</forkMode> <!-- required to correctly run the PojoServer tests -->
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>2.0.5.GA</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>2.2.5.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ <version>2.0.0.Beta12</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>apache-xerces</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>2.9.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>apache-xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.9.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>wutka-dtdparser</groupId>
+ <artifactId>dtdparser121</artifactId>
+ <version>1.2.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.0.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>1.1.0.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/Unmarshaller.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/Unmarshaller.java 2008-06-10 21:47:59 UTC (rev 2861)
+++ jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/Unmarshaller.java 2008-06-11 09:48:58 UTC (rev 2864)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.xb.binding;
-
-import java.io.InputStream;
-import java.io.Reader;
-
-import org.jboss.xb.binding.metadata.unmarshalling.DocumentBinding;
-import org.jboss.xb.binding.parser.JBossXBParser;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-
-/**
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision$</tt>
- */
-public interface Unmarshaller
-{
- String VALIDATION = "http://xml.org/sax/features/validation";
- String NAMESPACES = "http://xml.org/sax/features/namespaces";
- String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
- // set some xerces specific features that allow transparent DTD and Schema validation
- String DYNAMIC_VALIDATION = "http://apache.org/xml/features/validation/dynamic";
- String SCHEMA_VALIDATION = "http://apache.org/xml/features/validation/schema";
- String SCHEMA_FULL_CHECKING = "http://apache.org/xml/features/validation/schema-full-checking";
-
- void setValidation(boolean validation) throws JBossXBException;
-
- void setNamespaceAware(boolean namespaces) throws JBossXBException;
-
- void setSchemaValidation(boolean validation) throws JBossXBException;
-
- void setFeature(String feature, boolean value) throws JBossXBException;
-
- void setEntityResolver(EntityResolver entityResolver) throws JBossXBException;
-
- void setErrorHandler(ErrorHandler errorHandler);
-
- void mapFactoryToNamespace(ObjectModelFactory factory, String namespaceUri);
-
- Object unmarshal(String xmlFile, JBossXBParser.ContentHandler handler) throws JBossXBException;
-
- Object unmarshal(String xmlFile) throws JBossXBException;
-
- Object unmarshal(String xml, SchemaBinding schemaBinding) throws JBossXBException;
-
- Object unmarshal(Reader xmlReader, SchemaBinding schemaBinding) throws JBossXBException;
-
- Object unmarshal(Reader xmlReader, String systemId, SchemaBinding schemaBinding) throws JBossXBException;
-
- Object unmarshal(InputStream xmlStream, SchemaBinding schemaBinding) throws JBossXBException;
-
- Object unmarshal(InputStream xmlStream, String systemId, SchemaBinding schemaBinding) throws JBossXBException;
-
- Object unmarshal(String xml, SchemaBindingResolver schemaResolver) throws JBossXBException;
-
- Object unmarshal(Reader xmlReader, SchemaBindingResolver schemaResolver) throws JBossXBException;
-
- Object unmarshal(Reader xmlReader, String systemId, SchemaBindingResolver schemaResolver) throws JBossXBException;
-
- Object unmarshal(InputStream xmlStream, SchemaBindingResolver schemaResolver) throws JBossXBException;
-
- Object unmarshal(InputStream xmlStream, String systemId, SchemaBindingResolver schemaResolver) throws JBossXBException;
-
- Object unmarshal(Reader reader, ObjectModelFactory factory, Object root) throws JBossXBException;
-
- Object unmarshal(Reader reader, String systemId, ObjectModelFactory factory, Object root) throws JBossXBException;
-
- Object unmarshal(InputStream is, ObjectModelFactory factory, Object root) throws JBossXBException;
-
- Object unmarshal(InputStream is, String systemId, ObjectModelFactory factory, Object root) throws JBossXBException;
-
- Object unmarshal(String systemId, ObjectModelFactory factory, Object root) throws JBossXBException;
-
- Object unmarshal(String systemId, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException;
-
- Object unmarshal(Reader reader, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException;
-}
Copied: jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/Unmarshaller.java (from rev 2862, jbossxb/trunk/src/main/java/org/jboss/xb/binding/Unmarshaller.java)
===================================================================
--- jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/Unmarshaller.java (rev 0)
+++ jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/Unmarshaller.java 2008-06-11 09:48:58 UTC (rev 2864)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.xb.binding;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.jboss.xb.binding.metadata.unmarshalling.DocumentBinding;
+import org.jboss.xb.binding.parser.JBossXBParser;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision$</tt>
+ */
+public interface Unmarshaller
+{
+ String VALIDATION = "http://xml.org/sax/features/validation";
+ String NAMESPACES = "http://xml.org/sax/features/namespaces";
+ String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
+ // set some xerces specific features that allow transparent DTD and Schema validation
+ String DYNAMIC_VALIDATION = "http://apache.org/xml/features/validation/dynamic";
+ String SCHEMA_VALIDATION = "http://apache.org/xml/features/validation/schema";
+ String SCHEMA_FULL_CHECKING = "http://apache.org/xml/features/validation/schema-full-checking";
+
+ void setValidation(boolean validation) throws JBossXBException;
+
+ void setNamespaceAware(boolean namespaces) throws JBossXBException;
+
+ void setSchemaValidation(boolean validation) throws JBossXBException;
+
+ void setFeature(String feature, boolean value) throws JBossXBException;
+
+ void setEntityResolver(EntityResolver entityResolver) throws JBossXBException;
+
+ void setErrorHandler(ErrorHandler errorHandler);
+
+ void mapFactoryToNamespace(ObjectModelFactory factory, String namespaceUri);
+
+ Object unmarshal(String xmlFile, JBossXBParser.ContentHandler handler) throws JBossXBException;
+
+ Object unmarshal(String xmlFile) throws JBossXBException;
+
+ Object unmarshal(String xml, SchemaBinding schemaBinding) throws JBossXBException;
+
+ Object unmarshal(Reader xmlReader, SchemaBinding schemaBinding) throws JBossXBException;
+
+ Object unmarshal(InputStream xmlStream, SchemaBinding schemaBinding) throws JBossXBException;
+
+ Object unmarshal(InputSource source, SchemaBinding schemaBinding) throws JBossXBException;
+
+ Object unmarshal(String xml, SchemaBindingResolver schemaResolver) throws JBossXBException;
+
+ Object unmarshal(Reader xmlReader, SchemaBindingResolver schemaResolver) throws JBossXBException;
+
+ Object unmarshal(InputStream xmlStream, SchemaBindingResolver schemaResolver) throws JBossXBException;
+
+ Object unmarshal(InputSource source, SchemaBindingResolver schemaResolver) throws JBossXBException;
+
+ Object unmarshal(Reader reader, ObjectModelFactory factory, Object root) throws JBossXBException;
+
+ Object unmarshal(InputStream is, ObjectModelFactory factory, Object root) throws JBossXBException;
+
+ Object unmarshal(InputSource source, ObjectModelFactory factory, Object root) throws JBossXBException;
+
+ Object unmarshal(String systemId, ObjectModelFactory factory, Object root) throws JBossXBException;
+
+ Object unmarshal(String systemId, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException;
+
+ Object unmarshal(Reader reader, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException;
+}
Deleted: jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java 2008-06-10 21:47:59 UTC (rev 2861)
+++ jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java 2008-06-11 09:48:58 UTC (rev 2864)
@@ -1,263 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.xb.binding;
-
-import java.io.InputStream;
-import java.io.Reader;
-
-import org.jboss.xb.binding.metadata.unmarshalling.DocumentBinding;
-import org.jboss.xb.binding.parser.JBossXBParser;
-import org.jboss.xb.binding.parser.sax.SaxJBossXBParser;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-
-/**
- * Unmarshaller implementation.
- * WARNING: this implementation is not thread-safe.
- *
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision$</tt>
- */
-public class UnmarshallerImpl implements Unmarshaller
-{
- private ObjectModelBuilder builder = new ObjectModelBuilder();
- private final JBossXBParser parser;
-
- // Constructor
-
- /**
- * The constructor for DTD and XSD client awareness.
- */
- public UnmarshallerImpl() throws JBossXBException
- {
- parser = new SaxJBossXBParser();
- }
-
- public void setValidation(boolean validation) throws JBossXBException
- {
- parser.setFeature(VALIDATION, validation);
- /* Only set DYNAMIC_VALIDATION to false. Setting this to true
- if its not already requires a document to have a DOCTYPE declaring
- the root element
- */
- if( validation == false )
- parser.setFeature(DYNAMIC_VALIDATION, false);
- }
-
- public void setSchemaValidation(boolean validation) throws JBossXBException
- {
- parser.setFeature(SCHEMA_VALIDATION, validation);
- }
-
- public void setFeature(String feature, boolean value) throws JBossXBException
- {
- parser.setFeature(feature, value);
- }
-
- public void setNamespaceAware(boolean namespaces) throws JBossXBException
- {
- parser.setFeature(NAMESPACES, namespaces);
- }
-
- public void setEntityResolver(EntityResolver entityResolver) throws JBossXBException
- {
- parser.setEntityResolver(entityResolver);
- }
-
- public void setErrorHandler(ErrorHandler errorHandler)
- {
- // todo reader.setErrorHandler(errorHandler);
- }
-
- public void mapFactoryToNamespace(ObjectModelFactory factory, String namespaceUri)
- {
- if(builder == null)
- {
- builder = new ObjectModelBuilder();
- }
- builder.mapFactoryToNamespace(factory, namespaceUri);
- }
-
- public Object unmarshal(String xmlFile) throws JBossXBException
- {
- // todo
- throw new UnsupportedOperationException();
- }
-
- public Object unmarshal(String xmlFile, JBossXBParser.ContentHandler handler) throws JBossXBException
- {
- parser.parse(xmlFile, handler);
- return handler.getRoot();
- }
-
- public Object unmarshal(String xml, SchemaBinding schemaBinding) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding);
- parser.parse(xml, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(Reader xmlReader, SchemaBinding schemaBinding) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding);
- parser.parse(xmlReader, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(Reader xmlReader, String systemId, SchemaBinding schemaBinding) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding);
- parser.parse(xmlReader, systemId, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(InputStream xmlStream, SchemaBinding schemaBinding) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding);
- parser.parse(xmlStream, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(InputStream xmlStream, String systemId, SchemaBinding schemaBinding) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding);
- parser.parse(xmlStream, systemId, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(String xml, SchemaBindingResolver schemaResolver) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver);
- parser.parse(xml, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(Reader xmlReader, SchemaBindingResolver schemaResolver) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver);
- parser.parse(xmlReader, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(Reader xmlReader, String systemId, SchemaBindingResolver schemaResolver) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver);
- parser.parse(xmlReader, systemId, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(InputStream xmlStream, SchemaBindingResolver schemaResolver) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver);
- parser.parse(xmlStream, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(InputStream xmlStream, String systemId, SchemaBindingResolver schemaResolver) throws JBossXBException
- {
- JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver);
- parser.parse(xmlStream, systemId, cHandler);
- return cHandler.getRoot();
- }
-
- public Object unmarshal(Reader reader, ObjectModelFactory factory, Object root) throws JBossXBException
- {
- if(builder == null)
- {
- builder = new ObjectModelBuilder();
- }
- builder.init(factory, root);
- parser.parse(reader, builder);
- return builder.getRoot();
- }
-
- public Object unmarshal(Reader reader, String systemId, ObjectModelFactory factory, Object root) throws JBossXBException
- {
- if(builder == null)
- {
- builder = new ObjectModelBuilder();
- }
- builder.init(factory, root);
- parser.parse(reader, systemId, builder);
- return builder.getRoot();
- }
-
- public Object unmarshal(InputStream is, ObjectModelFactory factory, Object root) throws JBossXBException
- {
- if(builder == null)
- {
- builder = new ObjectModelBuilder();
- }
- builder.init(factory, root);
- parser.parse(is, builder);
- return builder.getRoot();
- }
-
- public Object unmarshal(InputStream is, String systemId, ObjectModelFactory factory, Object root) throws JBossXBException
- {
- if(builder == null)
- {
- builder = new ObjectModelBuilder();
- }
- builder.init(factory, root);
- parser.parse(is, systemId, builder);
- return builder.getRoot();
- }
-
- public Object unmarshal(String systemId, ObjectModelFactory factory, Object root) throws JBossXBException
- {
- if(builder == null)
- {
- builder = new ObjectModelBuilder();
- }
- builder.init(factory, root);
- parser.parse(systemId, builder);
- return builder.getRoot();
- }
-
- public Object unmarshal(String systemId, ObjectModelFactory factory, DocumentBinding binding)
- throws JBossXBException
- {
- if(binding != null)
- {
- throw new IllegalStateException("DocumentBinding API is not supported anymore!");
- }
- return unmarshal(systemId, factory, (Object)null);
- }
-
- public Object unmarshal(Reader reader, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException
- {
- if(binding != null)
- {
- throw new IllegalStateException("DocumentBinding API is not supported anymore!");
- }
- return unmarshal(reader, factory, (Object)null);
- }
-
- JBossXBParser getParser()
- {
- return parser;
- }
-}
Copied: jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java (from rev 2862, jbossxb/trunk/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java)
===================================================================
--- jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java (rev 0)
+++ jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java 2008-06-11 09:48:58 UTC (rev 2864)
@@ -0,0 +1,239 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.xb.binding;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.jboss.xb.binding.metadata.unmarshalling.DocumentBinding;
+import org.jboss.xb.binding.parser.JBossXBParser;
+import org.jboss.xb.binding.parser.sax.SaxJBossXBParser;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * Unmarshaller implementation.
+ * WARNING: this implementation is not thread-safe.
+ *
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class UnmarshallerImpl implements Unmarshaller
+{
+ private ObjectModelBuilder builder = new ObjectModelBuilder();
+ private final JBossXBParser parser;
+
+ // Constructor
+
+ /**
+ * The constructor for DTD and XSD client awareness.
+ */
+ public UnmarshallerImpl() throws JBossXBException
+ {
+ parser = new SaxJBossXBParser();
+ }
+
+ public void setValidation(boolean validation) throws JBossXBException
+ {
+ parser.setFeature(VALIDATION, validation);
+ /* Only set DYNAMIC_VALIDATION to false. Setting this to true
+ if its not already requires a document to have a DOCTYPE declaring
+ the root element
+ */
+ if( validation == false )
+ parser.setFeature(DYNAMIC_VALIDATION, false);
+ }
+
+ public void setSchemaValidation(boolean validation) throws JBossXBException
+ {
+ parser.setFeature(SCHEMA_VALIDATION, validation);
+ }
+
+ public void setFeature(String feature, boolean value) throws JBossXBException
+ {
+ parser.setFeature(feature, value);
+ }
+
+ public void setNamespaceAware(boolean namespaces) throws JBossXBException
+ {
+ parser.setFeature(NAMESPACES, namespaces);
+ }
+
+ public void setEntityResolver(EntityResolver entityResolver) throws JBossXBException
+ {
+ parser.setEntityResolver(entityResolver);
+ }
+
+ public void setErrorHandler(ErrorHandler errorHandler)
+ {
+ // todo reader.setErrorHandler(errorHandler);
+ }
+
+ public void mapFactoryToNamespace(ObjectModelFactory factory, String namespaceUri)
+ {
+ if(builder == null)
+ {
+ builder = new ObjectModelBuilder();
+ }
+ builder.mapFactoryToNamespace(factory, namespaceUri);
+ }
+
+ public Object unmarshal(String xmlFile) throws JBossXBException
+ {
+ // todo
+ throw new UnsupportedOperationException();
+ }
+
+ public Object unmarshal(String xmlFile, JBossXBParser.ContentHandler handler) throws JBossXBException
+ {
+ parser.parse(xmlFile, handler);
+ return handler.getRoot();
+ }
+
+ public Object unmarshal(String xml, SchemaBinding schemaBinding) throws JBossXBException
+ {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding);
+ parser.parse(xml, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(Reader xmlReader, SchemaBinding schemaBinding) throws JBossXBException
+ {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding);
+ parser.parse(xmlReader, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(InputStream xmlStream, SchemaBinding schemaBinding) throws JBossXBException
+ {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding);
+ parser.parse(xmlStream, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(InputSource source, SchemaBinding schemaBinding) throws JBossXBException
+ {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding);
+ parser.parse(source, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(String xml, SchemaBindingResolver schemaResolver) throws JBossXBException
+ {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver);
+ parser.parse(xml, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(Reader xmlReader, SchemaBindingResolver schemaResolver) throws JBossXBException
+ {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver);
+ parser.parse(xmlReader, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(InputStream xmlStream, SchemaBindingResolver schemaResolver) throws JBossXBException
+ {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver);
+ parser.parse(xmlStream, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(InputSource source, SchemaBindingResolver schemaResolver) throws JBossXBException
+ {
+ JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver);
+ parser.parse(source, cHandler);
+ return cHandler.getRoot();
+ }
+
+ public Object unmarshal(Reader reader, ObjectModelFactory factory, Object root) throws JBossXBException
+ {
+ if(builder == null)
+ {
+ builder = new ObjectModelBuilder();
+ }
+ builder.init(factory, root);
+ parser.parse(reader, builder);
+ return builder.getRoot();
+ }
+
+ public Object unmarshal(InputStream is, ObjectModelFactory factory, Object root) throws JBossXBException
+ {
+ if(builder == null)
+ {
+ builder = new ObjectModelBuilder();
+ }
+ builder.init(factory, root);
+ parser.parse(is, builder);
+ return builder.getRoot();
+ }
+
+ public Object unmarshal(String systemId, ObjectModelFactory factory, Object root) throws JBossXBException
+ {
+ if(builder == null)
+ {
+ builder = new ObjectModelBuilder();
+ }
+ builder.init(factory, root);
+ parser.parse(systemId, builder);
+ return builder.getRoot();
+ }
+
+ public Object unmarshal(InputSource is, ObjectModelFactory factory, Object root) throws JBossXBException
+ {
+ if(builder == null)
+ {
+ builder = new ObjectModelBuilder();
+ }
+ builder.init(factory, root);
+ parser.parse(is, builder);
+ return builder.getRoot();
+ }
+
+ public Object unmarshal(String systemId, ObjectModelFactory factory, DocumentBinding binding)
+ throws JBossXBException
+ {
+ if(binding != null)
+ {
+ throw new IllegalStateException("DocumentBinding API is not supported anymore!");
+ }
+ return unmarshal(systemId, factory, (Object)null);
+ }
+
+ public Object unmarshal(Reader reader, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException
+ {
+ if(binding != null)
+ {
+ throw new IllegalStateException("DocumentBinding API is not supported anymore!");
+ }
+ return unmarshal(reader, factory, (Object)null);
+ }
+
+ JBossXBParser getParser()
+ {
+ return parser;
+ }
+}
Deleted: jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java 2008-06-10 21:47:59 UTC (rev 2861)
+++ jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java 2008-06-11 09:48:58 UTC (rev 2864)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.xb.binding.parser;
-
-import java.io.InputStream;
-import java.io.Reader;
-
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.xb.binding.JBossXBException;
-import org.xml.sax.Attributes;
-import org.xml.sax.EntityResolver;
-
-/**
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision$</tt>
- */
-public interface JBossXBParser
-{
- interface ContentHandler
- {
- void characters(char[] ch, int start, int length);
-
- void endElement(String namespaceURI, String localName, String qName);
-
- void startElement(String namespaceURI, String localName, String qName, Attributes atts, XSTypeDefinition type);
-
- void startPrefixMapping(String prefix, String uri);
-
- void endPrefixMapping(String prefix);
-
- void processingInstruction(String target, String data);
-
- Object getRoot();
- }
- /**
- * Extended to support key SAX2 LexicalHandler events
- */
- interface DtdAwareContentHandler extends ContentHandler
- {
- public void startDTD(String name, String publicId, String systemId);
- public void endDTD();
- }
-
- void setEntityResolver(EntityResolver entityResolver) throws JBossXBException;
-
- void setProperty(String name, Object value);
-
- void setFeature(String name, boolean value);
-
- void parse(String source, ContentHandler handler) throws JBossXBException;
-
- void parse(InputStream is, ContentHandler handler) throws JBossXBException;
-
- void parse(InputStream is, String systemId, ContentHandler handler) throws JBossXBException;
-
- void parse(Reader reader, ContentHandler handler) throws JBossXBException;
-
- void parse(Reader reader, String systemId, ContentHandler handler) throws JBossXBException;
-}
Copied: jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java (from rev 2862, jbossxb/trunk/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java)
===================================================================
--- jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java (rev 0)
+++ jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java 2008-06-11 09:48:58 UTC (rev 2864)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.xb.binding.parser;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.xb.binding.JBossXBException;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision$</tt>
+ */
+public interface JBossXBParser
+{
+ interface ContentHandler
+ {
+ void characters(char[] ch, int start, int length);
+
+ void endElement(String namespaceURI, String localName, String qName);
+
+ void startElement(String namespaceURI, String localName, String qName, Attributes atts, XSTypeDefinition type);
+
+ void startPrefixMapping(String prefix, String uri);
+
+ void endPrefixMapping(String prefix);
+
+ void processingInstruction(String target, String data);
+
+ Object getRoot();
+ }
+ /**
+ * Extended to support key SAX2 LexicalHandler events
+ */
+ interface DtdAwareContentHandler extends ContentHandler
+ {
+ public void startDTD(String name, String publicId, String systemId);
+ public void endDTD();
+ }
+
+ void setEntityResolver(EntityResolver entityResolver) throws JBossXBException;
+
+ void setProperty(String name, Object value);
+
+ void setFeature(String name, boolean value);
+
+ void parse(String source, ContentHandler handler) throws JBossXBException;
+
+ void parse(InputStream is, ContentHandler handler) throws JBossXBException;
+
+ void parse(Reader reader, ContentHandler handler) throws JBossXBException;
+
+ void parse(InputSource source, ContentHandler handler) throws JBossXBException;
+}
Deleted: jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.java 2008-06-10 21:47:59 UTC (rev 2861)
+++ jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.java 2008-06-11 09:48:58 UTC (rev 2864)
@@ -1,484 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.xb.binding.parser.sax;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.lang.reflect.Method;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import org.jboss.logging.Logger;
-import org.jboss.util.JBossStringBuilder;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.JBossXBRuntimeException;
-import org.jboss.xb.binding.parser.JBossXBParser;
-import org.xml.sax.Attributes;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-
-/**
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision$</tt>
- */
-public class SaxJBossXBParser
- implements JBossXBParser
-{
- private static final Logger log = Logger.getLogger(SaxJBossXBParser.class);
-
- private static final SAXParserFactory saxFactory = SAXParserFactory.newInstance();
- static
- {
- saxFactory.setValidating(true);
- saxFactory.setNamespaceAware(true);
- enableXInclude();
- }
-
- private final SAXParser parser;
- private final XMLReader reader;
- private JBossXBParser.ContentHandler contentHandler;
- private DelegatingContentHandler delegateHandler;
- private boolean trace;
-
- /**
- * Enables XInclude if the saxFactory supports it.<p>
- *
- * NOTE: Checks the real factory class, not the JAXP interface.
- */
- private static void enableXInclude()
- {
- try
- {
- Class clazz = saxFactory.getClass();
- Method method = clazz.getMethod("setXIncludeAware", new Class[] { Boolean.TYPE });
- method.invoke(saxFactory, new Object[] { Boolean.TRUE });
- }
- catch (Exception e)
- {
- log.trace("Not setting XIncludeAware", e);
- }
- }
-
- public SaxJBossXBParser()
- throws JBossXBException
- {
- try
- {
- parser = saxFactory.newSAXParser();
- logParserInfo();
- }
- catch(Exception e)
- {
- throw new JBossXBException("Failed to create a new SAX parser", e);
- }
-
- try
- {
- reader = parser.getXMLReader();
- }
- catch(SAXException e1)
- {
- throw new JBossXBRuntimeException("Failed to get parser's XMLReader", e1);
- }
-
- delegateHandler = new DelegatingContentHandler();
- reader.setContentHandler(delegateHandler);
- reader.setErrorHandler(MetaDataErrorHandler.INSTANCE);
- reader.setEntityResolver(new JBossEntityResolver());
- // LexicalHandler
- try
- {
- reader.setProperty("http://xml.org/sax/properties/lexical-handler", delegateHandler);
- }
- catch(Exception e)
- {
- log.debug("LexicalHandler", e);
- }
-
-/*
- setFeature(Unmarshaller.VALIDATION, true);
- setFeature(Unmarshaller.SCHEMA_VALIDATION, true);
- setFeature(Unmarshaller.SCHEMA_FULL_CHECKING, true);
- setFeature(Unmarshaller.DYNAMIC_VALIDATION, true);
- setFeature(Unmarshaller.NAMESPACES, true);
-*/
- }
-
- // JBossXBParser implementation
-
- public void setEntityResolver(EntityResolver entityResolver)
- throws JBossXBException
- {
- reader.setEntityResolver(entityResolver);
- }
-
- public void setProperty(String name, Object value)
- {
- try
- {
- reader.setProperty(name, value);
- }
- catch(SAXException e)
- {
- throw new JBossXBRuntimeException("Failed to set property on the XML reader", e);
- }
- }
-
- public void setFeature(String name, boolean value)
- {
- try
- {
- reader.setFeature(name, value);
- log.debug(name+" set to: "+reader.getFeature(name));
- }
- catch(SAXException e)
- {
- throw new JBossXBRuntimeException("Failed to set feature on the XMLReader", e);
- }
- }
-
- public void parse(String systemId, ContentHandler handler) throws JBossXBException
- {
- this.contentHandler = handler;
- trace = log.isTraceEnabled();
-
- logParserInfo();
- try
- {
- reader.parse(systemId);
- }
- catch(Throwable e)
- {
- throw new JBossXBException("Failed to parse source: " + getLocationAsString(systemId), e);
- }
- }
-
- public void parse(InputStream is, ContentHandler handler) throws JBossXBException
- {
- parse(is, null, handler);
- }
-
- public void parse(InputStream is, String systemId, ContentHandler handler) throws JBossXBException
- {
- this.contentHandler = handler;
- trace = log.isTraceEnabled();
-
- logParserInfo();
- try
- {
- InputSource source = new InputSource(is);
- if (systemId != null)
- source.setSystemId(systemId);
- reader.parse(source);
- }
- catch(Throwable e)
- {
- throw new JBossXBException("Failed to parse source: " + e.getMessage(), e);
- }
- }
-
- public void parse(Reader reader, ContentHandler handler) throws JBossXBException
- {
- parse(reader, null, handler);
- }
-
- public void parse(Reader reader, String systemId, ContentHandler handler) throws JBossXBException
- {
- this.contentHandler = handler;
- trace = log.isTraceEnabled();
-
- logParserInfo();
- try
- {
- InputSource source = new InputSource(reader);
- if (systemId != null)
- source.setSystemId(systemId);
- this.reader.parse(source);
- }
- catch(Throwable e)
- {
- throw new JBossXBException("Failed to parse source: " + e.getMessage(), e);
- }
- }
-
- public String getLocationAsString(String fileName)
- {
- Locator locator = delegateHandler.getDocumentLocator();
- if (locator == null)
- return fileName;
- else
- {
- JBossStringBuilder buffer = new JBossStringBuilder();
- String id = locator.getSystemId();
- if (id == null)
- id = locator.getPublicId();
- buffer.append(id).append('@');
- buffer.append(locator.getLineNumber());
- buffer.append(',');
- buffer.append(locator.getColumnNumber());
- return buffer.toString();
- }
- }
-
- private void logParserInfo()
- {
- StringBuffer sb = new StringBuffer();
- sb.append("Created parser: ").append(parser)
- .append(", isNamespaceAware: ").append(parser.isNamespaceAware())
- .append(", isValidating: ").append(parser.isValidating())
- .append(", isXIncludeAware: ");
- try
- {
- sb.append(parser.isXIncludeAware());
- }
- catch(UnsupportedOperationException e)
- {
- sb.append("unsupported operation '").append(e.getMessage()).append('\'');
- }
- log.debug(sb.toString());
- }
-
- // Inner
-
- private final class DelegatingContentHandler
- implements org.xml.sax.ContentHandler,
- org.xml.sax.ext.LexicalHandler
- {
- Locator locator;
- // Begin LexicalHandler
-
- public void comment(char[] ch, int start, int length) throws SAXException
- {
- // TODO Auto-generated method stub
-
- }
-
- public void startDTD(String name, String publicId, String systemId) throws SAXException
- {
- if( contentHandler instanceof DtdAwareContentHandler )
- {
- DtdAwareContentHandler dach = (DtdAwareContentHandler) contentHandler;
- dach.startDTD(name, publicId, systemId);
- }
- }
- public void endDTD() throws SAXException
- {
- if( contentHandler instanceof DtdAwareContentHandler )
- {
- DtdAwareContentHandler dach = (DtdAwareContentHandler) contentHandler;
- dach.endDTD();
- }
- }
-
- public void startEntity(String name) throws SAXException
- {
- // TODO Auto-generated method stub
-
- }
- public void endEntity(String name) throws SAXException
- {
- // TODO Auto-generated method stub
-
- }
-
- public void startCDATA() throws SAXException
- {
- // TODO Auto-generated method stub
-
- }
- public void endCDATA() throws SAXException
- {
- // TODO Auto-generated method stub
-
- }
-
- // End LexicalHandler
-
- public void endDocument()
- {
- }
-
- public void startDocument()
- {
- }
-
- public void characters(char ch[], int start, int length)
- {
- // todo look at this later
- // do not notify content handler if these are just whitespaces
- //int i = start;
- //while(i < start + length)
- //{
- // if(!Character.isWhitespace(ch[i++]))
- // {
- contentHandler.characters(ch, start, length);
- // break;
- // }
- //}
- }
-
- public void ignorableWhitespace(char ch[], int start, int length)
- {
- }
-
- public void endPrefixMapping(String prefix)
- {
- contentHandler.endPrefixMapping(prefix);
- }
-
- public void skippedEntity(String name)
- {
- }
-
- public Locator getDocumentLocator()
- {
- return locator;
- }
-
- public void setDocumentLocator(Locator locator)
- {
- this.locator = locator;
- }
-
- public void processingInstruction(String target, String data)
- {
- contentHandler.processingInstruction(target, data);
- }
-
- public void startPrefixMapping(String prefix, String uri)
- {
- contentHandler.startPrefixMapping(prefix, uri);
- }
-
- public void endElement(String namespaceURI, String localName, String qName)
- {
- String name = null;
- if(trace)
- {
- if(localName.length() == 0)
- {
- name = qName;
- }
- else
- {
- name = namespaceURI + ':' + localName;
- }
- log.trace("Enter endElement " + name);
- }
- try
- {
- contentHandler.endElement(namespaceURI, localName, qName);
- }
- finally
- {
- if(trace)
- {
- log.trace("Exit endElement " + name);
- }
- }
- }
-
- public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
- {
- String name = null;
- if(trace)
- {
- if(localName.length() == 0)
- {
- name = qName;
- }
- else
- {
- name = namespaceURI + ':' + localName;
- }
- log.trace("Enter startElement " + name);
- }
- try
- {
- contentHandler.startElement(namespaceURI, localName, qName, atts, null);
- }
- finally
- {
- if(trace)
- {
- log.trace("Exit startElement " + name);
- }
- }
- }
- }
-
- private static final class MetaDataErrorHandler
- implements ErrorHandler
- {
- public static final ErrorHandler INSTANCE = new MetaDataErrorHandler();
-
- public void warning(SAXParseException exception)
- {
- log.warn(formatMessage(exception));
- }
-
- public void error(SAXParseException exception)
- throws SAXException
- {
- throw new SAXException(formatMessage(exception));
- }
-
- public void fatalError(SAXParseException exception)
- throws SAXException
- {
- throw new SAXException(formatMessage(exception));
- }
-
- public String formatMessage(SAXParseException exception)
- {
- StringBuffer buffer = new StringBuffer(50);
- buffer.append(exception.getMessage()).append(" @ ");
- String location = exception.getPublicId();
- if(location != null)
- {
- buffer.append(location);
- }
- else
- {
- location = exception.getSystemId();
- if(location != null)
- {
- buffer.append(location);
- }
- else
- {
- buffer.append("*unknown*");
- }
- }
- buffer.append('[');
- buffer.append(exception.getLineNumber()).append(',');
- buffer.append(exception.getColumnNumber()).append(']');
- return buffer.toString();
- }
- }
-}
Copied: jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.java (from rev 2862, jbossxb/trunk/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.java)
===================================================================
--- jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.java (rev 0)
+++ jbossxb/tags/2.0.0.CR10/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.java 2008-06-11 09:48:58 UTC (rev 2864)
@@ -0,0 +1,462 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.xb.binding.parser.sax;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.lang.reflect.Method;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.jboss.logging.Logger;
+import org.jboss.util.JBossStringBuilder;
+import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.JBossXBRuntimeException;
+import org.jboss.xb.binding.parser.JBossXBParser;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class SaxJBossXBParser
+ implements JBossXBParser
+{
+ private static final Logger log = Logger.getLogger(SaxJBossXBParser.class);
+
+ private static final SAXParserFactory saxFactory = SAXParserFactory.newInstance();
+ static
+ {
+ saxFactory.setValidating(true);
+ saxFactory.setNamespaceAware(true);
+ enableXInclude();
+ }
+
+ private final SAXParser parser;
+ private final XMLReader reader;
+ private JBossXBParser.ContentHandler contentHandler;
+ private DelegatingContentHandler delegateHandler;
+ private boolean trace;
+
+ /**
+ * Enables XInclude if the saxFactory supports it.<p>
+ *
+ * NOTE: Checks the real factory class, not the JAXP interface.
+ */
+ private static void enableXInclude()
+ {
+ try
+ {
+ Class clazz = saxFactory.getClass();
+ Method method = clazz.getMethod("setXIncludeAware", new Class[] { Boolean.TYPE });
+ method.invoke(saxFactory, new Object[] { Boolean.TRUE });
+ }
+ catch (Exception e)
+ {
+ log.trace("Not setting XIncludeAware", e);
+ }
+ }
+
+ public SaxJBossXBParser()
+ throws JBossXBException
+ {
+ try
+ {
+ parser = saxFactory.newSAXParser();
+ logParserInfo();
+ }
+ catch(Exception e)
+ {
+ throw new JBossXBException("Failed to create a new SAX parser", e);
+ }
+
+ try
+ {
+ reader = parser.getXMLReader();
+ }
+ catch(SAXException e1)
+ {
+ throw new JBossXBRuntimeException("Failed to get parser's XMLReader", e1);
+ }
+
+ delegateHandler = new DelegatingContentHandler();
+ reader.setContentHandler(delegateHandler);
+ reader.setErrorHandler(MetaDataErrorHandler.INSTANCE);
+ reader.setEntityResolver(new JBossEntityResolver());
+ // LexicalHandler
+ try
+ {
+ reader.setProperty("http://xml.org/sax/properties/lexical-handler", delegateHandler);
+ }
+ catch(Exception e)
+ {
+ log.debug("LexicalHandler", e);
+ }
+
+/*
+ setFeature(Unmarshaller.VALIDATION, true);
+ setFeature(Unmarshaller.SCHEMA_VALIDATION, true);
+ setFeature(Unmarshaller.SCHEMA_FULL_CHECKING, true);
+ setFeature(Unmarshaller.DYNAMIC_VALIDATION, true);
+ setFeature(Unmarshaller.NAMESPACES, true);
+*/
+ }
+
+ // JBossXBParser implementation
+
+ public void setEntityResolver(EntityResolver entityResolver)
+ throws JBossXBException
+ {
+ reader.setEntityResolver(entityResolver);
+ }
+
+ public void setProperty(String name, Object value)
+ {
+ try
+ {
+ reader.setProperty(name, value);
+ }
+ catch(SAXException e)
+ {
+ throw new JBossXBRuntimeException("Failed to set property on the XML reader", e);
+ }
+ }
+
+ public void setFeature(String name, boolean value)
+ {
+ try
+ {
+ reader.setFeature(name, value);
+ log.debug(name+" set to: "+reader.getFeature(name));
+ }
+ catch(SAXException e)
+ {
+ throw new JBossXBRuntimeException("Failed to set feature on the XMLReader", e);
+ }
+ }
+
+ public void parse(String systemId, ContentHandler handler) throws JBossXBException
+ {
+ this.contentHandler = handler;
+ trace = log.isTraceEnabled();
+
+ logParserInfo();
+ try
+ {
+ reader.parse(systemId);
+ }
+ catch(Throwable e)
+ {
+ throw new JBossXBException("Failed to parse source: " + getLocationAsString(systemId), e);
+ }
+ }
+
+ public void parse(InputStream is, ContentHandler handler) throws JBossXBException
+ {
+ parse(new InputSource(is), handler);
+ }
+
+ public void parse(Reader reader, ContentHandler handler) throws JBossXBException
+ {
+ parse(new InputSource(reader), handler);
+ }
+
+ public void parse(InputSource source, ContentHandler handler) throws JBossXBException
+ {
+ this.contentHandler = handler;
+ trace = log.isTraceEnabled();
+
+ logParserInfo();
+ try
+ {
+ reader.parse(source);
+ }
+ catch(Throwable e)
+ {
+ throw new JBossXBException("Failed to parse source: " + e.getMessage(), e);
+ }
+ }
+
+ public String getLocationAsString(String fileName)
+ {
+ Locator locator = delegateHandler.getDocumentLocator();
+ if (locator == null)
+ return fileName;
+ else
+ {
+ JBossStringBuilder buffer = new JBossStringBuilder();
+ String id = locator.getSystemId();
+ if (id == null)
+ id = locator.getPublicId();
+ buffer.append(id).append('@');
+ buffer.append(locator.getLineNumber());
+ buffer.append(',');
+ buffer.append(locator.getColumnNumber());
+ return buffer.toString();
+ }
+ }
+
+ private void logParserInfo()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Created parser: ").append(parser)
+ .append(", isNamespaceAware: ").append(parser.isNamespaceAware())
+ .append(", isValidating: ").append(parser.isValidating())
+ .append(", isXIncludeAware: ");
+ try
+ {
+ sb.append(parser.isXIncludeAware());
+ }
+ catch(UnsupportedOperationException e)
+ {
+ sb.append("unsupported operation '").append(e.getMessage()).append('\'');
+ }
+ log.debug(sb.toString());
+ }
+
+ // Inner
+
+ private final class DelegatingContentHandler
+ implements org.xml.sax.ContentHandler,
+ org.xml.sax.ext.LexicalHandler
+ {
+ Locator locator;
+ // Begin LexicalHandler
+
+ public void comment(char[] ch, int start, int length) throws SAXException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void startDTD(String name, String publicId, String systemId) throws SAXException
+ {
+ if( contentHandler instanceof DtdAwareContentHandler )
+ {
+ DtdAwareContentHandler dach = (DtdAwareContentHandler) contentHandler;
+ dach.startDTD(name, publicId, systemId);
+ }
+ }
+ public void endDTD() throws SAXException
+ {
+ if( contentHandler instanceof DtdAwareContentHandler )
+ {
+ DtdAwareContentHandler dach = (DtdAwareContentHandler) contentHandler;
+ dach.endDTD();
+ }
+ }
+
+ public void startEntity(String name) throws SAXException
+ {
+ // TODO Auto-generated method stub
+
+ }
+ public void endEntity(String name) throws SAXException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void startCDATA() throws SAXException
+ {
+ // TODO Auto-generated method stub
+
+ }
+ public void endCDATA() throws SAXException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ // End LexicalHandler
+
+ public void endDocument()
+ {
+ }
+
+ public void startDocument()
+ {
+ }
+
+ public void characters(char ch[], int start, int length)
+ {
+ // todo look at this later
+ // do not notify content handler if these are just whitespaces
+ //int i = start;
+ //while(i < start + length)
+ //{
+ // if(!Character.isWhitespace(ch[i++]))
+ // {
+ contentHandler.characters(ch, start, length);
+ // break;
+ // }
+ //}
+ }
+
+ public void ignorableWhitespace(char ch[], int start, int length)
+ {
+ }
+
+ public void endPrefixMapping(String prefix)
+ {
+ contentHandler.endPrefixMapping(prefix);
+ }
+
+ public void skippedEntity(String name)
+ {
+ }
+
+ public Locator getDocumentLocator()
+ {
+ return locator;
+ }
+
+ public void setDocumentLocator(Locator locator)
+ {
+ this.locator = locator;
+ }
+
+ public void processingInstruction(String target, String data)
+ {
+ contentHandler.processingInstruction(target, data);
+ }
+
+ public void startPrefixMapping(String prefix, String uri)
+ {
+ contentHandler.startPrefixMapping(prefix, uri);
+ }
+
+ public void endElement(String namespaceURI, String localName, String qName)
+ {
+ String name = null;
+ if(trace)
+ {
+ if(localName.length() == 0)
+ {
+ name = qName;
+ }
+ else
+ {
+ name = namespaceURI + ':' + localName;
+ }
+ log.trace("Enter endElement " + name);
+ }
+ try
+ {
+ contentHandler.endElement(namespaceURI, localName, qName);
+ }
+ finally
+ {
+ if(trace)
+ {
+ log.trace("Exit endElement " + name);
+ }
+ }
+ }
+
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
+ {
+ String name = null;
+ if(trace)
+ {
+ if(localName.length() == 0)
+ {
+ name = qName;
+ }
+ else
+ {
+ name = namespaceURI + ':' + localName;
+ }
+ log.trace("Enter startElement " + name);
+ }
+ try
+ {
+ contentHandler.startElement(namespaceURI, localName, qName, atts, null);
+ }
+ finally
+ {
+ if(trace)
+ {
+ log.trace("Exit startElement " + name);
+ }
+ }
+ }
+ }
+
+ private static final class MetaDataErrorHandler
+ implements ErrorHandler
+ {
+ public static final ErrorHandler INSTANCE = new MetaDataErrorHandler();
+
+ public void warning(SAXParseException exception)
+ {
+ log.warn(formatMessage(exception));
+ }
+
+ public void error(SAXParseException exception)
+ throws SAXException
+ {
+ throw new SAXException(formatMessage(exception));
+ }
+
+ public void fatalError(SAXParseException exception)
+ throws SAXException
+ {
+ throw new SAXException(formatMessage(exception));
+ }
+
+ public String formatMessage(SAXParseException exception)
+ {
+ StringBuffer buffer = new StringBuffer(50);
+ buffer.append(exception.getMessage()).append(" @ ");
+ String location = exception.getPublicId();
+ if(location != null)
+ {
+ buffer.append(location);
+ }
+ else
+ {
+ location = exception.getSystemId();
+ if(location != null)
+ {
+ buffer.append(location);
+ }
+ else
+ {
+ buffer.append("*unknown*");
+ }
+ }
+ buffer.append('[');
+ buffer.append(exception.getLineNumber()).append(',');
+ buffer.append(exception.getColumnNumber()).append(']');
+ return buffer.toString();
+ }
+ }
+}
More information about the jboss-svn-commits
mailing list