8000 Use `FactoryAdapter` as `ContentHandler` crashes · Issue #764 · scala/scala-xml · GitHub
[go: up one dir, main page]

Skip to content
Use FactoryAdapter as ContentHandler crashes #764
Closed as not planned
Closed as not planned
@lrytz

Description

@lrytz

This used to work a while ago

  @UnitTest
  def contentHandler(): Unit = {
    val p = defaultParserFactory.newSAXParser()
    val handler = new parsing.NoBindingFactoryAdapter
    val input = new ByteArrayInputStream("<hello>world</hello>".getBytes("UTF-8"))
    p.parse(input, handler)
    val n: Node = handler.rootElem
  }

This bypasses FactoryAdapter.loadDocument, which is used internally within scala.xml.

Currently:

I came across some code at a customer that uses NoBindingFactoryAdapter as a ContentHandler in their internal XML library to convert to scala.xml.

I can work around it by overriding def endDocument(), getting out the rootElem and avoid calling super.endDocument().

I don't know if the use case should be supported?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0