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

Re: [emacs-nxml-mode] editing xhtml fragments

Expand Messages
  • Stephen Langer
    ... It seems to be *too* strict. ... How do you tell nxml how to find the dtd and that the contents of this file are inside tags? Is there a better way
    Message 1 of 10 , Aug 17, 2011
    • 0 Attachment
      On Aug 17, 2011, at 2:45 AM, Dave Pawson wrote:

      >
      >
      >
      >> - nXML is very strict when I use my malformed XML document
      >
      > As intended.

      It seems to be *too* strict.

      Is nxml supposed to work when editing an xml fragment that's included in another document? For example, here's the outer document:

      > <?xml version='1.0'?>
      > <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "dtd/docbook-xml-4.5/docbookx.dtd"
      > [
      > <!ENTITY chapterone SYSTEM "chapter_one.xml">
      > ]>
      >
      > <book>
      > &chapterone;
      > </book>

      and here's chapter_one.xml:

      > <chapter>
      > etc.
      > </chapter

      How do you tell nxml how to find the dtd and that the contents of this file are inside <book> tags? Is there a better way to include the file in the master document, one that nxml understands?

      -- Steve

      --
      -- stephen.langer@... Tel: (301) 975-5423 --
      -- http://math.nist.gov/~SLanger/ Fax: (301) 975-3553 --
      -- NIST, 100 Bureau Drive, Stop 8910, Gaithersburg, Md 20899-8910 --

      -- "I don't think this will work. That's why it's science." --
      -- Naomi Langer (age 6), 17 Feb 2003 --
    • Dave Pawson
      ... No. Appropriate for xml. ... Yes. Any xml. ... nxml-mode isn t too happy working with DTD s. ... You don t. Use trang to convert to relax NG, then use the
      Message 2 of 10 , Aug 17, 2011
      • 0 Attachment
        On 17 August 2011 15:08, Stephen Langer <stephen.langer@...> wrote:
        >
        > On Aug 17, 2011, at 2:45 AM, Dave Pawson wrote:
        >
        >>
        >>
        >>
        >>> - nXML is very strict when I use my malformed XML document
        >>
        >> As intended.
        >
        > It seems to be *too* strict.

        No. Appropriate for xml.


        >
        > Is nxml supposed to work when editing an xml fragment that's included in another document?

        Yes. Any xml.




        >
        >> <?xml version='1.0'?>
        >> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "dtd/docbook-xml-4.5/docbookx.dtd"
        >>  [
        >> <!ENTITY chapterone SYSTEM "chapter_one.xml">
        >> ]>
        >>
        >> <book>
        >> &chapterone;
        >> </book>

        nxml-mode isn't too happy working with DTD's.



        >
        > and here's chapter_one.xml:
        >
        >> <chapter>
        >>  etc.
        >> </chapter
        >
        > How do you tell nxml how to find the dtd

        You don't.
        Use trang to convert to relax NG, then use the rnc
        file via the schema association.


        HTH




        --
        Dave Pawson
        XSLT XSL-FO FAQ.
        Docbook FAQ.
        http://www.dpawson.co.uk
      • Stephen Langer
        ... Thanks. I d forgotten that I d already done that. But I never figured out how to tell nxml that a file whose first xml tag was or is
        Message 3 of 10 , Aug 17, 2011
        • 0 Attachment
          On Aug 17, 2011, at 10:28 AM, Dave Pawson wrote:

          >>
          >> How do you tell nxml how to find the dtd
          >
          > You don't.
          > Use trang to convert to relax NG,
          > then use the rnc
          > file via the schema association.

          Thanks. I'd forgotten that I'd already done that. But I never figured out how to tell nxml that a file whose first xml tag was <chapter> or <para> is valid, because it's included in another file which contains the required surrounding tags.

          -- Steve


          --
          -- stephen.langer@... Tel: (301) 975-5423 --
          -- http://math.nist.gov/~SLanger/ Fax: (301) 975-3553 --
          -- NIST, 100 Bureau Drive, Stop 8910, Gaithersburg, Md 20899-8910 --

          -- "I don't think this will work. That's why it's science." --
          -- Naomi Langer (age 6), 17 Feb 2003 --
        • Dave Pawson
          ... Wrong tool Validate on the command line, or edit the rnc file to tell nxml-mode that the entity can start on chapter? HTH -- Dave Pawson XSLT XSL-FO FAQ.
          Message 4 of 10 , Aug 17, 2011
          • 0 Attachment
            On 17 August 2011 16:40, Stephen Langer <stephen.langer@...> wrote:
            >
            > On Aug 17, 2011, at 10:28 AM, Dave Pawson wrote:
            >
            >>>
            >>> How do you tell nxml how to find the dtd
            >>
            >> You don't.
            >> Use trang to convert to relax NG,
            >> then use the rnc
            >> file via the schema association.
            >
            > Thanks.  I'd forgotten that I'd already done that.  But I never figured out how to tell nxml that a file whose first xml tag was <chapter> or <para> is valid, because it's included in another file which contains the required surrounding tags.

            Wrong tool
            Validate on the command line, or edit the rnc file to tell nxml-mode
            that the entity can start on chapter?

            HTH




            --
            Dave Pawson
            XSLT XSL-FO FAQ.
            Docbook FAQ.
            http://www.dpawson.co.uk
          • Stephen Langer
            ... But isn t the whole point that nxml helps you write valid xml, by showing you your mistakes and suggesting and autocompleting the valid tags at any point?
            Message 5 of 10 , Aug 17, 2011
            • 0 Attachment
              On Aug 17, 2011, at 11:48 AM, Dave Pawson wrote:

              >> Thanks. I'd forgotten that I'd already done that. But I never figured out how to tell nxml that a file whose first xml tag was <chapter> or <para> is valid, because it's included in another file which contains the required surrounding tags.
              >
              > Wrong tool
              > Validate on the command line,

              But isn't the whole point that nxml helps you write valid xml, by showing you your mistakes and suggesting and autocompleting the valid tags at any point? What's the point of using nxml if you have to validate outside of emacs?

              > or edit the rnc file to tell nxml-mode
              > that the entity can start on chapter?

              But I have lots of included files, and they aren't all chapters, and it's not practical to have separate rnc files for them all.

              What would be useful would be for each file to contain a special comment that says what the enclosing elements are. I think I used to use psgml mode to do this. I don't remember exactly what prompted me to switch to nxml.

              -- Steve


              --
              -- stephen.langer@... Tel: (301) 975-5423 --
              -- http://math.nist.gov/~SLanger/ Fax: (301) 975-3553 --
              -- NIST, 100 Bureau Drive, Stop 8910, Gaithersburg, Md 20899-8910 --

              -- "I don't think this will work. That's why it's science." --
              -- Naomi Langer (age 6), 17 Feb 2003 --
            • Peter Flynn
              On 17/08/11 19:19, Stephen Langer wrote: [...] ... I looked at it and went back to psgml. It s simply doesn t have the interface (commands) that you need for
              Message 6 of 10 , Aug 17, 2011
              • 0 Attachment
                On 17/08/11 19:19, Stephen Langer wrote:
                [...]
                > What would be useful would be for each file to contain a special
                > comment that says what the enclosing elements are. I think I used to
                > use psgml mode to do this. I don't remember exactly what prompted me
                > to switch to nxml.

                I looked at it and went back to psgml. It's simply doesn't have the
                interface (commands) that you need for writing and editing, and as 99%
                of my work is with people who use DTDs, it's not much use for that
                either. I'm sure it's terribly clever, but without the command-set and
                the ability to use DTDs, it's crippled.

                On 17/08/11 07:31, Mihamina Rakotomandimby wrote:
                > How to:
                > - Get nXML accept my malformed XML docs (no DOCTYPE, nothing but
                > xHTML fragments)

                I don't think you can do that without surgery.

                To use a fragment, specify the enclosing element type in a DOCTYPE
                Declaration, and use a DTD-aware environment.

                > - Get nXML use my C-c C-t to create tag.

                Pass. Psgml provide C-c C-e for this ("elements", not "tags"; if you
                *really* mean create tag, psgml provides C-c < to create a start-tag and
                C-c / to create the matching end-tag).

                ///Peter
              • Dave Pawson
                ... In which case provide the rnc schema for nxml-mode to use. nxml-mode doesn t hack xinclude or external entities. ... I didn t suggest it was. Modify the
                Message 7 of 10 , Aug 17, 2011
                • 0 Attachment
                  On 17 August 2011 19:19, Stephen Langer <stephen.langer@...> wrote:
                  >
                  > On Aug 17, 2011, at 11:48 AM, Dave Pawson wrote:
                  >
                  >>> Thanks.  I'd forgotten that I'd already done that.  But I never figured out how to tell nxml that a file whose first xml tag was <chapter> or <para> is valid, because it's included in another file which contains the required surrounding tags.
                  >>
                  >> Wrong tool
                  >>  Validate on the command line,
                  >
                  > But isn't the whole point that nxml helps you write valid xml, by showing you your mistakes and suggesting and autocompleting the valid tags at any point?  What's the point of using nxml if you have to validate outside of emacs?

                  In which case provide the rnc schema for nxml-mode to use.
                  nxml-mode doesn't hack xinclude or external entities.


                  >
                  >>  or edit the rnc file to tell nxml-mode
                  >> that the entity can start on chapter?
                  >
                  > But I have lots of included files, and they aren't all chapters, and it's not practical to have separate rnc files for them all.

                  I didn't suggest it was. Modify the start element in one schema covering
                  the entire included document.


                  >
                  > What would be useful would be for each file to contain a special comment that says what the enclosing elements are.  I think I used to use psgml mode to do this.  I don't remember exactly what prompted me to switch to nxml.

                  Doesn't exist.
                  Revert to sgml-mode?


                  regards



                  --
                  Dave Pawson
                  XSLT XSL-FO FAQ.
                  Docbook FAQ.
                  http://www.dpawson.co.uk
                • Steinar Bang
                  ... You could try to sudo apt-get install psgml ...? It may not bind to your XML documents file extensions in auto-mode-alist, but that s easily fixed. psgml
                  Message 8 of 10 , Aug 20, 2011
                  • 0 Attachment
                    >>>>> Mihamina Rakotomandimby <mihamina@...>:

                    > In my old Emacs, I used "M-x xml-mode" which drove me to the SGML mode.
                    > In Emacs 23 (Ubuntu Oneiric flavor), nXML mode takes it.

                    You could try to "sudo apt-get install psgml"...?

                    It may not bind to your XML documents file extensions in
                    auto-mode-alist, but that's easily fixed.

                    psgml is still present in oneiric: http://packages.ubuntu.com/oneiric/psgml

                    > The problem with nXML (and me) is:
                    > - the lone shortcut I use, C-c C-t (create tag) is not in use.

                    nXML has chosen a different approach.

                    See my examples here for using nXML to insert tags and attributes:
                    http://thread.gmane.org/gmane.emacs.nxml.general/1944/focus=1955
                  Your message has been successfully submitted and would be delivered to recipients shortly.