You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Ias <ia...@tmax.co.kr> on 2003/11/17 13:22:23 UTC
About endElement's logic of a generated Handler
Supposing we have the following schema,
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xml:lang="EN"
targetNamespace="http://ws.apache.org/jaxme/test/misc/group"
xmlns="http://ws.apache.org/jaxme/test/misc/group"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:annotation>
<xs:element name="Persons">
<xs:complexType>
<xs:sequence>
<xs:element name="Person" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Age" minOccurs="0" type="xs:int"/>
</xs:sequence>
<xs:attribute name="Alias" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
If we try to unmarshall
"<Persons xmlns=\"http://ws.apache.org/jaxme/test/misc/group\">\n"
+ " <Person Alias=\"Ias\">\n"
+ " </Person>\n"
+ "</Persons>"
, Unexpected element: 'Persons' occurs.
The reason is, in endElement of PersonsTypeHandler.PersonTypeHandler
public void endElement(java.lang.String pNamespaceURI, java.lang.String
pLocalName, java.lang.String pQName) throws org.xml.sax.SAXException {
if (__handler == null) {
if (__level != 1) {
super.endElement(pNamespaceURI, pLocalName, pQName);
}
} else {
__handler.endElement(pNamespaceURI, pLocalName, pQName);
}
PersonsTypeHandler's endElement calls the above method, and __handler of
PersonsTypeHandler.PersonTypeHandler is null because
PersonsTypeHandler.PersonTypeHandler was never invoked (<Person> has no
child element)).
Moreover, __level = 0 leads the flow to super.endElement.
I guess
if (__level > 1) {
figures out the problem. What do you think of this issue?
Ias
===========================================================
Lee, Changshin (Korean name)
Ias (International name)
Company Web Site: http://www.tmax.co.kr
Personal Web Site: http://www.iasandcb.pe.kr
---------------------------------------------------------
Senior Researcher, Emerging Technology Evangelist & JCP Activities
Coordinator
JCP member - http://jcp.org/en/participation/members/L
R&D Institute
Tmax Soft, Inc.
JCP member - http://jcp.org/en/participation/members/T
==========================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org