Showing posts with label nxml-mode. Show all posts
Showing posts with label nxml-mode. Show all posts

Wednesday, August 10, 2011

nXML mode – James Clark's page (i.e. the author's)

nXML mode

nXML mode : use describe-mode within emacs

That's the nicest and briefest description, that I know.
What a pity, that I haven't been able to find it online so far.

But here it is:


nXML mode:
Major mode for editing XML.

Syntax highlighting is performed unless the variable `nxml-syntax-highlight-flag' is nil.

C-c C-f finishes the current element by inserting an end-tag.
C-c C-i closes a start-tag with `>' and then inserts a balancing end-tag leaving point between the start-tag and end-tag.
C-c C-b is similar but for block rather than inline elements: the start-tag, point, and end-tag are all left on separate lines.
If `nxml-slash-auto-complete-flag' is non-nil, then inserting a `

<C-return> performs completion on the symbol preceding point.

C-c C-d uses the contents of the current buffer to choose a tag to put around the word preceding point.

Sections of the document can be displayed in outline form.  The variable `nxml-section-element-name-regexp' controls when an element is recognized as a section.  The same key sequences that change visibility in outline mode are used except that they start with C-c C-o instead of C-c.

Validation is provided by the related minor-mode `rng-validate-mode'. This also makes completion schema- and context- sensitive.  Element names, attribute names, attribute values and namespace URIs can all be
completed. By default, `rng-validate-mode' is automatically enabled by `rng-nxml-mode-init' which is normally added to `nxml-mode-hook'. You can toggle it using C-c C-v.

TAB indents the current line appropriately. This can be customized using the variable `nxml-child-indent' and the variable `nxml-attribute-indent'.

C-c C-u inserts a character reference using the character's name (by default, the Unicode name). C-u C-c C-u inserts the character directly.

The Emacs commands that normally operate on balanced expressions will operate on XML markup items.  Thus C-M-f will move forward across one markup item; C-M-b will move backward across one markup item; C-M-k will kill the following markup item; C-M-@ will mark the following markup item.  By default, each tag each treated as a single markup item; to make the complete element be treated as a single markup item, set the variable `nxml-sexp-element-flag' to t.  For more details, see the function `nxml-forward-balanced-item'.

C-M-u and C-M-d move up and down the element structure.

Many aspects this mode can be customized using M-x customize-group nxml RET.

EmacsWiki: Nxml Mode Schemas

EmacsWiki: Nxml Mode Schemas

EmacsWiki: Using Nxml Mode With DocBook

EmacsWiki: Using Nxml Mode With DocBook

"nXML Mode" alias nxml-mode, an Emacs major mode for editing XML with RELAX NG support



  • HTML - with one web page per node
  • HTML - entirely on one web page
  • the page above those two

Thursday, December 9, 2010

editing JRXML in emacs using nxml-mode

Just created an RELAG-NG ("compact") grammar for editing JRXML files.

I used trang for that, and the "input module" was a sample JRXML file. Yes, that means: occasionally some JRXML file will have tags or attributes, that my jasperreport.rnc does not know yet. But then re-running trang on an additional sample file is not really a big job.

I really love editing XML.

I re-ordered and "grouped" the XML pieces for the elements in my sample reports. That helps to clean up some things, that got a little messy over the time. In the end you recognize, how much duplicate code you have.

You may want to fight the redundancy problems through JRXML subreports.
I actually made my JRXML a "here document" for a shell script. A couple of hours later I knew, that a perl script is the better approach. Another couple of hours later there were plenty little parameterized "here documents". I have solved my redundancy problem here through "looping over lists of configurations".

Monday, July 26, 2010

mind mapping using Free Mind and emacs and its nXML-mode

I got my quick introduction to Free Mind by son#1 (13yrs) today. Of course I am a stressful student. Of course he is not an advanced user. But we are doing well together.

We didn't manage to get a cloud removed other then by undo. And of course you don't want to make use of undo, if the doing happing an eternity ago.

As expected Free Mind's file format is XML in its very own dialect.

So removing the cloud within the XML was an obvious option. Trang helped me to derive a RELAX-NG grammar from the example. The  compact version of that grammar for use with nXML-mode is not perfect, but improving it doesn't look difficult.

The first thing to do in emacs was obviously tidying the indentation. It was then, that the grammar showed, how imperfect it is. But easy to fix. And it was trival to remove the cloud.

Saturday, July 17, 2010

editing XML documents in emacs using nxml-mode / cont'd

I was suffering for many weeks now with emacs on Snow Leopard, as I had forgotten that nice customizable variable nxml-sexp-element-flag. Setting that one to t (Lisp, yes!!!) really gives XML editing a boost. Now you can "move" forwards and backwards beyond entire tags enclosing huge amounts of text. I had been too lazy digging into that thing the first time, I noticed XML editing on my Snow Leopard MacBook is harder than on my openSUSE Linux ASUS notebook. I do confess that. Being lazy is always bad.

Saturday, July 10, 2010

editing XML documents in emacs using nxml-mode

One good reason for not not authoring in XML is not having a suitable editor or IDE. I personally use and recommend emacs and James Clark's nxml-modeI create and modify all sorts of XML documents this way. If you supply nxml-mode with the right schema for your document, nxml-mode can even help you with tag completion and document validation. nxml-mode makes use of schemas in RELAX-NG, co-created by James Clark. RELAX-NG schemas are rather easily created, if not yet just available, as for DocBook, DocBook Website, DocBook Slides, and many, many other XMLs.

"Trang" is your tool for creating a RELAX-NG schema:
  • if you want to convert a DTD into a RELAX-NG schema,
  • if you want to derive a RELAX-NG schema from a couple of XML files of a specific kind,
I have done that a dozen times, it does work.

Here you find nxml-mode's manual page.

Your mileage may vary …

DocBook Slides


  • If you really are into XML,
  • if you even write your documents in XML ie. DocBook,
  • then you will love DocBook Slides
The Slides Document Type is an XML vocabulary derived from DocBook. It is used to create presentations (slides, foils, whatever you call them) in HTML or print.
Presentations are by nature visual and the Slides stylesheets provide a wide range of options to control how the transformation from XML to HTML is performed.


One good reason for not not authoring in XML is not having a suitable editor or IDE.
I personally use and recommend emacs together with James Clark's nxml-mode. Your mileage may vary though …

Tuesday, January 29, 2008

my brand-new EEE-PC

A little late (but better later than never) I got myself an EEE-PC.
First and important thing to do was to tell it to talk to me in english, because I hate it, when computers talk to me in denglish (as this awful modern mixture of german and english is called, and yes, of course, I use it myself in spoken language and I hate it, but at least for written language I insist on avoiding it), so how to modify the default locale? And pls don't you just modifiy /etc/default/locale!

$ sudo update-locale LANG=en_US.UTF-8
    

I found wiki.eeeuser.com and forum.eeeuser.com, most valuable!!! Really!!! Go to the wiki and make the best of it!!!

I added a few Xandros package repositories, that got listed there.

I found two package managers: synaptic (GUI!!!) and aptitude (ncurses based), obviously you will always have to call them through sudo.

Sometimes you will nevertheless want to install a package on the command line, this is how it looks:

$ sudo apt-get install YOUR_PACKAGE
    

These were a few of the packages I installed first this way: openssh-server, nxml-mode, rcs.

Actually the init script, that got installed with the openssh-server package is somehow flawed:

$ sudo /etc/init.d/ssh # it crashes and core dumps (almost)
    

So I have to run this instead for being able to access my EEE from my network:

$ sudo /usr/sbin/sshd
    

I certainly also installed GNU emacs, but I did so using one of the package managers.

I tried the descriptions for using bluetooth, and it looks like it works, but when I tried to connect to the Internet via bluetooth and one of my UMTS phones as modem, it didn't work. But I successfully connected to the Internet, when I USB-wired that UMTS phone to the EEE.

The EEE-PC seriously comes with an up-to-date and updatable Firefox, and I installed Adblock Plus (and its most important filter subscriptions, so all the obnoxious ads stay away from my screen), Sage (my RSS reader), and GMarks (so I can access Google bookmarks).

Initially the Music Manager refused to play my MP3-s, but I installed a few MP3-related packages through synaptic and everything was fine. Now I can play my MP3-s (that reside on a fat USB disk attached to my Linux NEO box) through my home WLAN, and I overly enjoy it.

Of course I switched to the Full Desktop aka Advanced Mode in the meantime.

I followed the Multiuser mode HOWTO, and now I have to login before X starts up, and user is not the only user any longer.

Friday, January 18, 2008

my favourite RSS reader: SAGE within Firefox

I remember, I haven't told you yet, how I read my RSS subscriptions. I am using SAGE.
It has an XML based exchange format called OPML, which is actually just a format for listing outlines of books, articles, whatever, and apart from the SAGE aspect: I love to edit OPML in emacs's nxml mode. Let me know, if you are interested in the RELAX NG grammar, that I created for that purpose.
The major advantage of being integrated into a web browser is, that the RSS subscriptions come as a standard live bookmark tree and URLs are opened nicely in web browser tabs. Of course, all the articles you already visited are displayed no longer in bold, so you won't revisit them unknowingly.