You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to parse an XML string such as <theprefix:entry>whatever</theprefix:entry> using an AsyncXMLStreamReader.
But I get an Exception in thread "main" com.fasterxml.aalto.WFCException: Unbound namespace prefix 'theprefix' (for element name 'theprefix:entry') error.
If, however, I try with the unprefixed version: <entry>whatever</entry>, it all works fine.
I do not have control over the input XML I am going to need parsing (XMPP Protocol messages in my case).
Is there anything I could to o configure at the factory/parser level to allow for this to be a valid and parseable XML?
Please refer to this jbang script I am using to reproduce. If you'd rather have a complete maven or gradle project, let me know and I will prepare one:
jbang "/Users/miguelgl/development/learning/xml-bugreport/XmlParserTest.java"
[jbang] Building jar for XmlParserTest.java...
Exception in thread "main" com.fasterxml.aalto.WFCException: Unbound namespace prefix 'theprefix' (for element name 'theprefix:entry')
at [row,col {unknown-source}]: [1,18]
at com.fasterxml.aalto.in.XmlScanner.reportInputProblem(XmlScanner.java:1333)
at com.fasterxml.aalto.in.XmlScanner.reportUnboundPrefix(XmlScanner.java:1473)
at com.fasterxml.aalto.async.AsyncByteArrayScanner.finishStartElement(AsyncByteArrayScanner.java:1865)
at com.fasterxml.aalto.async.AsyncByteArrayScanner.handleStartElement(AsyncByteArrayScanner.java:1661)
at com.fasterxml.aalto.async.AsyncByteArrayScanner.handleStartElementStart(AsyncByteArrayScanner.java:1606)
at com.fasterxml.aalto.async.AsyncByteScanner.nextFromProlog(AsyncByteScanner.java:887)
at com.fasterxml.aalto.stax.StreamReaderImpl.next(StreamReaderImpl.java:790)
at XmlParserTest.main(XmlParserTest.java:46)
The text was updated successfully, but these errors were encountered:
MiguelGL-DN
changed the title
How to parse XML strings with unbound namespace prefixes
How to parse XML strings with unbound namespace prefixes?
Nov 25, 2024
I am trying to parse an XML string such as
<theprefix:entry>whatever</theprefix:entry>
using anAsyncXMLStreamReader
.But I get an
Exception in thread "main" com.fasterxml.aalto.WFCException: Unbound namespace prefix 'theprefix' (for element name 'theprefix:entry')
error.If, however, I try with the unprefixed version:
<entry>whatever</entry>
, it all works fine.I do not have control over the input XML I am going to need parsing (XMPP Protocol messages in my case).
Is there anything I could to o configure at the factory/parser level to allow for this to be a valid and parseable XML?
Please refer to this jbang script I am using to reproduce. If you'd rather have a complete maven or gradle project, let me know and I will prepare one:
The error exception reads:
The text was updated successfully, but these errors were encountered: