Questions tagged [domparser]

A DOMParser can parse XML or HTML source stored in a string into a DOM Document.

The DOMParser is specifically used in Javascript to parse XML and HTML sources, however other languages may provide DOMParsers as well. In Javascript the DOMParser is specified in DOM Parsing and Serialization.

543 questions
-1
votes
2 answers

How to disable parsing code in script tags using JavaScript DOMParser?

I have the following text file with JavaScript tags: when I parse it like so: const parser = new DOMParser(); const xmlDoc = parser.parseFromString(`${data}`,…
-1
votes
1 answer

Get list of elements from DomParser

Alright so here is my code:
Gevzzz
  • 7
-1
votes
1 answer

Python make list of items according to a dictionary of key value pairs, but values have to be regex patterns

I am trying to make a wrapper function for the existing itertags one here: https://github.com/streamlink/streamlink/blob/master/src/streamlink/plugin/api/utils.py#L16 Currently i have this: def itertags_wrapper(html, tag, attrs=None, ret=False): …
Twilight0
  • 41
  • 7
-1
votes
1 answer

JS Variable not available outside function

I have a little problem with a variable in my code. I'm having a variable which gets declaired outside the function but then can not be accessed after it. So first you input a file which is combined with this code: input.addEventListener("change",…
E Lon Mask
  • 39
  • 1
  • 8
-1
votes
1 answer

How to get specified attributes from for loop?

I try to get "Value" String which have the largest value of NumVotes. After that I would like do to simple asserion (I know how to do it), but I have problems how to get this "Value". I don't have idea and knowledge about it. public class…
-1
votes
1 answer

How to build a XML from multiple input xmls

I have a scenario where I have to create a master.xml from 500 different XMLs, given the following : -Some structure in start and end is always same. -The is picked up from 500 xmls as it is and added a particular location in master.xml, sample…
Nitika
  • 19
  • 2
-1
votes
1 answer

DOMParser in JavaScript doesn't give the XML elements

I have this XML:
user10664219
-1
votes
1 answer

DOMparser returns this error Undefined property: DOMNodeList::$nodeValue

It's simple question, but I couldn't get the h1 tag's text. DOMparser returns this error. $results = 'http://www.daikyo.co.jp/KOBETSU/MF081014/gaiyo_chg.html?_ga=2.231780890.465420601.1540169716-1978642370.1538226055&_bdld=HYzpv.moBqKE6'; $html =…
user10378098
-1
votes
2 answers

Warning file_get_contents in DOM Parser

My case is, I want to scrap a website, which is success, and I'm using PHP cURL. The problem start when I want to use the DOM Parser to get the content I want. Here is the warning came out: the error image is here And the code I use is here. Before…
bobby I.
  • 101
  • 1
  • 11
-1
votes
2 answers

How to use DocumentBuilder to parse an Xml Document over Socket InputStream without closing the stream?

Is there a way I can parse an Xml Document from a Socket InputStream without closing the stream on the client side? I only have control the the Server side receiving the Xml and the socket will remain open since the server will be sending a response…
xtratic
  • 4,600
  • 2
  • 14
  • 32
-1
votes
1 answer

Invalid argument error when converting an HTML string to a DOM element

I am trying to convert my HTML string to a DOM element but I am getting a script error: Invalid argument. My Internet Explorer version is 9. Please suggest any solution. Below is the code: function open(htmlstring) { var parser = new…
Code_99
  • 43
  • 1
  • 5
-1
votes
3 answers

php dom parser get li palintext

i have html like this:
  • TEXT <---- GET THIS TEXT
    • a
    • aa
  • I want to get "TEXT" in li element, but then i try get li element I get all elements... This is my code: $html =…
    Vykintas
    • 401
    • 1
    • 8
    • 23
    -1
    votes
    1 answer

    PHP Why is my code not entering the foreach loop on line 20? The file_get_contents() doesnt seem to be working

    This screenshot shows that the URL is getting stored in $url This screenshots shows that after I add echo $html to the code, it says undefined variable $url and file_get_contents(): filename cannot be empty Also, I have tried almost everything…
    -1
    votes
    1 answer

    Iterate over XML tag using java

    Hi I have one XML file which contains following form of tags Yes No other what I need to do with is, I need iterate over these tags and get the values. I am using DOM parser…
    Roshan Yengul
    • 21
    • 1
    • 7
    -1
    votes
    2 answers

    Search and replace a string of HTML using the PHP DOM Parser

    How can I search and replace a specific string (text + html tags) in a web page using the native PHP DOM Parser? For example, search for

    Check this site

    This string is somewhere inside inside an html tree. I…
    user3857924
    • 86
    • 3
    • 15