Question: I have a String that contains XML, with no line feeds or indentations. I would like to turn it into a String with nice formatting plus syntax highlight. I don't want to use a web framework or web browser for such a simple thing. How do I do this?

```
| unformattedXml formattedXml |
unformattedXml := '<tag><nested>hello</nested></tag>'.
formattedXml := UnknownClass new format: unformattedXml.

```

Note: My input is a String. My output is a String.

Answer: 
To pretty print your xml string you can use the following 

```
xmlString := '<a><b><c></c></b></a>'.
xml := XMLDOMParser parseDocumentFrom: xmlString.
^ String streamContents: [:stream|
    xml prettyPrintOn: stream ]

```

That should give you

```
<a>
    <b>
        <c />
    </b>
</a>

```

I don't know what would be the best option for syntax highlighting
Take a look at the XML packages on [squeaksource.com](http://squeaksource.com), [ss3.gemstone.com](http://ss3.gemstone.com) and [smalltalkhub.com](http://smalltalkhub.com). There's bound to be something suitable for pretty printing. 

Syntax highlighting is a different story since it depends on the medium you want to print on. What is your goal? You say that you don't want to use a web browser so I can only assume you want syntax highlighting in the Smalltalk environment? If so, you might have to resort to [PetitParser](http://www.moosetechnology.org/tools/petitparser) and possibly write your own parser (you probably don't want to do that). Maybe you could give us some more details about what you are trying to accomplish?