locked
xml.load for W8 Store App

    Question

  • I have been looking for a while for a solution to my Problem I want to Port my WP Code to W8 and I use the HtmlAgilityPack in WP I found out that in W8 the Single Node Function is not Supported so I tried to find a W8 solution I go so far that I have the following Code:

    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.LoadXml(parseString);
    
    string Menue = xmlDoc.SelectSingleNode("//*[@id=\"" + ID + "\"]").InnerText.ToString();

    I get a Error Message since parseString is not a valid xml. I would like to use Load instead of LoadXml but it is also not supported is there another solution the using Regex?

    I am using Regex right now and it is Painful to greater and adjust each time the page I pull my data from changes something and also less reliable.

    This is what the Code I am pulling my Data from looks like:

    <td id="montag_menu1">Gemüsequiche</td>
    </tr>
    <tr>
    <td><strong>Menü II</strong></td>
    </tr>
    <tr>
    <td id="montag_menu2">Schweinegulasch "Jägerart" </td>
    

    Thanks for your Help in Advance and I apologize for any mistakes I made, let me know if you need more code/ Info in order to Help.

    Sunday, February 16, 2014 5:41 PM

All replies

  • this piece of html isnt valid xml because it has multiple root elements. wrap something around it like <html> then it will work for example:

    <html>
    <td id="montag_menu1">Gemüsequiche</td>
    </tr>
    <tr>
    <td><strong>Menü II</strong></td>
    </tr>
    <tr>
    <td id="montag_menu2">Schweinegulasch "Jägerart" </td>
    </html>


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Sunday, February 16, 2014 8:02 PM
  • Thank you for your Input. It is only a Code snipped. The xml is not following the Standarts that's why I get this Error: HRESULT: 0xC00CE584 . Is there a way I can make the non Standard conform xml Standard conform? Error: HRESULT: 0xC00CE584 seems to be caused by not correct escaped & and <.

     I hoped there been a solution to get around the limitations caused by .load() not being supported.

    Sunday, February 16, 2014 9:52 PM
  • Hi,

    what scenario do you want to achieve? Do you want to get some content(like ID) in a html file. If so, there is no direct way in windows store app can parse html. But you can use a WebView to load the html content and then inject javascript into a WebView page to get the html content.You can refer to the link below to know Ten Things You Need to Know About WebView in the blog, you can know How to invoke Javascript inside the displayed webpage of a Webview and How to inject javascript into a WebView page

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Friday, February 21, 2014 8:07 AM
  • upload an sample project that contains the html and some of your code i will make it work then

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Friday, February 21, 2014 8:29 AM
  • Yes I want to get some Content by ID. I am using WebRequest and Regular Expressions so far and Hoped for a more reliable solution.
    Friday, February 21, 2014 10:07 AM