help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML mode with XSD schema support?


From: joseito
Subject: Re: XML mode with XSD schema support?
Date: Wed, 18 Jun 2008 12:35:56 -0700 (PDT)
User-agent: G2/1.0

On 18 Cze, 13:04, Steffen Sledz <address@hidden> wrote:
(...)
> The only mode i found was nXMLMode. It is very comfortable but it
> supports only Relax NG schemas. :(

Almost always it's possible to transform XSD into RNC. I have set up
myself a tool-chain for doing it using java, rngconv, trang and the
following shell script:

--- cut here: begin --------------------------------------

#!/bin/bash

if [ $# = 0 ]; then
    echo "Usage: rnc /path/to/XSD/schema/to/convert/to/RNC"
    exit 1
fi
if [ ! -f $1 ]; then
    echo "No such file: $1"
    exit 2
fi

DIR=`echo $0 | sed -e "s/[^/]*$//"`
FILE="$DIR../`echo $1 | awk -F/ '{print $NF}' | cut -d. -f1`.rnc"

if [ -f $FILE ]; then
    echo "ERROR: File exists: $FILE"
    exit 3
fi

CLASSPATH=$CLASSPATH:$DIR

java -jar $DIR/rngconv.jar $1 > $DIR/fifo | java -jar $DIR/trang.jar -
I rng -O rnc $DIR/fifo $FILE

if [ -f $FILE ]; then
    echo "OK: New RNC schema saved as $FILE"
else
    echo "ERROR: Errors found, see stderr for details"
fi

--- cut here: end --------------------------------------

If you put this together with all the java dependencies in a directory
~/rnc/conv, you can execute it from anywhere inside your filesystem
and you get the converted schema in ~/rnc.

Good luck :)
--
José A. Romero L.
joseito (at) poczta (dot) onet (dot) pl
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]