Hi Vico -- As it just so happened I was working to solve that very same problem!
The attached files have the changes necessary to allow elements from the non-schema namesapce to appear in documentation and appinfo elements. Any content is allowed in these two elements. Previously, castor would not allow documentation and appinfo to contain such elements. Here is a patch which will solve that problem and I hope gets applied to the main build! -Patrick Moore- >-----Original Message----- >From: Vico Klump [mailto:[EMAIL PROTECTED]] >Sent: Monday, February 25, 2002 7:32 AM >To: [EMAIL PROTECTED] >Subject: [castor-dev] How to use <appinfo> with Castor ? > > >Hi , > >I try to use the XML-Schema <appinfo> Tag with the Castor >schema parser, but >I get a >SAX Exception: > >D:\>java -cp >"D:\Projekte\xerces-2_0_0\xercesImpl.jar;D:\Projekte\xerces-2_0 >_0\xmlParserA >PIs.jar;D:\Projekte\castor-093.9\castor-0939.jar;." CastorTest >java.io.IOException: org.xml.sax.SAXException: 'app:Type_info' >has not been >decl >ared in the XML Schema namespace. > line: 8 > >D:\> > >Here are the schema files: > >Base schema : >castor_ex_source.xsd< > ><?xml version="1.0" encoding="UTF-8"?> ><xs:schema targetNamespace="http://www.risa.de/castor_ex_source" >xmlns:xs="http://www.w3.org/2001/XMLSchema" >xmlns="http://www.risa.de/castor_ex_source" >elementFormDefault="qualified" >attributeFormDefault="unqualified"> > <xs:element name="Type_info"> > <xs:annotation> > <xs:documentation>Comment describing your root >element</xs:documentation> > </xs:annotation> > </xs:element> ></xs:schema> > >Child schema : >castor.xsd< > ><?xml version="1.0" encoding="UTF-8"?> ><xs:schema xmlns:app="http://www.risa.de/castor_ex_source" >xmlns:xs="http://www.w3.org/2001/XMLSchema" >elementFormDefault="qualified" >attributeFormDefault="unqualified"> > <xs:import namespace="http://www.risa.de/castor_ex_source" >schemaLocation="castor_ex_source.xsd"/> > <xs:element name="Element_A" type="xs:string"> > <xs:annotation> > <xs:documentation>Comment describing your root >element</xs:documentation> > <xs:appinfo> > <app:Type_info>4711</app:Type_info> > </xs:appinfo> > </xs:annotation> > </xs:element> ></xs:schema> > >and the java source >CastorTest.java< > >import java.io.*; >import java.io.IOException; >import java.util.*; >import javax.xml.parsers.*; > >import org.xml.sax.SAXException; >import org.xml.sax.InputSource; >import org.xml.sax.SAXParseException; > >import org.exolab.castor.xml.schema.reader.*; >import org.exolab.castor.xml.ValidationException; >import org.exolab.castor.xml.schema.*; > >/** > * @author RISA > * @author Vico KLump > * @version 1 > */ >public class CastorTest { > > private static String strSchema = > "castor.xsd"; > > public void testCastor(){ > > InputSource source = new InputSource(strSchema); > > try { > SchemaReader schemaReader = new SchemaReader(source); > > Schema schema = schemaReader.read(); > > try { > schema.validate(); > } catch(ValidationException e) { > System.err.println(e); > } > > Enumeration enum = schema.getComplexTypes(); > > while(enum.hasMoreElements()){ > ComplexType ct = (ComplexType) enum.nextElement(); > System.out.println( ct.getName() ); > } > > } catch(IOException e) { > System.err.println(e); > } > > > } > > /** Main method */ > public static void main(String[] args) { > > CastorTest test = new CastorTest(); > > test.testCastor(); > > } > >} > >If I use XMLspy or Xerces to validate the schema I get no >error. Has anyone >an idea how >to integrate extra tags in <appinfo> ? > >Best Regards >Vico. > >Attached: >castor.xsd >castor_ex_source.xsd >CastorTest.java >---------------------------------------------------- >Vico Klump > >
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:rb="http://www.sworddance.com/RelationshipBook" xmlns:castorBinding="http://www.castor.org/SourceGenerator/Binding" targetNameSpace="http://www.sworddance.com/RelationshipBook" xml:lang="en"> <xsd:complexType name="IdType"> <xsd:annotation><xsd:documentation> <rb:identifier/> This is the Id that every entityRef (and thus every Entity) </xsd:documentation></xsd:annotation> <xsd:attribute name="issuingSite" type="xsd:anyURI"/> <xsd:attribute name="id" type="xsd:NMTOKEN"/> </xsd:complexType> <xsd:complexType name="DateRefType"> <xsd:annotation><xsd:documentation> This is used to indicate a date -- it may be a "fuzzy" date </xsd:documentation> <xsd:appinfo> <castorBinding:binding> <castorBinding:java-class> <castorBinding:implements> com.sworddance.rbook.interfaces.DateRef </castorBinding:implements> <castorBinding:extends> com.sworddance.rbook.coreobjects.DateRefImpl </castorBinding:extends> <castorBinding:unmarshals> com.sworddance.rbook.interfaces.DateRef </castorBinding:unmarshals> </castorBinding:java-class> </castorBinding:binding> </xsd:appinfo> </xsd:annotation> <xsd:sequence> <xsd:element name="start" type="xsd:string"/> <xsd:element name="stop" type="xsd:string" use="optional"/> </xsd:sequence> <xsd:attribute name="Duration" type="xsd:boolean" use="optional" default="false"/> <xsd:attribute name="Repeating" type="xsd:boolean" use="optional" default="false"/> <xsd:attribute name="Interval" type="xsd:boolean" use="optional"/> </xsd:complexType> </xsd:schema>
AnyContentUnmarshaller.java
Description: Binary data
====
//castor/src/main/org/exolab/castor/xml/schema/reader/AnnotationUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/AnnotationUnmarshaller.java
====
@@ -61,16 +61,6 @@
//--------------------/
//- Member Variables -/
//--------------------/
-
- /**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
/**
* The Annotation we are constructing
==== //castor/src/main/org/exolab/castor/xml/schema/reader/AppInfoUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/AppInfoUnmarshaller.java
====
@@ -55,7 +55,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Keith Visco</a>
* @version $Revision: 1.4 $ $Date: 2001/05/30 03:02:17 $
**/
-public class AppInfoUnmarshaller extends SaxUnmarshaller {
+public class AppInfoUnmarshaller extends SaxUnmarshaller implements
+AnyContentUnmarshaller {
//--------------------/
@@ -63,16 +63,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The Attribute reference for the Attribute we are constructing
**/
private AppInfo _appInfo = null;
@@ -150,7 +140,7 @@
**/
public void startElement(String name, AttributeList atts)
throws org.xml.sax.SAXException
- {
+ {
//-- ignore all daughter elements for now
++depth;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/AttributeGroupUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/AttributeGroupUnmarshaller.java
====
@@ -63,16 +63,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The AttributeGroup we are constructing
**/
private AttributeGroup _attributeGroup = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/AttributeUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/AttributeUnmarshaller.java
====
@@ -64,16 +64,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The Attribute reference for the Attribute we are constructing
**/
private AttributeDecl _attribute = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/ComplexContentRestrictionUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/ComplexContentRestrictionUnmarshaller.java
====
@@ -64,16 +64,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The complexType we are unmarshalling
**/
private ComplexType _complexType = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/ComplexContentUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/ComplexContentUnmarshaller.java
====
@@ -62,16 +62,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The Attribute reference for the Attribute we are constructing
**/
private ComplexType _complexType = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/ComplexTypeUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/ComplexTypeUnmarshaller.java
====
@@ -63,16 +63,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The Attribute reference for the Attribute we are constructing
**/
private ComplexType _complexType = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/DocumentationUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/DocumentationUnmarshaller.java
====
@@ -55,22 +55,12 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Keith Visco</a>
* @version $Revision: 1.2 $ $Date: 2000/11/04 01:31:16 $
**/
-public class DocumentationUnmarshaller extends SaxUnmarshaller {
+public class DocumentationUnmarshaller extends SaxUnmarshaller implements
+AnyContentUnmarshaller {
//--------------------/
//- Member Variables -/
//--------------------/
-
- /**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
/**
* The Attribute reference for the Attribute we are constructing
==== //castor/src/main/org/exolab/castor/xml/schema/reader/ElementUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/ElementUnmarshaller.java
====
@@ -67,16 +67,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The element reference for the element definition we are "unmarshalling".
**/
private ElementDecl _element = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/ExtensionUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/ExtensionUnmarshaller.java
====
@@ -63,16 +63,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The Attribute reference for the Attribute we are constructing
**/
private ComplexType _complexType = null;
==== //castor/src/main/org/exolab/castor/xml/schema/reader/FacetUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/FacetUnmarshaller.java
====
@@ -63,16 +63,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller = null;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The Facet we are constructing
**/
private Facet _facet = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/FieldOrSelectorUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/FieldOrSelectorUnmarshaller.java
====
@@ -64,16 +64,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller _unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int _depth = 0;
-
- /**
* The Field or Selector we are unmarshalling
**/
private Annotated _fieldOrSelector = null;
@@ -160,9 +150,9 @@
throws org.xml.sax.SAXException
{
//-- Do delagation if necessary
- if (_unmarshaller != null) {
- _unmarshaller.startElement(name, atts);
- ++_depth;
+ if (unmarshaller != null) {
+ unmarshaller.startElement(name, atts);
+ ++depth;
return;
}
@@ -172,7 +162,7 @@
error("Only one (1) annotation may appear as a child of '" +
_elementName + "'.");
_foundAnnotation = true;
- _unmarshaller = new AnnotationUnmarshaller(atts);
+ unmarshaller = new AnnotationUnmarshaller(atts);
}
else illegalElement(name);
@@ -187,29 +177,29 @@
{
//-- Do delagation if necessary
- if ((_unmarshaller != null) && (_depth > 0)) {
- _unmarshaller.endElement(name);
- --_depth;
+ if ((unmarshaller != null) && (depth > 0)) {
+ unmarshaller.endElement(name);
+ --depth;
return;
}
//-- have unmarshaller perform any necessary clean up
- _unmarshaller.finish();
+ unmarshaller.finish();
if (SchemaNames.ANNOTATION.equals(name)) {
- Annotation annotation = (Annotation)_unmarshaller.getObject();
+ Annotation annotation = (Annotation)unmarshaller.getObject();
_fieldOrSelector.addAnnotation(annotation);
}
- _unmarshaller = null;
+ unmarshaller = null;
} //-- endElement
public void characters(char[] ch, int start, int length)
throws SAXException
{
//-- Do delagation if necessary
- if (_unmarshaller != null) {
- _unmarshaller.characters(ch, start, length);
+ if (unmarshaller != null) {
+ unmarshaller.characters(ch, start, length);
}
} //-- characters
==== //castor/src/main/org/exolab/castor/xml/schema/reader/GroupUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/GroupUnmarshaller.java
====
@@ -76,16 +76,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The ModelGroup reference for the ModelGroup we are constructing
**/
private Group _group = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/IdentityConstraintUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/IdentityConstraintUnmarshaller.java
====
@@ -63,16 +63,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller _unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int _depth = 0;
-
- /**
* The IdentityConstraint we are unmarshalling
**/
private IdentityConstraint _identityConstraint = null;
@@ -177,9 +167,9 @@
throws org.xml.sax.SAXException
{
//-- Do delagation if necessary
- if (_unmarshaller != null) {
- _unmarshaller.startElement(name, atts);
- ++_depth;
+ if (unmarshaller != null) {
+ unmarshaller.startElement(name, atts);
+ ++depth;
return;
}
@@ -194,7 +184,7 @@
_elementName + "'.");
_foundAnnotation = true;
- _unmarshaller = new AnnotationUnmarshaller(atts);
+ unmarshaller = new AnnotationUnmarshaller(atts);
}
else if (SchemaNames.SELECTOR.equals(name)) {
@@ -209,11 +199,11 @@
_foundSelector = true;
- _unmarshaller = new FieldOrSelectorUnmarshaller(name, atts);
+ unmarshaller = new FieldOrSelectorUnmarshaller(name, atts);
}
else if (SchemaNames.FIELD.equals(name)) {
_foundField = true;
- _unmarshaller = new FieldOrSelectorUnmarshaller(name, atts);
+ unmarshaller = new FieldOrSelectorUnmarshaller(name, atts);
}
else illegalElement(name);
@@ -228,40 +218,40 @@
{
//-- Do delagation if necessary
- if ((_unmarshaller != null) && (_depth > 0)) {
- _unmarshaller.endElement(name);
- --_depth;
+ if ((unmarshaller != null) && (depth > 0)) {
+ unmarshaller.endElement(name);
+ --depth;
return;
}
//-- have unmarshaller perform any necessary clean up
- _unmarshaller.finish();
+ unmarshaller.finish();
if (SchemaNames.ANNOTATION.equals(name)) {
- Annotation annotation = (Annotation)_unmarshaller.getObject();
+ Annotation annotation = (Annotation)unmarshaller.getObject();
_identityConstraint.addAnnotation(annotation);
}
else if (SchemaNames.SELECTOR.equals(name)) {
IdentitySelector selector
- = (IdentitySelector)_unmarshaller.getObject();
+ = (IdentitySelector)unmarshaller.getObject();
_identityConstraint.setSelector(selector);
}
else if (SchemaNames.FIELD.equals(name)) {
IdentityField field
- = (IdentityField)_unmarshaller.getObject();
+ = (IdentityField)unmarshaller.getObject();
_identityConstraint.addField(field);
}
- _unmarshaller = null;
+ unmarshaller = null;
} //-- endElement
public void characters(char[] ch, int start, int length)
throws SAXException
{
//-- Do delagation if necessary
- if (_unmarshaller != null) {
- _unmarshaller.characters(ch, start, length);
+ if (unmarshaller != null) {
+ unmarshaller.characters(ch, start, length);
}
} //-- characters
====
//castor/src/main/org/exolab/castor/xml/schema/reader/ModelGroupUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/ModelGroupUnmarshaller.java
====
@@ -72,16 +72,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The ModelGroup reference for the ModelGroup we are constructing
**/
private ModelGroup _group = null;
==== //castor/src/main/org/exolab/castor/xml/schema/reader/SaxUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/SaxUnmarshaller.java
====
@@ -73,7 +73,15 @@
* The resolver to be used for resolving id references
**/
private Resolver _resolver;
+ /**
+ * The current SaxUnmarshaller
+ **/
+ protected SaxUnmarshaller unmarshaller;
+ /**
+ * The current branch depth
+ **/
+ protected int depth = 0;
//----------------/
//- Constructors -/
//----------------/
@@ -126,6 +134,14 @@
public void setResolver(Resolver resolver) {
_resolver = resolver;
} //-- setResolver
+
+ SaxUnmarshaller getBottomUnmarshaller() {
+ if ( this.unmarshaller == null ) {
+ return this;
+ } else {
+ return this.unmarshaller.getBottomUnmarshaller();
+ }
+ }
/**
* Determines if the given sequence of characters consists
==== //castor/src/main/org/exolab/castor/xml/schema/reader/SchemaUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/SchemaUnmarshaller.java
====
@@ -80,15 +80,6 @@
* is this a included schema?
*/
private boolean _include = false;
- /**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
boolean skipAll = false;
@@ -326,9 +317,10 @@
//-- end of backward compatibility
//-- check namespace
- if (!XSD_NAMESPACE.equals(namespace)) {
+ if (!XSD_NAMESPACE.equals(namespace) && !(this.getBottomUnmarshaller()
+instanceof AnyContentUnmarshaller) ) {
error("'"+ rawName + "' has not been declared in the XML "+
- "Schema namespace.");
+ "Schema namespace. Current Unmarshaller instanceof "+
+ ((unmarshaller != null)?unmarshaller.getClass().getName():"<none>"));
}
//-- Do delagation if necessary
====
//castor/src/main/org/exolab/castor/xml/schema/reader/SimpleContentRestrictionUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/SimpleContentRestrictionUnmarshaller.java
====
@@ -63,16 +63,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The complexType we are unmarshalling
**/
private ComplexType _complexType = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/SimpleContentUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/SimpleContentUnmarshaller.java
====
@@ -62,16 +62,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The Attribute reference for the Attribute we are constructing
**/
private ComplexType _complexType = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/SimpleTypeListUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/SimpleTypeListUnmarshaller.java
====
@@ -68,16 +68,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The simpleType we are unmarshalling
**/
private ListType _list = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/SimpleTypeRestrictionUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/SimpleTypeRestrictionUnmarshaller.java
====
@@ -63,16 +63,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The simpleType we are unmarshalling
**/
private SimpleTypeDefinition _typeDefinition = null;
====
//castor/src/main/org/exolab/castor/xml/schema/reader/SimpleTypeUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/SimpleTypeUnmarshaller.java
====
@@ -64,16 +64,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The SimpleTypeDefinition we are unmarshalling
**/
private SimpleTypeDefinition _simpleTypeDef = null;
==== //castor/src/main/org/exolab/castor/xml/schema/reader/UnionUnmarshaller.java#3 -
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/UnionUnmarshaller.java
====
@@ -65,16 +65,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller _unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int _depth = 0;
-
- /**
* The Union we are unmarshalling
**/
private Union _union = null;
@@ -152,9 +142,9 @@
throws org.xml.sax.SAXException
{
//-- Do delagation if necessary
- if (_unmarshaller != null) {
- _unmarshaller.startElement(name, atts);
- ++_depth;
+ if (unmarshaller != null) {
+ unmarshaller.startElement(name, atts);
+ ++depth;
return;
}
@@ -169,11 +159,11 @@
elementName() + "'.");
_foundAnnotation = true;
- _unmarshaller = new AnnotationUnmarshaller(atts);
+ unmarshaller = new AnnotationUnmarshaller(atts);
}
else if (SchemaNames.SIMPLE_TYPE.equals(name)) {
_foundSimpleType = true;
- _unmarshaller = new SimpleTypeUnmarshaller(_schema, atts);
+ unmarshaller = new SimpleTypeUnmarshaller(_schema, atts);
}
else illegalElement(name);
@@ -188,22 +178,22 @@
{
//-- Do delagation if necessary
- if ((_unmarshaller != null) && (_depth > 0)) {
- _unmarshaller.endElement(name);
- --_depth;
+ if ((unmarshaller != null) && (depth > 0)) {
+ unmarshaller.endElement(name);
+ --depth;
return;
}
//-- have unmarshaller perform any necessary clean up
- _unmarshaller.finish();
+ unmarshaller.finish();
if (SchemaNames.ANNOTATION.equals(name)) {
- _union.setLocalAnnotation((Annotation)_unmarshaller.getObject());
+ _union.setLocalAnnotation((Annotation)unmarshaller.getObject());
}
else if (SchemaNames.SIMPLE_TYPE.equals(name)) {
SimpleType simpleType =
- (SimpleType)_unmarshaller.getObject();
+ (SimpleType)unmarshaller.getObject();
//-- make sure type is not another Union
if (simpleType instanceof Union) {
@@ -218,15 +208,15 @@
}
- _unmarshaller = null;
+ unmarshaller = null;
} //-- endElement
public void characters(char[] ch, int start, int length)
throws SAXException
{
//-- Do delagation if necessary
- if (_unmarshaller != null) {
- _unmarshaller.characters(ch, start, length);
+ if (unmarshaller != null) {
+ unmarshaller.characters(ch, start, length);
}
} //-- characters
==== //castor/src/main/org/exolab/castor/xml/schema/reader/UnknownUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/UnknownUnmarshaller.java
====
@@ -60,16 +60,6 @@
//--------------------/
//- Member Variables -/
//--------------------/
-
- /**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
private CharacterUnmarshaller charUnmarshaller = null;
==== //castor/src/main/org/exolab/castor/xml/schema/reader/WildcardUnmarshaller.java#3
-
/home/patrick/castor/src/main/org/exolab/castor/xml/schema/reader/WildcardUnmarshaller.java
====
@@ -69,16 +69,6 @@
//--------------------/
/**
- * The current SaxUnmarshaller
- **/
- private SaxUnmarshaller unmarshaller;
-
- /**
- * The current branch depth
- **/
- private int depth = 0;
-
- /**
* The wildcard we are constructing
*/
private Wildcard _wildcard = null;
