Random photo
Loading...
Domains for sale
|
April 20, 2004Daniel solved in-memory XML validation problemI like these things. Looks like Daniel solved the famous in-memory XML document validation problem (which I thought is unsolvable!) with XPathNavigatorReader.
You can validate against XML Schemas that only define the node where you're standing. The following code validates all expensive books with a narrow schema, instead of a full-blown Pubs schema:
That's great deal cool. The core problem with XmlValidatingReader is that it requires input to be XmlTextReader and moreover, it calls internal XmlTextReader members. Here is the trick (or hack, whatever): derive from XmlTextReader and cheat the constructor:
public class XPathNavigatorReader : XmlTextReader
{
public XPathNavigatorReader(XPathNavigator navigator) :
base(new StringReader(String.Empty))
...
And then override XmlTextReader methods (as Daniel did, reading XPathNavigator instead).What I was thinking about? How could I miss such easy solution? :( Congrats, Daniel! The best XML.NET hacker hat is yours :) XPathNavigatorReader is a part of the Mvp.Xml project. I'm going to move the rest of my XML Bestary to the project, test it and then I believe we can step in with the first public release of the Mvp.Xml library, there is enough beef to think about practical usage, not just prototyping. April 20, 2004 5:17 PM
|
Comments
Great news Oleg! I was hoping exactly this move: get all your cool XML bestiary into the project :D Post a comment
Listed below are links to weblogs that reference this post:
Hardcore XML blog from ISerializable
Configuration with XmlSerializer codegen (i.e. xsd.exe): how from
Configuration with XmlSerializer codegen (i.e. xsd.exe): how from
Configuration with XmlSerializer codegen (i.e. xsd.exe): how from |