Closed
Description
(Created a new issue from a comment #72 (comment) by @Mark-L6n)
Furthermore, it does not handle other HTML entities well. There are well over 1,000 HTML entities (see list), and their values are simply tossed out with EvEntityRef
. I am processing Wikipedia dumps and will encounter a wide range of them.
Why are only 4/5 entities processed, when any entity can occur in a text field? There shouldn't be a security concern, as a motivation for using entities is security.
Also, why are entities treated as an event at all? It'd be nice to have the option to disable this functionality so one could simply get all the text in a EvText()
event.
Hopefully, there can be a way to either:
- enable
EvEntityRef
to process all HTML entities or - disable
EvEntityRef
events from occurring and breaking upEvText()
events.
Example problem:
object testEntityErr {
import scala.io.Source
import scala.xml.pull._
val testStr = "<text> & " < > </text>" +
"<notext> ' © ® € $ ¢ £ ¥ </notext>"
val xml = new XMLEventReader(Source.fromString(testStr))
for (event <- xml) {
event match {
case EvEntityRef(e) => println(e)
case EvComment(_) => println(event)
case _ => // ignore
}
}
}
Output:
import scala.io.Source
import scala.xml.pull._
testStr: String = <text> & " < > </text><notext> ' © ® € $ ¢ £ ¥ </notext>
xml: scala.xml.pull.XMLEventReader = non-empty iterator
amp
quot
lt
gt
EvComment( unknown entity nbsp; )
EvComment( unknown entity apos; )
EvComment( unknown entity copy; )
EvComment( unknown entity reg; )
EvComment( unknown entity euro; )
EvComment( unknown entity dollar; )
EvComment( unknown entity cent; )
EvComment( unknown entity pound; )
EvComment( unknown entity yen; )
res0: Unit = ()
Metadata
Metadata
Assignees
Labels
No labels