> For the complete documentation index, see [llms.txt](https://lagarto.jodd.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lagarto.jodd.org/lagarto-parser/adapter-and-writer.md).

# Adapter and Writer

Besides `TagVisitor`, you can use also one of the following classes.

* `EmptyTagVisitor` - default implementation that does nothing. You will probably use it, as you can override just the methods you need.
* `TagVisitors` - is a simple composite of many `TagVisitor`s implementations. They will be invoked in the given order.
* `TagAdapter` - is an adapter over target `TagVisitor`. With such adapter you can change the behavior of an existing visitor.

### Enclosed adapters

You can use the following adapters:

* `StripHtmlTagAdapter` - strips all the unnecessary whitespaces from text blocks and also removes all the comments. For example, multiple spaces would be replaced with a single space, etc.&#x20;
* `UrlRewriterTagAdapter` - as the name implies, you may change the `<a href` link values.

### Writer

`TagWriter` is a simple `TagVisitor` that *builds* HTML from the events. Usually, you can use it as target of some adapter. This way you can modify input HTML by parsing it, adapt it, and then write it again to an `Appendable` content.

### Example

```java
TagWriter tagWriter = new TagWriter();
StripHtmlTagAdapter adapter = new StripHtmlTagAdapter(tagWriter);
LagartoParser lagartoParser = new LagartoParser(
        "<html> <h1>  Hello  </h1> </html>");

lagartoParser.parse(adapter);

System.out.println(tagWriter.getOutput().toString());
```

The resulting string would be:

```
<html><h1> Hello </h1></html>
```
