Ticket #275 (new enhancement)

Opened 4 years ago

please convert comments in xml file to *COMMENT* sxml nodes

Reported by: friedel@… Owned by: lizorkin
Priority: minor Milestone:
Component: lizorkin/ssax.plt Keywords:
Cc: Version: (2 0)
Racket Version: 300

Description

I've been trying to get an sxml view of an xml document including comments and tried with

(require (planet lizorkin/sxml:2:1/sxml))
(sxml:document "my_doc.xml")

(in mzscheme)

I noticed however that sxml drops the comments and also shifts the order of attributes around, if I do it this way.

I'd like to use sxml as a format for editing xml files, since it's a little less markup-heavy than xml, but I'd need to keep the comments and order of attributes (I put the most important attribute to the front, to make it stand out). The plain xml format needs to be the master format, since people who never heard of s-expressions are going to have to edit those files.

I started diving into the source, but failed to see an obvious way to change that behaviour yet. SSAX-code.ss is impossible to read, so I had to download SSAX.scm from sourceforge. It looks like comments could be handled by a function similar to ssax:read-cdata-body.

I appreciate if you could help me out with this, maybe add one or two optional parameters to sxml:document to convert comments into sxml comments and maintain the order of attributes.

Note: See TracTickets for help on using tickets.