Skip to content

Commit

Permalink
Fix the error of parsing some special XML
Browse files Browse the repository at this point in the history
  • Loading branch information
scorebot authored Aug 28, 2024
1 parent 1e3fa6c commit 2706e8f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/scala/org/pmml4s/xml/pull.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.pmml4s.xml

import javax.xml.stream.events.{Characters, Comment, EndElement, EntityReference, ProcessingInstruction, StartElement}
import javax.xml.stream.events.{Characters, Comment, EndElement, EntityReference, ProcessingInstruction, StartElement, EndDocument}
import javax.xml.stream.{EventFilter, XMLInputFactory, XMLStreamConstants}
import scala.io.Source
import XmlImplicits._
Expand Down Expand Up @@ -74,6 +74,11 @@ case class EvComment(text: String) extends XMLEvent
*/
case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBinding)

/**
* The end of document
*/
case object EvDocEnd extends XMLEvent

/**
* Main entry point into creating an event-based XML parser. Treating this
* as a [[scala.collection.Iterator]] will provide access to the generated events.
Expand Down Expand Up @@ -108,6 +113,7 @@ class XMLEventReader(src: Source)
EvProcInstr(ev.getTarget, ev.getData)
case ev: Comment =>
EvComment(ev.getText)
case ev: EndDocument => EvDocEnd
}
}

Expand Down

0 comments on commit 2706e8f

Please sign in to comment.