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 need to resolve custom XML entities in some custom event handler/function. Sadly, an unknown entity doesn't trigger the XMLEvent.ENTITY_REFERENCE event. If this feature is not implemented, is there any workaround?
Here is a test case showing what I expect from Aalto. I'm using aalto-xml 1.1.0.
com.fasterxml.aalto.WFCException: Unexpanded ENTITY_REFERENCE (replace-me) in attribute value
at [row,col {unknown-source}]: [2,26]
at com.fasterxml.aalto.in.XmlScanner.reportInputProblem(XmlScanner.java:1333)
at com.fasterxml.aalto.in.XmlScanner.reportUnexpandedEntityInAttr(XmlScanner.java:1343)
at com.fasterxml.aalto.in.ReaderScanner.collectValue(ReaderScanner.java:901)
at com.fasterxml.aalto.in.ReaderScanner.handleStartElement(ReaderScanner.java:794)
at com.fasterxml.aalto.in.ReaderScanner.nextFromProlog(ReaderScanner.java:236)
at com.fasterxml.aalto.stax.StreamReaderImpl.next(StreamReaderImpl.java:790)
at com.otcdlink.chiron.wire.StaxPlayground.entityReplacement(StaxPlayground.java:44)
The text was updated successfully, but these errors were encountered:
otcdlink-simpleuser
changed the title
No ENTITY_REFERENCE event
Can't use ENTITY_REFERENCE event for resolution in an Attribute
Aug 29, 2018
I just figured out that ENTITY_REFERENCE does work inside an Element's text. When the test case parses "<whatever>&replace-me;</whatever>" the ENTITY_REFERENCE happens.
Is there any way to hook on entity resolution when parsing an Attribute?
I'm looking at ReaderScanner's code around line 1066 and 897 and obviously the parser wants such an undefined entity to fail. Sounds like bad news for me.
OK I got it. I should ask for unresolved entities and resolve them on my own instead of relying on ENTITY_REFERENCE since it's probably not supposed to work with Attributes.
The problem is, disabling entity resolution is not yet possible. I'm opening another issue for that.
I need to resolve custom XML entities in some custom event handler/function. Sadly, an unknown entity doesn't trigger the
XMLEvent.ENTITY_REFERENCE
event. If this feature is not implemented, is there any workaround?Here is a test case showing what I expect from Aalto. I'm using aalto-xml 1.1.0.
All I get is an exception:
The text was updated successfully, but these errors were encountered: