Re: Automatic Insertion of Required Elements and Attributes
garbage_goal <clockyg <at> yahoo.com>
2012-07-25 04:30:55 GMT
Alright, I wanted to make sure I didn't go reinventing any wheels. Appreciate your response - thanks!
--- In emacs-nxml-mode <at> yahoogroups.com, Dave Pawson <dave.pawson <at> ...> wrote:
>
> On 20 July 2012 00:57, garbage_goal <clockyg <at> ...> wrote:
>
> >
> >
> > Hi there,
> >
> > I hope I am not posting a previously asked question, but I am not having
> > much luck searching on this topic.
> >
> > I've been a psgml user but want to switch to nxml since psgml broke with
> > Emacs 24. One thing psgml does is automatically add required elements and
> > attributes as you go along.
> >
> > For example, if I were to insert a tag <compact-disc> which requires a
> > "name" attribute and at least one "track" element, psgml would generate and
> > insert the following fragment, placing my cursor between the quotes for the
> > "name" element:
> >
> > <compact-disc name="">
> > <track></track>
> > </compact-disc>
> >
> > Is there any way to make nxml behave similarly? I've found nxml will at
> > least warn me if I am missing a required child element/attribute, but then
> > I have to remember myself which child elements/attributes are required and
> > begin typing them before I can take advantage of auto completion.
> >
> > I'd appreciate it if anyone can point me in the right direction. Is there
> > an existing feature I haven't found yet, a minor mode, perhaps some code I
> > could find on the internet, do I have to write this myself?
> >
> >
> >
> http://dpawson.co.uk/relaxng/nxml/nxml-mode.html is an html version of the
> help file that comes
> with nxml-mode.
>
> Look for schema locating files.
> 1. Convert your schema to relax NG, rnc format.
> 2. Add it to the schema list using one of the methods stated,
> or use the commands to specify the schema for your file.
> 3. Then use (not dissimilar to psgml-mode)
> <
>
> and nxml-mode will show the list of elements valid at that point.
> It will not automatically insert required elements.
> If you want that, it's up to you.
>
> HTH
>
>
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/emacs-nxml-mode/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/emacs-nxml-mode/join
(Yahoo! ID required)
<*> To change settings via email:
emacs-nxml-mode-digest <at> yahoogroups.com
emacs-nxml-mode-fullfeatured <at> yahoogroups.com
<*> To unsubscribe from this group, send an email to:
emacs-nxml-mode-unsubscribe <at> yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/