You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/12/12 20:15:15 UTC
DO NOT REPLY [Bug 15328] New: -
Unnecessary namespace definitions generated in serialization
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15328>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15328
Unnecessary namespace definitions generated in serialization
Summary: Unnecessary namespace definitions generated in
serialization
Product: Axis
Version: current (nightly)
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Serialization/Deserialization
AssignedTo: axis-dev@xml.apache.org
ReportedBy: dms@sosnoski.com
The NSStack used by org.apache.axis.encoding.SerializationContextImpl is not
being properly cleared at the end of each element, resulting in an accumulation
of namespaces on the stack. This shows up, for example, during the serialization
of multiRefs. The new code (since changes implemented yesterday) generates
multiRefs of this form:
<multiRef id="id14" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:FlightBean" xmlns:ns1="urn:axis.sosnoski.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://flightsraw" xmlns:ns3="http://xml.apache.org/xml-soap">
<arrivalTime xsi:type="xsd:string">11:04a</arrivalTime>
<departureTime xsi:type="xsd:string">7:00a</departureTime>
<number xsi:type="xsd:int">937</number>
<carrier href="#id7"/>
</multiRef>
with unused namespaces for prefixes ns1 and ns3. The serialization previously
generated looked like this (no unused namespace declarations):
<multiRef id="id21" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns14:FlightBean" xmlns:ns14="http://flightsraw"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<arrivalTime xsi:type="xsd:string">11:04a</arrivalTime>
<departureTime xsi:type="xsd:string">7:00a</departureTime>
<number xsi:type="xsd:int">937</number>
<carrier href="#id7"/>
</multiRef>
In this example the problem only results in padding the multiRefs with
unnecessary namespace declarations, but it demonstrates the accumulation of
namespaces on the stack.
This can be fixed by implementing the same sort of state tracking for
SerializationContextImpl as added yesterday to DeserializationContextImpl, where
clients of NSStack need to push() a null prior to declaring any namespaces for
an element, or to push the null for the element itself if no namespaces are
declared. A cleaner solution is to just redefine what constitutes a frame in
NSStack, to consist of everything from the current top of the stack (which
should always be a null) down to (but not including) the next null on the stack.
This would make NSStack's implementation consistent with how namespaces are
actually declared and used in XML, and simplify the logic needed in clients of
the class.