Loading ...
Sorry, an error occurred while loading the content.

Re: [emacs-nxml-mode] Finding schema files...

Expand Messages
  • Tony Graham
    On Fri, August 27, 2010 5:50 pm, christian_stieber wrote: ... I used to have a hook function for nxml-mode that read the PI that inserts in XML files
    Message 1 of 10 , Aug 28 4:13 PM
    • 0 Attachment
      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@...
      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
    • Leigh L Klotz Jr
      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
      Message 2 of 10 , Aug 30 10:04 AM
      • 0 Attachment
        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@yahoogroups.com, "christian_stieber" <stieber.c@...> 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?
        >



      • Steinar Bang
        ... 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
        Message 3 of 10 , Aug 31 9:29 AM
        • 0 Attachment
          >>>>> Leigh L Klotz Jr <Leigh.Klotz@...>:

          > 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.
        • Dave Pawson
          ... (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
          Message 4 of 10 , Aug 31 9:51 AM
          • 0 Attachment
            On 31 August 2010 17:29, Steinar Bang <sb@...> wrote:
            >>>>>> Leigh L Klotz Jr <Leigh.Klotz@...>:
            >
            >> 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
          • Steinar Bang
            ... [snip!] ... 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
            Message 5 of 10 , Aug 31 10:41 AM
            • 0 Attachment
              >>>>> Dave Pawson <dave.pawson@...>:

              > 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.
            • Florent Georges
              Steinar Bang wrote: Hi, ... Just to add my 2 cents to the current discussion, I don t like the schemas.xml file in the current directory neither. I have the
              Message 6 of 10 , Aug 31 11:11 AM
              • 0 Attachment
                Steinar Bang wrote:

                Hi,

                > 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).

                Just to add my 2 cents to the current discussion, I don't like
                the schemas.xml file in the current directory neither. I have
                the following path in rng-schema-locating-files:

                ~/.emacs.d/nxml-schemas/schemas.xml

                The directory ~/.emacs.d/nxml-schemas/ also contains all the
                schemas. And my ~/.emacs.d/ is in a Subversion repository so I
                can easily share it between several computers.

                With a mix of rules on the actual XML content and on the file
                names, those catalogs usually make the job very well.

                Regards,

                --
                Florent Georges
                http://fgeorges.org/
              Your message has been successfully submitted and would be delivered to recipients shortly.