[Mono-list] Problems using RelaxngValidatingReader (c#)
Atsushi Eno
atsushieno at veritas-vos-liberabit.com
Thu Oct 23 15:14:25 UTC 2014
Hello,
An <element> has to contain one ore more pattern,
https://www.oasis-open.org/committees/relax-ng/spec.html#full-syntax
which is missing in your <element name='book'></element>.
Specify <empty/> there.
Atsushi Eno
On 2014年10月21日 15:15, Jesper Lund Stocholm wrote:
> I am trying to use the RelaxngValidatingReader (located at mcs/class/Commons.Xml.Relaxng/ ) but I am getting errors that I cannot understand.
>
> (if this is the wrong list, please let me know the correct one - I couldn't find a better match)
>
> I have made a simple C# console application in Visual Studio - I am using sample data from the Relax NG book by Eric van der Vlist)
>
> My code is this:
>
> var rngPattern = Encoding.UTF8.GetBytes(
>
> @"
> <element name='library' xmlns='http://relaxng.org/ns/structure/1.0'>
> <oneOrMore>
> <element name='book'></element>
> </oneOrMore>
> </element>"
> );
>
> var stream = new MemoryStream(rngPattern);
>
> stream.Position = 0;
> var xmlReader = XmlReader.Create(stream);
> var pattern0 = RelaxngPattern.Read(xmlReader);
>
> My Xml is this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <library xmlns="http://tempuri.org">
> <book id="b0836217462" available="true">
> <isbn>37474739292</isbn>
> <title xml:lang="en">Being a Dog Is a Full-Time Job</title>
> <author id="CMS"></author>
> <character id="PP"></character>
> <character id="Snoopy"></character>
> <character id="Schroeder"></character>
> <character id="Lucy"></character>
> </book>
> </library>
>
> But whenever I get to the last line in my code, an exception is thrown :
>
> Commons.Xml.Relaxng.RelaxngException: RELAX NG pattern did not appear.
>
>
> Can you help me closer to the cause of this? Is it a namespace issue?
>
>
>
>
> Med venlig hilsen / Best regards
>
> Jesper Lund Stocholm
> mailto:jesper.stocholm at ciber.com
> www.ciber.com
>
>
>
>
>
>
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>
More information about the Mono-list
mailing list