package pull
Classes needed to view an XML document as a series of events. The document is parsed by an scala.xml.pull.XMLEventReader instance. You can treat it as an scala.collection.Iterator to retrieve the events, which are all subclasses of scala.xml.pull.XMLEvent.
scala> val source = Source.fromString("""<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?instruction custom value="customvalue"?> <!DOCTYPE foo [ <!ENTITY bar "BAR"> ]><foo>Hello<bar>&bar;</bar><bar>></bar></foo>""") source: scala.io.Source = non-empty iterator scala> val reader = new XMLEventReader(source) reader: scala.xml.pull.XMLEventReader = non-empty iterator scala> reader.foreach{ println(_) } EvProcInstr(instruction,custom value="customvalue") EvText( ) EvElemStart(null,foo,,) EvText(Hello) EvComment( this is a comment ) EvElemStart(null,bar,,) EvText(BAR) EvElemEnd(null,bar) EvElemStart(null,bar,,) EvEntityRef(gt) EvElemEnd(null,bar) EvElemEnd(null,foo) EvText( )
Type Members
- case class EvComment(text: String) extends XMLEvent with Product with Serializable
A comment was encountered
A comment was encountered
- text
the text of the comment
- case class EvElemEnd(pre: String, label: String) extends XMLEvent with Product with Serializable
An Element's end tag was encountered.
An Element's end tag was encountered.
- pre
prefix, if any, on the element. This is the
xs
in<xs:string>foo</xs:string>
.- label
the name of the element, not including the prefix
- case class EvElemStart(pre: String, label: String, attrs: MetaData, scope: NamespaceBinding) extends XMLEvent with Product with Serializable
An Element's start tag was encountered.
An Element's start tag was encountered.
- pre
prefix, if any, on the element. This is the
xs
in<xs:string>foo</xs:string>
.- label
the name of the element, not including the prefix
- attrs
any attributes on the element
- case class EvEntityRef(entity: String) extends XMLEvent with Product with Serializable
An entity reference was encountered.
An entity reference was encountered.
- entity
the name of the entity, e.g.
gt
when encountering the entity>
- case class EvProcInstr(target: String, text: String) extends XMLEvent with Product with Serializable
A processing instruction was encountered.
A processing instruction was encountered.
- target
the "PITarget" of the processing instruction. For the instruction
<?foo bar="baz"?>
, the target would befoo
- text
the remainder of the instruction. For the instruction
<?foo bar="baz"?>
, the text would bebar="baz"
- case class EvText(text: String) extends XMLEvent with Product with Serializable
A text node was encountered.
A text node was encountered.
- text
the text that was found
- trait ProducerConsumerIterator[T >: Null] extends Iterator[T]
Deprecated Type Members
- trait XMLEvent extends AnyRef
An XML event for pull parsing.
An XML event for pull parsing. All events received during parsing will be one of the subclasses of this trait.
- Annotations
- @deprecated
- Deprecated
(Since version 1.1.1) Consider javax.xml.stream.events.XMLEvent instead.
- class XMLEventReader extends AbstractIterator[XMLEvent] with ProducerConsumerIterator[XMLEvent]
Main entry point into creating an event-based XML parser.
Main entry point into creating an event-based XML parser. Treating this as a scala.collection.Iterator will provide access to the generated events.
- Annotations
- @deprecated
- Deprecated
(Since version 1.1.1) Consider javax.xml.stream.XMLEventReader instead.