domparser Questions

2

I want manipulate an html string, in vanillaJS I would do it something like this: let HTMLString = '<p>hello</p> <style> p{ color:black } <p>world</p> ' const...
Weak asked 10/6, 2021 at 5:26

4

Solved

Trying to use Dom-Parser with Discord.js. Couldn't find help from any where else. Error on line 15 fs.readFile I also had a lot problems getting fs working. First it wasn't defined then it could no...
Repeated asked 7/1, 2021 at 13:28

3

If you look at the example of DOMParser from MDN: var parser = new DOMParser(); var doc = parser.parseFromString(stringContainingXMLSource, "application/xml"); // returns a Document, but not a SVG...
Anderton asked 11/10, 2016 at 12:41

8

Is there a way to do a wildcard element name match using querySelector or querySelectorAll? The XML document I'm trying to parse is basically a flat list of properties I need to find elements that...
Tiphani asked 3/1, 2012 at 14:54

2

Solved

I am writing a user script that runs on https://example.net and makes fetch requests for HTML documents from https://example.com that I want to parse into HTML DOM trees. The fetch API only gives m...
Potassium asked 26/3, 2023 at 11:23

2

(note: There are many questions on video not rendering on safari. This question is about rendering video using DOMParser in Safari. Everything works fine if I user innerHTML to render the video.) ...
Gensler asked 4/10, 2019 at 17:19

2

Solved

When using DOMParser, <video> tag is not working in Safari, its preview is rendered but without controls and without the ability to play: const parser = new DOMParser() const parsed = par...
Millinery asked 28/9, 2022 at 13:55

8

Solved

From a string that contains a lot of HTML, how can I extract all the text from <h1><h2>etc tags into a new variable? I would like to capture all of the text from these elements and sto...
Hatpin asked 14/1, 2010 at 14:31

3

I'm running into some trouble with the DOMParser. I'm using intelliJ IDE and writing in Typescript. Here is my code: public domparser = new DOMParser(); this.domdoc = this.domparser.parseFromSt...
Despicable asked 13/12, 2017 at 21:37

6

Solved

I am trying to add line break after my comments above the root node in XML document. I need something like this: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!--DO NOT EDIT TH...
Barthol asked 3/7, 2014 at 11:2

2

I have a large amount of html clipboard data from Excel, about 250MB (though it contains a lot of formatting, so when actually pasting it in, the data is much, much smaller than that). Currently I ...
Pleistocene asked 15/3, 2021 at 20:18

2

Solved

I am using the DOMParser in my code as such: html`${this.domParser.parseFromString(this.richText, 'text/html').body.children}` After reading the documentation i became a bit worried that Cross si...
Nighthawk asked 10/11, 2020 at 15:57

2

Solved

The code var txt = '<div id="hi">fe</div><div id="h2">fe</div><div id="hj">fe</div>' var parser = new DOMParser(); var temp_node = parser.parseFromString(txt, "...
Pained asked 28/8, 2015 at 22:45

3

Solved

I'm attempting to parse a string into a full HTML document via DOMParser and then overwrite the current page with the processed nodes. The string contains complete markup, including the <!doctyp...
Carbonari asked 8/4, 2014 at 18:57

3

Solved

I am using the following code to parse a string into DOM: var doc = new DOMParser().parseFromString(string, 'text/xml'); Where string is something like <!DOCTYPE html><html><head&gt...
Jamikajamil asked 12/2, 2012 at 16:43

1

Solved

I've got an HTML string e.g. '<p><span class="text">Hello World!</span></p>' I parse this HTML string to DOM using DOMParser().parseFromString(), because I want to change t...
Graphics asked 17/7, 2019 at 11:27

7

Solved

I have the following html: <html> <body> bla bla bla bla <div id="myDiv"> more text <div id="anotherDiv"> And even more text </div> </div> bla bla bl...
Erse asked 22/7, 2010 at 11:56

2

Solved

Using org.xml.sax.helpers.DefaultHandler, can you determine whether you're at a leaf node within endElement(String, String, String)? Or do you need to use a DOM parser to determine this?
Episode asked 12/4, 2019 at 20:11

1

Solved

// html data loaded from [http://example.org/some/path] let htmlSource = `<!DOCTYPE html><html><head></head><body> ... <a href="relative"></a> ... </b...
Earwax asked 19/3, 2019 at 0:58

1

Solved

I came across some strange behaviour when using the DomParser. It appears that if the first element is a TEMPLATE, it's ignored. See the output of below: printTags('<template></templ...
Microdot asked 13/3, 2019 at 6:30

1

I want to prettify some XML, and I found following code (in this answer, JSFiddle). I modified it like this: const xsltDoc = new DOMParser().parseFromString([ // describes how we want to modify t...
Laugh asked 23/8, 2018 at 15:57

1

I'm using a KML plugin for leaflet that works great in Google Chrome. In IE, however, It throws an error at the following code. parser=new DOMParser(); console.log(url) // outputs: "path/to/kmlfil...
Feminacy asked 7/7, 2015 at 18:55

2

I have a little testcase over at: http://jsfiddle.net/9xwUx/1/ The code boils down to the following (given a node with id "target"): var string = '<div class="makeitpink">this should be pi...
Memoried asked 6/3, 2013 at 10:43

7

Solved

I read some articles about the XML parsers and came across SAX and DOM. SAX is event-based and DOM is tree model -- I don't understand the differences between these concepts. From what I have un...
Kriskrischer asked 26/7, 2011 at 10:33

3

Solved

I am simply trying to parse and append a JavaScript string as a DOM element. I have found two quick ways to do this, one of which is using DOMParser as seen in this popular SO answer. Both methods ...
Economize asked 12/7, 2016 at 17:56

© 2022 - 2025 — McMap. All rights reserved.