Reading about regular expression I saw a recurring term, DOM parser, and I had the doubts:
Reading about regular expression I saw a recurring term, DOM parser, and I had the doubts:
Let's start with the parser . It is an algorithm that parses a text by identifying its parts (to tokens ) and checking if everything is constructed as it determines a specified grammar (probably in BNF ). In this specific usage it does parsing an XML document, HTML, etc and generates a DOM for the application to use.
It will do element-by-element analysis of the text and create the tree structure. This is explained a little better in a question about how a compiler works .
The Document Object Model is a large hierarchical object with multiple elements forming a tree.
It is very common to find the DOM associated with in XML and similar languages. It is possible that some compilers of programming languages generate a DOM of the code for their own use, and even make it available to the application to use at runtime. C # does this, but today it has better solutions.
I do not really like the name because it refers to doing parsing of the DOM and actually the DOM is the result that it generates.
Since the parser DOM is software with several specific function components it is not what languages will or will not have, it is a matter of having a library with this function available for that language. If the language manipulates XML, HTML or something, it's almost certain that there is something ready in the standard language library. The quality and extent of each may vary.If the "language" does not have it always possible to use a third-party library.
Do not confuse the DOM with the text itself that generates this template. An HTML is not the DOM, but it is normal to have a direct relationship between them. You can manipulate the DOM without manipulating HTML. Or XML, or JSON (less common), SVG, etc. JavaScript handles the DOM, not HTML directly.
The parser delivers a partial or integral structure in the form of a tree so that the consumer code can do what it wants. In general, the parser library allows you to easily access and even manipulate DOM members.
Some languages, such as JavaScript, can be accessed directly by the DOM because the DOM is eventually incorporated into the code identifiers.
A formal specification is being created for how it should work.