[Mono-list] Problems using RelaxngValidatingReader (c#)
    Jesper Lund Stocholm 
    Jesper.LundStocholm at ciber.dk
       
    Tue Oct 21 07:15:46 UTC 2014
    
    
  
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 
 
  
    
    
More information about the Mono-list
mailing list