Skip to content
Browse files

Merge branch 'master' of git://github.com/djspiewak/anti-xml into axes

  • Loading branch information...
2 parents 0229415 + b3b78fe commit 8baba3c748b404527bad868b07731ddd1294d9d0 @ncreep committed Dec 13, 2011
View
6 src/main/scala/com/codecommit/antixml/conversion.scala
@@ -102,13 +102,13 @@ trait XMLConvertable[-A, +B] { // note: doesn't extend Function1 to avoid c
* </ul>
*
* This corresponds with the roughly-intuitive conversion precedence. Thus, if
- * we have a value of type [[scala.xml.Elem]] and we invoke the `anti` method on
+ * we have a value of type [[scala.xml.Elem]] and we invoke the `convert` method on
* that value, the result will be of type [[com.codecommit.antixml.Elem]]. However,
* if we take that same value and ascribe it the type of [[scala.xml.Node]],
- * the `anti` method will return a value of type [[com.codecommit.antixml.Node]].
+ * the `convert` method will return a value of type [[com.codecommit.antixml.Node]].
* Finally, we can take this same value and ascribe it the even less-specific type
* of [[scala.xml.NodeSeq]] (or even [[scala.Seq]]`[`[[scala.xml.Node]]`]`, for
- * that matter). Invoking the `anti` method on this maximally-widened type will
+ * that matter). Invoking the `convert` method on this maximally-widened type will
* produce a value of type [[com.codecommit.antixml.Group]]`[`[[com.codecommit.antixml.Node]]`]`.
* Thus, the most specific conversion is chosen in all cases.
*/
View
6 src/main/scala/com/codecommit/antixml/package.scala
@@ -35,7 +35,7 @@ package com.codecommit
* <ul>
* <li>∀`A` . `A => Converter[A]` – Implements ''explicit'' conversions from
* `scala.xml` types to Anti-XML correspondents (where applicable). This
- * technically makes the `anti` method available on all types. However, that
+ * technically makes the `convert` method available on all types. However, that
* method will only be callable on very specific types in the `scala.xml`
* library, and thus it shouldn't cause any collsion issues.</li>
* <li>`(String, String) => (QName, String)` – Required to get nice syntax for
@@ -48,11 +48,11 @@ package com.codecommit
package object antixml {
/**
- * Pimps the `anti` method onto any object for which there exists a conversion
+ * Pimps the `convert` method onto any object for which there exists a conversion
* into Anti-XML. Note that this conversion is an implicit value, statically
* enforced and thus shouldn't be the source of any collision issues. It should
* actually be possible to have another implicit conversion in scope which
- * pimps the `anti` method without seeing conflicts.
+ * pimps the `convert` method without seeing conflicts.
*
* @see [[com.codecommit.antixml.XMLConvertable]]
*/
View
1,410 src/test/resources/jira-rss-derby-project.xml
1,410 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
12 src/test/scala/com/codecommit/antixml/XMLSpecs.scala
@@ -28,6 +28,8 @@
package com.codecommit.antixml
+import java.util.Scanner
+
import org.specs2.execute.Pending
import org.specs2.mutable._
@@ -63,7 +65,7 @@ class XMLSpecs extends Specification {
val ns = "urn:my-urn:quux";
fromString("<my:test xmlns:my='urn:my-urn:quux'/>") mustEqual Elem(Some("my"), "test", Attributes(), Map("my" -> ns), Group[Node]())
}
-
+
"parse prefixes" in {
fromString("<my:test xmlns:my='urn:my-urn:quux'></my:test>").name mustEqual "test"
}
@@ -83,5 +85,13 @@ class XMLSpecs extends Specification {
}
}
+ "fromString" should {
+ "parse a complex document without stack overflow" in {
+ val stream = getClass.getResourceAsStream("/jira-rss-derby-project.xml")
+ val string = new Scanner(stream, "UTF-8").useDelimiter("\\A").next
+ XML.fromString(string) must not(throwA[StackOverflowError])
+ }
+ }
+
def elem(name: QName, children: Node*) = Elem(name.prefix, name.name, Attributes(), Map(), Group(children: _*))
}

0 comments on commit 8baba3c

Please sign in to comment.
Something went wrong with that request. Please try again.