christian_stieber | 27 Aug 2010 18:50
Picon

Finding schema files...

Well, like most XML tools, nxml-mode seems to be "oversized".

Basically, I don't want to place my schema files on a webserver. Why should I? And how do I guarantee they stay
current? xmllint, on the other hand, didn't even accept "file://..." --- luckily, it has a command line
option, although putting the path into the XML would have been nice.

nxml doesn't even allow any specs inside the XML file; instead it's using some obscure repository. Same as
before, I don't want my schema files to be installed on the system (it would have to be symlinks back into my
working copy anyway, but unfortuntely someone other than me checking out the stuff won't be getting
this). I don't even want to add "pointers" into my working copies into some private configuration file of
me. I just want to associate an XML file with a schema file, nothing more. I don't even want to "search" for
the schema file --- I know where it is! Believe it or not, I just happen to know the layout of my source repository.

Is there any way to stick something into an XML file that makes emacs or nxml use the correct schema file, a
SIMPLE file path? Even if it's an elisp fragment that needs to be installed so emacs reads a line like <!--
XMLSchema: ../../Schema/Data/foo.rnc --> and does the right thing? Of course, it would be nicer if
nothing had to be done to make it work.

Or am I really the only one using XML for stuff that's not some obscure worldwide distributed collection of
magic processing rules, pulling datatypes from asia into rules from china to determine how to process
documents assembled from france and italy with an encoding table from russia?

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/emacs-nxml-mode/

<*> Your email settings:
(Continue reading)

kennethjhughes | 27 Aug 2010 19:35

Re: Finding schema files...

http://www.dpawson.co.uk/relaxng/nxml/schemaloc.html#d574e168

--- In emacs-nxml-mode <at> yahoogroups.com, "christian_stieber" <stieber.c <at> ...> wrote:
>
> Well, like most XML tools, nxml-mode seems to be "oversized".
> 
> Basically, I don't want to place my schema files on a webserver. Why should I? And how do I guarantee they
stay current? xmllint, on the other hand, didn't even accept "file://..." --- luckily, it has a command
line option, although putting the path into the XML would have been nice.
> 
> nxml doesn't even allow any specs inside the XML file; instead it's using some obscure repository. Same as
before, I don't want my schema files to be installed on the system (it would have to be symlinks back into my
working copy anyway, but unfortuntely someone other than me checking out the stuff won't be getting
this). I don't even want to add "pointers" into my working copies into some private configuration file of
me. I just want to associate an XML file with a schema file, nothing more. I don't even want to "search" for
the schema file --- I know where it is! Believe it or not, I just happen to know the layout of my source repository.
> 
> Is there any way to stick something into an XML file that makes emacs or nxml use the correct schema file, a
SIMPLE file path? Even if it's an elisp fragment that needs to be installed so emacs reads a line like <!--
XMLSchema: ../../Schema/Data/foo.rnc --> and does the right thing? Of course, it would be nicer if
nothing had to be done to make it work.
> 
> Or am I really the only one using XML for stuff that's not some obscure worldwide distributed collection of
magic processing rules, pulling datatypes from asia into rules from china to determine how to process
documents assembled from france and italy with an encoding table from russia?
>

------------------------------------

Yahoo! Groups Links
(Continue reading)

Dave Pawson | 28 Aug 2010 08:18
Picon
Gravatar

Re: Finding schema files...

On 27 August 2010 17:50, christian_stieber <stieber.c <at> web.de> wrote:
> Well, like most XML tools, nxml-mode seems to be "oversized".
>
> Basically, I don't want to place my schema files on a webserver.

> Same as before, I don't want my schema files to be installed on the system

> I don't even want to add "pointers" into my working copies into some private configuration file of me.

So work without a schema? You've pushed yourself into a corner there :-)

--

-- 
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)
(Continue reading)

Steinar Bang | 28 Aug 2010 17:45
Picon
Picon
Favicon

Re: Finding schema files...

