Skip to content

Drop dtd.ElementValidator #388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform)
exclude[MissingClassProblem]("scala.xml.dtd.Scanner"),
exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser$"),
exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser"),
exclude[MissingClassProblem]("scala.xml.dtd.ElementValidator"),
exclude[MissingClassProblem]("scala.xml.dtd.ElementValidator"),
exclude[MissingClassProblem]("scala.xml.factory.Binder"),
exclude[MissingClassProblem]("scala.xml.parsing.ValidatingMarkupHandler"),
exclude[MissingClassProblem]("scala.xml.persistent.CachedFileStorage"),
Expand Down
135 changes: 0 additions & 135 deletions shared/src/main/scala/scala/xml/dtd/ElementValidator.scala

This file was deleted.

51 changes: 0 additions & 51 deletions shared/src/test/scala/scala/xml/XMLTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -176,57 +176,6 @@ class XMLTest {
assertEquals(expected, actual)
}

@UnitTest
def validationOfElements: Unit = {
val vtor = new scala.xml.dtd.ElementValidator();
{
import scala.xml.dtd.ELEMENTS
import scala.xml.dtd.ContentModel._
vtor.setContentModel(
ELEMENTS(
Sequ(
Letter(ElemName("bar")),
Star(Letter(ElemName("baz"))))));
}
assertTrue(vtor(<foo><bar/><baz/><baz/></foo>))

{
import scala.xml.dtd.MIXED
import scala.xml.dtd.ContentModel._

vtor.setContentModel(
MIXED(
Alt(Letter(ElemName("bar")),
Letter(ElemName("baz")),
Letter(ElemName("bal")))));
}

assertTrue(vtor(<foo><bar/><baz/><baz/></foo>))
assertTrue(vtor(<foo>ab<bar/>cd<baz/>ed<baz/>gh</foo>))
assertFalse(vtor(<foo> <ugha/> <bugha/> </foo>))
}

def validationfOfAttributes: Unit = {
val vtor = new scala.xml.dtd.ElementValidator();
vtor.setContentModel(null)
vtor.setMetaData(List())
assertFalse(vtor(<foo bar="hello"/>))

{
import scala.xml.dtd._
vtor setMetaData List(AttrDecl("bar", "CDATA", IMPLIED))
}
assertFalse(vtor(<foo href="http://foo.com" bar="hello"/>))
assertTrue(vtor(<foo bar="hello"/>))

{
import scala.xml.dtd._
vtor.setMetaData(List(AttrDecl("bar", "CDATA", REQUIRED)))
}
assertFalse(vtor(<foo href="http://foo.com"/>))
assertTrue(vtor(<foo bar="http://foo.com"/>))
}

def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem =
scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*)

Expand Down