-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Exception in Configuration.AddDocument()
PostPosted: Thu Jun 30, 2005 5:28 pm 
Newbie

Joined: Wed Jun 22, 2005 4:20 pm
Posts: 3
Location: San Jose, CA - USA
I am trying to use the Configuration.AddDocument() method, but I am getting an exception ("ArgumentException: reader"). I am using NHibernate version 0.83.

I started a debug session to step into the NHibernate.Cfg.Configuration source code and found out that the exception is being raised because of this sequence code inside the AddDocument method:

Code:
public Configuration AddDocument(XmlDocument doc)
{
    XmlNodeReader nodeReader = null

    try
    {
        nodeReader = new XmlNodeReader(doc);
        AddXmlReader(nodeReader);
        return this;
    }
    catch(Exception e)
    {
    }
}


The exception is happening inside the AddXmlReader() method, which calls the LoadMappingDocument() method. The first thing this method tries to do is to build a ValidatingReader based on the given XmlReader parameter.

Code:
public LoadMappingDocument(XmlReader hbmReader)
{
    /* This lines raises the exception */
    XmlValidatingReader validatingReader = new XmlValidatingReader(hbmReader);
}


The problem is that XmlValidatingReader only accepts XmlTextReader. Passing a XmlNodeReader instance (as it is happenning in this case) causes the ArgumentException("reader") to be thrown.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.