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

customizing a grammar and location grammar

Expand Messages
  • Chris Chiasson
    Hello emacs-nxml-mode list, In trying to customize the docbook 4.5CR1 rng model by paralleling http://www.docbook.org/docs/howto/#faq-customization-mathml-svg
    Message 1 of 8 , Mar 2, 2006
    • 0 Attachment
      Hello emacs-nxml-mode list,

      In trying to customize the docbook 4.5CR1 rng model by paralleling

      http://www.docbook.org/docs/howto/#faq-customization-mathml-svg

      I wondered, "Is there a way to reference the public version of, say,
      docbook and have nxml automatically map that to my local version?"

      For example:

      <include href="http://www.docbook.org/rng/4.5CR1/docbook.rng">...</include>

      would automatically find my local copy of the docbook grammar in a
      different directory?

      So, uh - is there?

      Also, my .emacs file has

      (setq rng-schema-locating-files '("schemas.xml","/path/to/schemas.xml"))

      and nxml mode wants locate.rnc to be at /path/to/locate.rnc.

      I wanted it to be in /path/to/locatingrules and set the content of
      /path/to/schemas.xml accordingly,

      <documentElement localName="locatingRules" uri="locatingrules/locate.rnc"/>

      but nxml mode ignored it.

      In fact, without changing my /path/to/schemas.xml file, moving
      locate.rnc to /path/to/located.rnc causes everything to work fine.

      Is there a way to make nxml mode handle /path/to/schemas.xml and
      /path/to/locatingrules/locate.rnc?

      I didn't append my schemas.xml file because I don't want to use the
      default file.

      Thank you for your expertise and time. Sorry for the verbosity.

      Ciao,
      --
      http://chris.chiasson.name/
    • Florent Georges
      ... Mmh, I m not sure to understand exactly what s your problem. Could you please explain it a bit further? ... So here the problem is URIs relative to the
      Message 2 of 8 , Mar 3, 2006
      • 0 Attachment
        Chris Chiasson wrote:

        > I wondered, "Is there a way to reference the public version
        > of, say, docbook and have nxml automatically map that to my
        > local version?"

        > For example:

        > <include
        > href="http://www.docbook.org/rng/4.5CR1/docbook.rng">...</include>

        > would automatically find my local copy of the docbook grammar in a
        > different directory?

        Mmh, I'm not sure to understand exactly what's your problem. Could
        you please explain it a bit further?

        > and nxml mode wants locate.rnc to be at /path/to/locate.rnc.

        > I wanted it to be in /path/to/locatingrules and set the
        > content of /path/to/schemas.xml accordingly,

        > <documentElement localName="locatingRules"
        > uri="locatingrules/locate.rnc"/>

        > but nxml mode ignored it.

        So here the problem is "URIs relative to the schema document", right?
        I use them succefully each day, here is my schemas.xml:

        <locatingRules
        xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
        <uri pattern="*.fo" typeId="FO"/>
        <uri pattern="*.xsd" typeId="XSD"/>

        <namespace ns="http://www.w3.org/1999/XSL/Format"
        typeId="FO"/>
        <namespace ns="http://www.w3.org/2000/10/XMLSchema"
        typeId="XSD"/>

        <documentElement localName="root" typeId="FO"
        prefix="fo"/>
        <documentElement localName="schema" typeId="XSD"/>
        <documentElement localName="I18N_Dictionary_Type"
        typeId="THOTH"/>
        <documentElement localName="doc" typeId="DOC"/>

        <typeId id="XSLT" uri="xslt/xslt.rnc"/>
        <typeId id="FO" uri="fo.rnc"/>
        <typeId id="XSD" uri="xmlschema.rnc"/>
        <typeId id="THOTH" uri="thoth.rnc"/>
        <typeId id="DOC" uri="doc.rnc"/>
        </locatingRules>

        Maybe you have conflicting rules?

        Regards,

        --drkm



























        ___________________________________________________________________________
        Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
        Téléchargez sur http://fr.messenger.yahoo.com
      • Chris Chiasson
        The first question refers to the ability of nxml to find the correct file when a relax ng grammar includes another grammar. As it is now, I don t think nxml
        Message 3 of 8 , Mar 3, 2006
        • 0 Attachment
          The first question refers to the ability of nxml to find the correct
          file when a relax ng grammar includes another grammar. As it is now, I
          don't think nxml mode is able to (or is just not set up to) remap
          includes of one grammar from another (though it does a fine job of
          mapping namespaces and document types to local grammars). To sum:
          afaik it can map doctype, public ids, namespaces, etc but cannot map
          hrefs, includes...

          The second question refers to the location of locate.rnc. It appears
          to me that nxml mode can't locate locate.rnc if it is not in the same
          directory as samples.xml no matter what the locating rule for
          locate.rnc says. I think this is because locate.rnc gives the rules
          for parsing samples.xml

          On 3/3/06, Florent Georges <darkman_spam@...> wrote:
          > Chris Chiasson wrote:
          >
          > > I wondered, "Is there a way to reference the public version
          > > of, say, docbook and have nxml automatically map that to my
          > > local version?"
          >
          > > For example:
          >
          > > <include
          > > href="http://www.docbook.org/rng/4.5CR1/docbook.rng">...</include>
          >
          > > would automatically find my local copy of the docbook grammar in a
          > > different directory?
          >
          > Mmh, I'm not sure to understand exactly what's your problem. Could
          > you please explain it a bit further?
          >
          > > and nxml mode wants locate.rnc to be at /path/to/locate.rnc.
          >
          > > I wanted it to be in /path/to/locatingrules and set the
          > > content of /path/to/schemas.xml accordingly,
          >
          > > <documentElement localName="locatingRules"
          > > uri="locatingrules/locate.rnc"/>
          >
          > > but nxml mode ignored it.
          >
          > So here the problem is "URIs relative to the schema document", right?
          > I use them succefully each day, here is my schemas.xml:
          >
          > <locatingRules
          > xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
          > <uri pattern="*.fo" typeId="FO"/>
          > <uri pattern="*.xsd" typeId="XSD"/>
          >
          > <namespace ns="http://www.w3.org/1999/XSL/Format"
          > typeId="FO"/>
          > <namespace ns="http://www.w3.org/2000/10/XMLSchema"
          > typeId="XSD"/>
          >
          > <documentElement localName="root" typeId="FO"
          > prefix="fo"/>
          > <documentElement localName="schema" typeId="XSD"/>
          > <documentElement localName="I18N_Dictionary_Type"
          > typeId="THOTH"/>
          > <documentElement localName="doc" typeId="DOC"/>
          >
          > <typeId id="XSLT" uri="xslt/xslt.rnc"/>
          > <typeId id="FO" uri="fo.rnc"/>
          > <typeId id="XSD" uri="xmlschema.rnc"/>
          > <typeId id="THOTH" uri="thoth.rnc"/>
          > <typeId id="DOC" uri="doc.rnc"/>
          > </locatingRules>
          >
          > Maybe you have conflicting rules?
          >
          > Regards,
          >
          > --drkm
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          > ___________________________________________________________________________
          > Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
          > Téléchargez sur http://fr.messenger.yahoo.com
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
          >


          --
          http://chris.chiasson.name/
        • Florent Georges
          ... Ok. From what I understand of rng-c-parse-include , nXML doesn t provides the ability of remapping the target of an include. But I just had a quick
          Message 4 of 8 , Mar 3, 2006
          • 0 Attachment
            Chris Chiasson wrote:

            > The first question refers to the ability of nxml to find
            > the correct file when a relax ng grammar includes another
            > grammar. As it is now, I don't think nxml mode is able to
            > (or is just not set up to) remap includes of one grammar
            > from another (though it does a fine job of mapping
            > namespaces and document types to local grammars). To sum:
            > afaik it can map doctype, public ids, namespaces, etc but
            > cannot map hrefs, includes...

            Ok. From what I understand of 'rng-c-parse-include', nXML
            doesn't provides the ability of remapping the target of an
            include. But I just had a quick look, and I can be wrong.

            > The second question refers to the location of locate.rnc.
            > It appears to me that nxml mode can't locate locate.rnc if
            > it is not in the same directory as samples.xml no matter
            > what the locating rule for locate.rnc says. I think this
            > is because locate.rnc gives the rules for parsing
            > samples.xml

            Mmh, so the problem is to use a schemas.xml to locate the
            schema of the schemas.xml documents, right? So the
            boostraping issue.

            You can use 'rng-schema-locating-file-schema-file'
            (initialy set to "<your-nxml>/schema/locate.rnc") for that.

            Regards,

            --drkm
























            ___________________________________________________________________________
            Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
            Téléchargez sur http://fr.messenger.yahoo.com
          • Vincent Lefevre
            ... This should work. Otherwise this is a bug. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML -
            Message 5 of 8 , Mar 3, 2006
            • 0 Attachment
              On 2006-03-02 13:43:38 -0600, Chris Chiasson wrote:
              > Also, my .emacs file has
              >
              > (setq rng-schema-locating-files '("schemas.xml","/path/to/schemas.xml"))
              >
              > and nxml mode wants locate.rnc to be at /path/to/locate.rnc.
              >
              > I wanted it to be in /path/to/locatingrules and set the content of
              > /path/to/schemas.xml accordingly,
              >
              > <documentElement localName="locatingRules" uri="locatingrules/locate.rnc"/>
              >
              > but nxml mode ignored it.

              This should work. Otherwise this is a bug.

              --
              Vincent Lefèvre <vincent@...> - Web: <http://www.vinc17.org/>
              100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
              Work: CR INRIA - computer arithmetic / SPACES project at LORIA
            • Florent Georges
              ... Mmh, I think it s more complex. Clearly, nXML needs information before loading the first schemas.xml, if you want it validates the document. So the
              Message 6 of 8 , Mar 3, 2006
              • 0 Attachment
                Vincent Lefevre wrote:

                > On 2006-03-02 13:43:38 -0600, Chris Chiasson wrote:

                > > I wanted it to be in /path/to/locatingrules and set the
                > > content of /path/to/schemas.xml accordingly,

                > > <documentElement localName="locatingRules"
                > > uri="locatingrules/locate.rnc"/>

                > > but nxml mode ignored it.

                > This should work. Otherwise this is a bug.

                Mmh, I think it's more complex.

                Clearly, nXML needs information before loading the first
                schemas.xml, if you want it validates the document. So the
                variable 'rng-schema-locating-file-schema-file'.

                You could argue that if at some point in a schemas.xml,
                nXML sees an entry about locating rules type definition, it
                can use this new one from this point. But what does mean
                this? Only if 'rng-schema-locating-file-schema-file' is nil?
                Only for the next schemas.xml in the same reading (included
                with 'include')? Only for schemas.xml files included
                directly or indirectly *from the one where the rule is
                defined*? For all loading of any schemas.xml from now? Etc.

                I think it's legitimate for nXML to even require that you
                set 'rng-schema-locating-file-schema-file', and to prohibit
                using schemas.xml rules for that. Though I'm not sure it is
                the case.

                Regards,

                --drkm
























                ___________________________________________________________________________
                Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
                Téléchargez sur http://fr.messenger.yahoo.com
              • Chris Chiasson
                I figured out what I did wrong on issue #2. As I said, I changed to
                Message 7 of 8 , Mar 3, 2006
                • 0 Attachment
                  I figured out what I did wrong on issue #2. As I said, I changed

                  <documentElement localName="locatingRules" uri="locate.rnc"/>

                  to

                  <documentElement localName="locatingRules" uri="locatingrules/locate.rnc"/>

                  What I didn't notice was that there was an earlier rule (which would
                  have a higher priority), based on the namespace, pointing to
                  "locate.rnc". After changing this rule also, the schemas.xml file
                  works as advertised.


                  On 3/3/06, Vincent Lefevre <vincent@...> wrote:
                  > On 2006-03-02 13:43:38 -0600, Chris Chiasson wrote:
                  > > Also, my .emacs file has
                  > >
                  > > (setq rng-schema-locating-files '("schemas.xml","/path/to/schemas.xml"))
                  > >
                  > > and nxml mode wants locate.rnc to be at /path/to/locate.rnc.
                  > >
                  > > I wanted it to be in /path/to/locatingrules and set the content of
                  > > /path/to/schemas.xml accordingly,
                  > >
                  > > <documentElement localName="locatingRules" uri="locatingrules/locate.rnc"/>
                  > >
                  > > but nxml mode ignored it.
                  >
                  > This should work. Otherwise this is a bug.
                  >
                  > --
                  > Vincent Lefèvre <vincent@...> - Web: <http://www.vinc17.org/>
                  > 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
                  > Work: CR INRIA - computer arithmetic / SPACES project at LORIA
                  >
                  >
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                  >


                  --
                  http://chris.chiasson.name/
                • Vincent Lefevre
                  ... That s not the problem, as Chris said. The problem mentioned by Chris is that nxml doesn t take into account the path in the uri attribute of
                  Message 8 of 8 , Mar 3, 2006
                  • 0 Attachment
                    On 2006-03-03 18:46:45 +0100, Florent Georges wrote:
                    > Vincent Lefevre wrote:
                    >
                    > > On 2006-03-02 13:43:38 -0600, Chris Chiasson wrote:
                    >
                    > > > I wanted it to be in /path/to/locatingrules and set the
                    > > > content of /path/to/schemas.xml accordingly,
                    >
                    > > > <documentElement localName="locatingRules"
                    > > > uri="locatingrules/locate.rnc"/>
                    >
                    > > > but nxml mode ignored it.
                    >
                    > > This should work. Otherwise this is a bug.
                    >
                    > Mmh, I think it's more complex.
                    >
                    > Clearly, nXML needs information before loading the first
                    > schemas.xml, if you want it validates the document. So the
                    > variable 'rng-schema-locating-file-schema-file'.

                    That's not the problem, as Chris said. The problem mentioned
                    by Chris is that nxml doesn't take into account the path in
                    the uri attribute of documentElement.

                    --
                    Vincent Lefèvre <vincent@...> - Web: <http://www.vinc17.org/>
                    100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
                    Work: CR INRIA - computer arithmetic / SPACES project at LORIA
                  Your message has been successfully submitted and would be delivered to recipients shortly.