If rng-schema-locating-files contains "schemas.xml" (which I think it
does by default.  Try `C-h v rng-schema-locating-files' to verify), you
can put a file named schemas.xml in the same directory as your document.

As for the format of that file, see the link that Kenneth J. Hughes
posted.

In short, you can match a file name pattern, an absolute file name, a
namespace used, the document element name, a doctype declaration public
IS, and more, against an RNC schema.

You can also specify a default schema.

If rng-schema-locating-files contains "schemas.xml", and you put a
schemas.xml file with this content in the same directory as the XML
documents themselves, that should do the trick:

<?xml version="1.0"?>
<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
  <default uri="../../Schema/Data/foo.rnc"/>
</locatingRules>

If you think "what do I need with a bunch of identical extra schemas.xml
files?", then create a single one, and add its location to
rng-schema-locating-files,

------------------------------------

Yahoo! Groups Links

(Continue reading)

Tony Graham | 29 Aug 2010 01:13

Re: Finding schema files...

On Fri, August 27, 2010 5:50 pm, christian_stieber wrote:
...
> Is there any way to stick something into an XML file that makes emacs or
> nxml use the correct schema file, a SIMPLE file path? Even if it's an
> elisp fragment that needs to be installed so emacs reads a line like <!--
> XMLSchema: ../../Schema/Data/foo.rnc --> and does the right thing? Of
> course, it would be nicer if nothing had to be done to make it work.

I used to have a hook function for nxml-mode that read the PI that
<oXygen/> inserts in XML files to find the schema and used that to tell
nxml-mode to find the schema.  It wasn't hard to do, but I don't have it
anymore after I made both an <oXygen/> framework and a nxml-mode schemas
file for the schema (for the XSpec XSLT/XQuery testing framework) so
people would stop putting idiosyncratic schema locations in PIs in shared
XSpec test files.

Regards,

Tony Graham                         Tony.Graham <at> MenteithConsulting.com
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd                               XML Guild member
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2

------------------------------------
(Continue reading)

Leigh L Klotz Jr | 30 Aug 2010 19:04
Picon

Re: Re: Finding schema files...

I admin I'm confused about this.  Can't you just use the menu item to set the schema for a file and let emacs save the data for you?
Is it really a big deal that it saves it in a file called schemas.xml in the same directory?

On 08/27/2010 10:35 AM, kennethjhughes wrote:
 

http://www.dpawson.co.uk/relaxng/nxml/schemaloc.html#d574e168

--- In emacs-nxml-mode <at> yahoogroups.com, "christian_stieber" <stieber.c <at> ...> wrote:
>
> Well, like most XML tools, nxml-mode seems to be "oversized".
>
> Basically, I don't want to place my schema files on a webserver. Why should I? And how do I guarantee they stay current? xmllint, on the other hand, didn't even accept "file://..." --- luckily, it has a command line option, although putting the path into the XML would have been nice.
>
> nxml doesn't even allow any specs inside the XML file; instead it's using some obscure repository. Same as before, I don't want my schema files to be installed on the system (it would have to be symlinks back into my working copy anyway, but unfortuntely someone other than me checking out the stuff won't be getting this). I don't even want to add "pointers" into my working copies into some private configuration file of me. I just want to associate an XML file with a schema file, nothing more. I don't even want to "search" for the schema file --- I know where it is! Believe it or not, I just happen to know the layout of my source repository.
>
> Is there any way to stick something into an XML file that makes emacs or nxml use the correct schema file, a SIMPLE file path? Even if it's an elisp fragment that needs to be installed so emacs reads a line like <!-- XMLSchema: ../../Schema/Data/foo.rnc --> and does the right thing? Of course, it would be nicer if nothing had to be done to make it work.
>
> Or am I really the only one using XML for stuff that's not some obscure worldwide distributed collection of magic processing rules, pulling datatypes from asia into rules from china to determine how to process documents assembled from france and italy with an encoding table from russia?
>





__._,_.___

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___
Steinar Bang | 31 Aug 2010 18:29
Picon
Picon
Favicon

Re: Finding schema files...

>>>>> Leigh L Klotz Jr <Leigh.Klotz <at> xerox.com>:

> I admin I'm confused about this.  Can't you just use the menu item to
> set the schema for a file and let emacs save the data for you?  Is it
> really a big deal that it saves it in a file called schemas.xml in the
> same directory?

Huh...?  Is that possible?  I didn't know that.

Now I've experiemented.  Original poster, please try this:

Make sure that the first element (car) of rng-schema-locating-files is
"schemas.xml" (this is the default).

Then select from the menus 
 XML->Set Schema->File...
and select the name of the RNC file for your schema.

You will be prompted if you want to save this setting, and clicking on
"Yes" will save a connection between your XML file and the schema you
browsed to in a file called schemas.xml in the CWD.  The path to the
schema file will be relative to the schemas.xml file.

nxml-mode will create a schemas.xml file for you if one doesn't already
exist.

------------------------------------

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/

Dave Pawson | 31 Aug 2010 18:51
Picon
Gravatar

Re: Re: Finding schema files...

On 31 August 2010 17:29, Steinar Bang <sb <at> dod.no> wrote:
>>>>>> Leigh L Klotz Jr <Leigh.Klotz <at> xerox.com>:
>
>> I admin I'm confused about this.  Can't you just use the menu item to
>> set the schema for a file and let emacs save the data for you?  Is it
>> really a big deal that it saves it in a file called schemas.xml in the
>> same directory?
>
> Huh...?  Is that possible?  I didn't know that.
>
> Now I've experiemented.  Original poster, please try this:
>
> Make sure that the first element (car) of rng-schema-locating-files is
> "schemas.xml" (this is the default).
>
> Then select from the menus
>  XML->Set Schema->File...
> and select the name of the RNC file for your schema.

(define-key nxml-mode-map [f9] 'rng-set-schema-file)

as part of your .emacs helps. I use f9 now,
then tidy up the schemas file every few months

This as part of
(add-hook 'nxml-mode-hook
  (function (lambda()
	    (define-key nxml-mode-map [f5] 'sgml-comment)
	    (define-key nxml-mode-map [f9] 'rng-set-schema-file)
	    (define-key nxml-mode-map "\C-c\C-r" 'tag-region)
	    (setq nxml-slash-auto-complete-flag t)
	    (setq nxml-auto-insert-xml-declaration-flag t)
	    (setq nxml-default-buffer-file-coding-system (quote utf-8-dos))
	    (setq nxml-glyph-set (quote nxml-wgl4-glyph-set))
	    (setq rng-schema-locating-files '("/sgml/schemas.xml"))
	    (setq sgml-indent-data t)
	    (setq sgml-indent-step 2)
	
	    ))) ;; End of nxml mode specific hooks.

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/

Steinar Bang | 31 Aug 2010 19:41
Picon
Picon
Favicon

Re: Finding schema files...

>>>>> Dave Pawson <dave.pawson <at> gmail.com>:

> This as part of
> (add-hook 'nxml-mode-hook
>   (function (lambda()
[snip!]
> 	    (setq rng-schema-locating-files '("/sgml/schemas.xml"))

Note that this particular setting may be appropriate to the original
poster's use case.  This makes nxml look for a single schemas.xml file
in the directory "/sgml" (absolute path).

But the default value for rng-schema-locating-files should be
appropriate for the original poster.

------------------------------------

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/


Gmane