a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
67 lines
1.3 KiB
C#
67 lines
1.3 KiB
C#
//
|
|
// RelaxngReaderTests.cs
|
|
//
|
|
// Authors:
|
|
// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
|
|
//
|
|
// (C) 2003 Atsushi Enomoto
|
|
//
|
|
|
|
using System;
|
|
using System.IO;
|
|
using System.Xml;
|
|
using Commons.Xml.Relaxng;
|
|
using NUnit.Framework;
|
|
|
|
namespace MonoTests.Commons.Xml.Relaxng
|
|
{
|
|
[TestFixture]
|
|
public class RelaxngReaderTests
|
|
{
|
|
RelaxngReader reader;
|
|
|
|
[SetUp]
|
|
public void SetUp ()
|
|
{
|
|
}
|
|
|
|
private void loadGrammarFromUrl (string url)
|
|
{
|
|
reader = new RelaxngReader (new XmlTextReader (url));
|
|
}
|
|
|
|
[Test]
|
|
public void SimpleRead ()
|
|
{
|
|
loadGrammarFromUrl ("Test/XmlFiles/SimpleElementPattern1.rng");
|
|
RelaxngPattern p = reader.ReadPattern ();
|
|
|
|
Assert.AreEqual (RelaxngPatternType.Element, p.PatternType);
|
|
}
|
|
|
|
[Test]
|
|
public void CompileRelaxngGrammar ()
|
|
{
|
|
loadGrammarFromUrl ("Test/XmlFiles/relaxng.rng");
|
|
RelaxngPattern p = reader.ReadPattern ();
|
|
|
|
Assert.AreEqual (RelaxngPatternType.Grammar, p.PatternType);
|
|
|
|
p.Compile ();
|
|
}
|
|
|
|
[Test]
|
|
public void Bug347945 ()
|
|
{
|
|
string rng = @"
|
|
<element name='x' xmlns='http://relaxng.org/ns/structure/1.0'>
|
|
<interleave>
|
|
<element name='y'><text/></element>
|
|
<element name='z'><text/></element>
|
|
</interleave>
|
|
</element>";
|
|
RelaxngPattern p = RelaxngPattern.Read (new XmlTextReader (rng, XmlNodeType.Document, null));
|
|
}
|
|
}
|
|
}
|