| バージョン | 0.7.1 |
| オリジナルサイト | http://www.mulberrytech.com/tdtd/ |
| 環境 | Windows 2000/XP, Cygwin, Meadow 1.14 (Emacs 20) |
| 前提 |
|
cd c:/usr1/pub mkdir tdtd-0.7.1 cd tdtd-0.7.1 unzip c:/usr1/home/ftp/pub/lang/sgml/tdtd.zip
cat >C:/tmp/build.el <<EOF (setq load-path (cons "." load-path)) (defun tdtd-build () (mapcar (function (lambda (x) (byte-compile-file x))) (list `ls -1 *.el | sed 's/.*/\"&\"/g'`))) EOF /usr/local/bin/emacs -batch -q -no-site-file -l C:/tmp/build.el -f tdtd-build
mkdir /usr/local/share/emacs/site-lisp/tdtd install -c -m 644 *.el* /usr/local/share/emacs/site-lisp/tdtd
;;
;; DTD
;;
;; DTD mode
(setq load-path
(cons "c:/cygwin/usr/local/share/emacs/site-lisp/tdtd/" load-path))
(autoload 'dtd-mode "tdtd" "Major mode for SGML and XML DTDs." t)
(autoload 'dtd-etags "tdtd"
"Execute etags on FILESPEC and match on DTD-specific regular expressions."
t)
(autoload 'dtd-grep "tdtd" "Grep for PATTERN in files matching FILESPEC." t)
;; Turn on font lock when in DTD mode
(add-hook 'dtd-mode-hooks
'turn-on-font-lock)
(setq auto-mode-alist
(append
(list
'("\\.dcl$" . dtd-mode)
'("\\.dec$" . dtd-mode)
'("\\.dtd$" . dtd-mode)
'("\\.ele$" . dtd-mode)
'("\\.ent$" . dtd-mode)
'("\\.mod$" . dtd-mode))
auto-mode-alist))
以下では、例としてURLリストを保持するXML DTDを作成します。 このDTDは以下のような文書(sample.xml)を処理します。
<?xml version="1.0" encoding="Shift_JIS"?>
<!DOCTYPE URLList SYSTEM "URLList.dtd">
<URLList>
<URLItem name="Meadow Home" url="http://www.mulberrytech.com/tdtd/"/>
<URLDirectory name="Emacs Library"/>
<URLItem name="PSGML Home" url="http://db-www.aist-nara.ac.jp/xml/psgml/"/>
<URLItem name="TDTD Home" url="http://www.mulberrytech.com/tdtd/"/>
</URLDirectory>
</URLList>
<?xml version="1.0"?>
C-uC-cC-c [Comment:] URL List DTDこの操作により以下の行が挿入されます。
<!-- ============================================================= --> <!-- URL List DTD --> <!-- ============================================================= -->
C-cC-e [Element tag: ] URLList [Descriptive name: ] URLList [Comment: ] URLList [Content spec: ] (URLDirectory | URLItem)*
C-cC-e [Element tag: ] URLDirectory [Descriptive name: ] URLDirectory [Comment: ] URLDirectory [Content spec: ] (URLDirectory | URLItem)*
C-cC-a [Element type: ] URLDirectory [Attribute tag: ] name [Comment: ] Name [Type or enumeration: ] CDATA [Default: ] #REQUIRED
C-cC-e [Element tag: ] URLItem [Descriptive name: ] URLItem [Comment: ] URLItem [Content spec: ] EMPTY
C-cC-a [Element type: ] URLItem [Attribute tag: ] name [Comment: ] Name [Type or enumeration: ] CDATA [Default: ] #REQUIRED C-cC-a [Attribute tag: ] url [Comment: ] URL [Type or enumeration: ] CDATA [Default: ] #REQUIRED
C-xC-f [Find file: ] sample.xml C-cC-p [Parsing prolog...done] C-cC-o [Ok]
| > | dtd-electric-mdc | |
| C-c> | dtd-insert-mdc | |
| C-cC-a | dtd-declare-attribute | |
| C-cC-n | dtd-declare-notation | |
| C-cM-C-% | dtd-declare-external-entity | |
| C-cC-% | dtd-declare-parameter-entity | |
| C-cC-e | dtd-declare-element | |
| C-cC-c | dtd-comment | |
| C-cC-v | sgml-validate | |
| M-gM-f | font-lock-fontify-buffer | |
| M-gM-C-g | ||
| M-C-g | ||
| M-C-i | complete-tag |
YUTANI Miki <yuta@kt.rim.or.jp> Copyright © 2003 by YUTANI Miki.