Andreas Martens created AXIOM-533:
-------------------------------------

             Summary: xop:Include handling can't handle surrounding whitespace
                 Key: AXIOM-533
                 URL: https://issues.apache.org/jira/browse/AXIOM-533
             Project: Axiom
          Issue Type: Bug
            Reporter: Andreas Martens
         Attachments: Screenshot 2026-10-28 at 17.27.43.png

We (well a customer) is getting this exception after their input message has 
been reindented (i.e. an <xop:Include> element has a newline before and after):

{{org.apache.axiom.om.DeferredParsingException:org.apache.axiom.core.stream.StreamException:
 Expected xop:Include as the sole child of an element information item (see 
section 3.2 of http://www.w3.org/TR/xop10/)}}
{{ at 
org.apache.axiom.om.impl.common.AxiomExceptionTranslator.translate(AxiomExceptionTranslator.java:38)}}
{{ at org.apache.axiom.om.impl.llom.AxiomContainerImpl.serialize(Unknown 
Source)}}
{{ at 
org.apache.axiom.om.impl.llom.AxiomContainerImpl.serializeAndSurfaceIOException(Unknown
 Source)}}
{{ at org.apache.axiom.om.impl.llom.AxiomContainerImpl.serialize(Unknown 
Source)}}
{{{}Caused by: org.a{}}}pache.axiom.core.stream.StreamException: Expected 
xop:Include as the sole child of an element information item (see section 3.2 
of http://www.w3.org/TR/xop10/)
 at 
org.apache.axiom.core.stream.xop.AbstractXOPDecodingFilterHandler.startElement(AbstractXOPDecodingFilterHandler.java:71)
 at 
org.apache.axiom.core.stream.stax.pull.input.StAXPullReader.processElement(StAXPullReader.java:230)
 at 
org.apache.axiom.core.stream.stax.pull.input.StAXPullReader.proceed(StAXPullReader.java:189)
 at org.apache.axiom.core.impl.builder.BuilderImpl.next(BuilderImpl.java:59)
 at org.apache.axiom.om.impl.llom.CoreParentNodeImpl.internalBuildNext(Unknown 
Source)
 at org.apache.axiom.om.impl.llom.CoreParentNodeImpl.coreGetFirstChild(Unknown 
Source)
 at org.apache.axiom.core.impl.TreeWalkerImpl.proceed(TreeWalkerImpl.java:146)
 at org.apache.axiom.om.impl.llom.CoreParentNodeImpl.internalSerialize(Unknown 
Source)
 at org.apache.axiom.om.impl.llom.AxiomContainerImpl.serialize(Unknown Source)
 ... 6 more '

 

Looking at the section in question (2.3) in 
[https://www.w3.org/TR/xop10/#interpreting_xop_packages:]

To create a Reconstituted XML Infoset from a XOP Package:
 # Construct an XML Infoset by parsing the root part of the package as an XML 
document. The document MUST be parsed according to the level of the XML 
Recommendation identified by the XML declaration of that document. If no XML 
declaration is present, then the document MUST be parsed per [[Extensible 
Markup Language (XML) 1.0 (Third Edition)]|https://www.w3.org/TR/xop10/#XML].
 # Using that XML Infoset, for each {_}element information item{_}, E, which 
has, as the sole member of its [children] property, a {{xop:Include}} _element 
information item_ (as defined in [*2.1 xop:Include element information 
item*|https://www.w3.org/TR/xop10/#xop_include]):
 ## Locate the part of the package corresponding to the URI in the {{href}} 
_attribute information item_ of the {{xop:Include}} _element information item_ 
(i.e., corresponding to the URI encoded in the {_}attribute information 
item{_}'s [normalized value]).
 ## Replace the {{xop:Include}} _element information item_ that appears in the 
[children] property of E with _character information items_ representing the 
canonical base64 encoding of the entity body of the identified package part 
(i.e., effectively replace the {{xop:Include}} _element information item_ with 
the data reconstructed from the package part).

Reading this, I _think_ we could be allowed to be a little lenient, and allow 
*whitespace* around the xop:Include element. In fact, if we took the example 
from the wikipedia page: 
[https://en.wikipedia.org/wiki/XML-binary_Optimized_Packaging:] (example 
attached as image, since it lost a lot in the copy-paste) then that too would 
fail parsing, since that example also has been reindented after writing.

This *used to* work with an old version of Axiom I believe, but I don't want to 
simply fix it without a discussion here. what do you think, should whitespace 
be allowed?

 

 

 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to