+ Reply to Thread
Results 1 to 8 of 8

How to get content from Web with Xpath?

  1. #1
    Registered User
    Join Date
    03-06-2014
    Location
    Center, Eastland
    MS-Off Ver
    Excel 365
    Posts
    15

    How to get content from Web with Xpath?

    I have this macro with which I can search by Xpath if the HTML is simple

    Please Login or Register  to view this content.
    Now, if I want to use the same Xpath but with the source change to an URL, I get the error "DTD is prohibited".

    Why is happening this and how to fix it?

    I can't use 3rd party tool like Selenium since I cannot use or installed exe files due to security policy in company.

    Thanks in advance for any help

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,970

    Re: How to get content from Web with Xpath?

    Administrative Note:

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so. Cross-posts are allowed but you must provide a link to your posts on other sites.

    Please see Forum Rule #7 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    (Note: this requirement is not optional. No help to be offered until you provide a link or, for members with fewer than 10 posts, a comment telling us where else you have posted this query.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-06-2014
    Location
    Center, Eastland
    MS-Off Ver
    Excel 365
    Posts
    15

    Re: How to get content from Web with Xpath?

    Hi AliGW, actually this question is a kind of different and in the other site after one day normally there is almost zero possibilities to get an answer. In that other quesion I didn´t get a solution anyway.
    Last edited by AliGW; 05-16-2024 at 03:13 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  4. #4
    Valued Forum Contributor
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (24 H2) 64 Bit
    Posts
    1,186

    Re: How to get content from Web with Xpath?

    Quote Originally Posted by Severduf View Post
    ......
    Now, if I want to use the same Xpath but with the source change to an URL, I get the error "DTD is prohibited".

    Why is happening this and how to fix it?

    You can overcome that error by setting the below property,

    Please Login or Register  to view this content.
    But, you will probably will get another error on a different line and this will continue ..... As i told you on the other side, it is not a good idea to work with this kind of code on HTML pages as there may be numerous errors in the HTML source such as missing end brackets and so on. But XML parsing requires the loaded XML file to be free of errors.

  5. #5
    Registered User
    Join Date
    03-06-2014
    Location
    Center, Eastland
    MS-Off Ver
    Excel 365
    Posts
    15

    Re: How to get content from Web with Xpath?

    Hi Haluk, thanks for answer. After some research, I've tried that option yesterday and didn´t work either.

    After adding that line I get the new error.

    Please Login or Register  to view this content.
    Additionally, in some sites mentioned that removing the string "<!DOCTYPE html>" from the html could work, but in my case doesn´t work.

    Regards
    Last edited by AliGW; 05-16-2024 at 03:13 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  6. #6
    Valued Forum Contributor
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (24 H2) 64 Bit
    Posts
    1,186

    Re: How to get content from Web with Xpath?

    Well, it is not a surprise to me.....as I told you in my post #4 you will get a new error.

    It is better for you to use some other techniques.

  7. #7
    Registered User
    Join Date
    03-06-2014
    Location
    Center, Eastland
    MS-Off Ver
    Excel 365
    Posts
    15

    Re: How to get content from Web with Xpath?

    Thanks for your help
    Last edited by AliGW; 05-16-2024 at 03:14 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,970

    Re: How to get content from Web with Xpath?

    Quote Originally Posted by Severduf View Post
    Hi AliGW, actually this question is a kind of different and in the other site after one day normally there is almost zero possibilities to get an answer. In that other quesion I didn´t get a solution anyway.
    Doesn't matter - you still need to abide by our rules. Thanks for the links - don't forget if you do this again to include them.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. FilterXML/Xpath
    By cfcMalky in forum Excel General
    Replies: 6
    Last Post: 10-14-2014, 11:02 AM
  2. Import Xml using XPATH
    By cfcMalky in forum Excel General
    Replies: 1
    Last Post: 09-02-2014, 12:49 AM
  3. Web Scrape Using Xpath
    By Keashan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-03-2014, 05:51 AM
  4. Using XPath with ID, not a path
    By derlee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-22-2013, 08:00 AM
  5. XPath.SetValue
    By DevCom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-15-2012, 09:27 AM
  6. Problem with XPath.SetValue
    By sys_daw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2009, 09:24 AM
  7. XML & XPATH in EXCEL
    By raman1111 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-27-2008, 01:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1