Search⌘ K
AI Features

Analyzing Fragmented HTML Documents

Explore how to analyze fragmented HTML documents within Laravel by identifying the context of HTML elements. Learn to distinguish positions inside fragments, attributes, parameters, and tag names. This lesson teaches you to implement the FragmentsPositionAnalyzer to resolve locations in source documents, enhancing your ability to work with complex HTML parsing in Laravel.

Implementing the FragmentsPositionAnalyzer class

We can see our fragments parser provides an immense amount of information about our source document. Importantly, our results have avoided potentially problematic areas of our input document by skipping over the results of other parsers.

We can bring all this information together to begin asking interesting questions about where those skipped regions appear in our document.

For instance, if we wanted to write a code formatter that formatted our embedded languages and our HTML structure, we’d want to know ...