XML Viewer and XML syntax highlighting

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

XML Viewer and XML syntax highlighting

Peter Uhnak
Hi,

do we have some nice(r) XML viewer?

GTInspector provides tree extension, however I find it often worse than looking at the raw contents (mainly because the tree view doesn't break lines)

So my question is: do we have something better?

And second (if we don't have something better):
How would one go about implementing custom syntax highlighting?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: XML Viewer and XML syntax highlighting

monty-3
What's needed is a highlight/styling widget that works with GT that can also be treated like an ordinary write stream. Then you subclass XMLPrettyPrintingWriterFormatter and override the formatting messages to style the stream differently at certain points (like before a start tag, after a start tag). Then change the GT "Source" pane XMLParser method to use "self writeXMLOn: (XMLWriter on: highlightStream formatter: highlightFormatter)".

The one drawback (besides performance) is that XMLWriter formatting support is just before/after tags, comments, and other markup elements. You can't add formatting within a start tag, which would be an issue if you want to style text in attr/xmlns values differently. I could fix this by adding more formatting messages to XMLWriter for before/after string values.

Does anyone (Doru?) have more info on the GT aspects?

Reply | Threaded
Open this post in threaded view
|

Re: XML Viewer and XML syntax highlighting

Tudor Girba-2
Indeed, you need a parser and afterwards you can use the same approach as I used for the styling Pillar in Rubric:

On Fri, Sep 18, 2015 at 12:20 AM, monty <[hidden email]> wrote:
What's needed is a highlight/styling widget that works with GT that can also be treated like an ordinary write stream. Then you subclass XMLPrettyPrintingWriterFormatter and override the formatting messages to style the stream differently at certain points (like before a start tag, after a start tag). Then change the GT "Source" pane XMLParser method to use "self writeXMLOn: (XMLWriter on: highlightStream formatter: highlightFormatter)".

The one drawback (besides performance) is that XMLWriter formatting support is just before/after tags, comments, and other markup elements. You can't add formatting within a start tag, which would be an issue if you want to style text in attr/xmlns values differently. I could fix this by adding more formatting messages to XMLWriter for before/after string values.

Does anyone (Doru?) have more info on the GT aspects?




--

"Every thing has its own flow"