-
Notifications
You must be signed in to change notification settings - Fork 92
Home
Aaron S. Hawley edited this page Apr 20, 2017
·
16 revisions
Portada (español) - Početna strana (Bosanski) - 대문 (한국어) - Principal (Português Brasil) - Strona główna (Polski)
-
Introduction
-
Getting started
Scala-xml lets you type in XML as a literal anywhere that an expression is valid. Simply type a start tag and then continue writing XML content. The compiler will go into an XML-input mode and will read content as XML until it sees the end tag matching the start tag you began with:
val book = <book id="b20234">Magic of scala-xml</book>
The result of this expression is of type
Elem
, meaning it is an XML element with a label ("book
").Some other important XML classes are:
-
Node
is the abstract superclass of all XML node classes. -
Text
is a node holding just text. For example, the "stuff" part of<a>stuff</a>
is of classText
. -
NodeSeq
holds a sequence of nodes. Many methods in the XML library processNodeSeq
s in places you might expect them to process individualNode
s. You can still use such methods with individualNode
s, however, sinceNode
extends fromNodeSeq
. This may sound weird, but it works out well for XML. You can think of an individualNode
as a one-elementNodeSeq
.
-
- Introduction
- Getting started
- Coding guidelines
- Review Tips
- Release Plans