Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XmlException on var w = new Wiki(...) #16

Open
MarcBra opened this issue Dec 1, 2016 · 2 comments
Open

XmlException on var w = new Wiki(...) #16

MarcBra opened this issue Dec 1, 2016 · 2 comments

Comments

@MarcBra
Copy link

MarcBra commented Dec 1, 2016

Hello,

I get an exception when calling the constructor of the Wiki class on wikipedia. The code worked fine a couple of months ago and hasn't been changed since. Can you give me a hint on what's going on? Thank you very much for your great work!!

Marc

var wiki = new Wiki("...", "en.wikipedia.org");

Throws a XmlException:

"'en' is an unexpected token. The expected token is '"' or '''. Line 2, position 12."

at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options)
at LinqToWiki.Download.Downloader.Download(IEnumerable1 parameters) in c:\code\LinqToWiki\LinqToWiki.Core\Download\Downloader.cs:line 74 at LinqToWiki.Internals.QueryProcessor.Download(WikiInfo wiki, IEnumerable1 processedParameters, IEnumerable1 queryContinues) in c:\code\LinqToWiki\LinqToWiki.Core\Internals\QueryProcessor.cs:line 156 at LinqToWiki.Internals.QueryProcessor1.ExecuteSingle[TResult](QueryParameters2 parameters) in c:\code\LinqToWiki\LinqToWiki.Core\Internals\QueryProcessor.cs:line 76 at LinqToWiki.Internals.NamespaceInfo.GetNamespaces(WikiInfo wiki) in c:\code\LinqToWiki\LinqToWiki.Core\Internals\NamespaceInfo.cs:line 38 at LinqToWiki.Internals.WikiInfo..ctor(String userAgent, String baseUrl, String apiPath, IEnumerable1 namespaces) in c:\code\LinqToWiki\LinqToWiki.Core\Internals\WikiInfo.cs:line 70
at LinqToWiki.Generated.Wiki..ctor(String userAgent, String baseUri, String apiPath) in c:\Users\Svick\AppData\Local\Temp\LinqToWiki\Wiki.cs:line 32

@tapan-p
Copy link

tapan-p commented Nov 14, 2017

Same exception upon running the sample application.

System.Xml.XmlException occurred HResult=0x80131940 Message='en' is an unexpected token. The expected token is '"' or '''. Line 2, position 12. Source=System.Xml

@tapan-p
Copy link

tapan-p commented Nov 15, 2017

After little bit of try & error approach, I was able to fix the issue. Correct way to get connected is as below.

var wiki = new Wiki("LinqToWiki.Samples", "https://en.wikipedia.org", "https://en.wikipedia.org/w/api.php");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants