Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Commit

Permalink
Slight code reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
djspiewak committed Oct 1, 2011
1 parent 00eb7cf commit 603e8d7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/scala/com/codecommit/antixml/node.scala
Expand Up @@ -29,6 +29,7 @@
package com.codecommit.antixml

import java.io.Writer

/**
* Root of the `Node` ADT, representing the different types of supported XML
* nodes which may appear in an XML fragment. The ADT itself has the following
Expand Down Expand Up @@ -66,6 +67,11 @@ import java.io.Writer
sealed trait Node

private[antixml] object Node {

/* http://www.w3.org/TR/xml/#NT-Char */
// TODO we are missing codepoints \u10000-\u10FFFF (i.e. those above 16 bits) here
val CharRegex = "(\u0009|\u000A|\u000D|[\u0020-\uD7FF]|[\uE000-\uFFFD])*"r

// TODO we should probably find a way to propagate custom entities from DTDs
/* http://www.w3.org/TR/xml/#NT-CharData */
def escapeText(text: String) = text flatMap {
Expand All @@ -76,7 +82,7 @@ private[antixml] object Node {
}

/* http://www.w3.org/TR/xml/#NT-AttValue */
def quoteAttribute(value: String) =
def quoteAttribute(value: String) = {
if (value.contains("\"")) {
"'" + (value flatMap {
case '&' => "&"
Expand All @@ -92,11 +98,7 @@ private[antixml] object Node {
case c => List(c)
}) + "\""
}

/* http://www.w3.org/TR/xml/#NT-Char */
// TODO we are missing codepoints \u10000-\u10FFFF (i.e. those above 16 bits) here
val CharRegex = "(\u0009|\u000A|\u000D|[\u0020-\uD7FF]|[\uE000-\uFFFD])*"r

}
}

/**
Expand Down

0 comments on commit 603e8d7

Please sign in to comment.