Home > Software engineering >  Why is my XPath returning only text without tags?
Why is my XPath returning only text without tags?

Time:03-17

I am using Google Sheets to send an update to my Discord server every time there is an update from a forum site.

However, when I scrape this link,

https://forum.mir4global.com/board/patchnote

using this XPath,

string((//*[@id="viewContent"])[1])

via use IMPORTXML I get this result:

"  We strive to provide a fun and fair gaming experience for all our players. Our team carefully monitors and actively removes players who do not adhere to the Operational Policy and Terms of Use.>> Operational Policy>> Terms of UseWe maintain a zero-tolerance policy against the use of unauthorized programs or software, manipulation or tampering of game data, and intentional exploitation of game systems. To date, we have permanently restricted more than 11,062,000 accounts. [Accounts Banned or Restricted]- Applicable Date: Wednesday, Mar. 16th, 2022- Number of Accounts: 114,952 (Total 11,062,063) - Reason: Use of unauthorized programs & Violation of Operational Policy*If you wish to make an appeal for the restriction imposed onto your account, please submit a support ticket through our official website. (https://cs.mir4global.com/customer)Inquiry Route : Contact Us > Account > Objection of restriction※ Please note that it may take a long time to receive an answer if you don't submit your inquiry ticket through the route above. We will continue to do our best in order to ensure a safe, fair, and fun gaming environment for all our players. "

How can I get the same format like in the forum site?

CodePudding user response:

The whole point of the XPath function, string(), is to return the string-value (just the text without any markup) of the given node.

If you want the markup, remove the wrapping string() function.

  • Related