File tree Expand file tree Collapse file tree
src/main/java/tools/jackson/dataformat/xml/ser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -707,14 +707,26 @@ public final void _handleStartObject() throws JacksonException
707707 if (_nextName == null ) {
708708 handleMissingName ();
709709 }
710+ // 20-Apr-2026, tatu: special handling for Root Element...
711+ final boolean isRoot = _elementNameStack .isEmpty ();
710712 // Need to keep track of names to make Lists work correctly
711713 _elementNameStack .addLast (_nextName );
712714 try {
713- _xmlWriter .writeStartElement (_nextName .getNamespaceURI (), _nextName .getLocalPart ());
715+ if (isRoot ) {
716+ _handleStartRootObject (_nextName );
717+ } else {
718+ _xmlWriter .writeStartElement (_nextName .getNamespaceURI (), _nextName .getLocalPart ());
719+ }
714720 } catch (XMLStreamException e ) {
715721 StaxUtil .throwAsWriteException (e , this );
716722 }
717723 }
724+
725+ // @since 3.2
726+ protected void _handleStartRootObject (QName rootElemName ) throws XMLStreamException {
727+ // !!! TODO: special handling
728+ _xmlWriter .writeStartElement (_nextName .getNamespaceURI (), _nextName .getLocalPart ());
729+ }
718730
719731 // note: public just because pretty printer needs to make a callback
720732 public final void _handleEndObject () throws JacksonException
You can’t perform that action at this time.
0 commit comments