Mihamina Rakotomandimby | 17 Aug 2011 08:31
Gravatar

editing xhtml fragments

Hi all

I usually update my blog using Drivel 
(http://dropline.net/past-projects/drivel-blog-editor/)
In the "body" part, there is no need to put entire xHTML document:
- no HTML, no HEAD, no BODY
- just P, H1, H2, DIV,...

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.

The problem with nXML (and me) is:
- the lone shortcut I use, C-c C-t (create tag) is not in use.
- nXML is very strict when I use my malformed XML document

How to:
- Get nXML accept my malformed XML docs (no DOCTYPE, nothing but xHTML 
fragments)
- Get nXML use my C-c C-t to create tag.

Thank you everybody.

--

-- 
RMA.	

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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
(Continue reading)

Dave Pawson | 17 Aug 2011 08:45
Picon
Gravatar

Re: editing xhtml fragments

On 17 August 2011 07:31, Mihamina Rakotomandimby <mihamina <at> rktmb.org> wrote:
> Hi all
>
> I usually update my blog using Drivel
> (http://dropline.net/past-projects/drivel-blog-editor/)
> In the "body" part, there is no need to put entire xHTML document:
> - no HTML, no HEAD, no BODY
> - just P, H1, H2, DIV,...

which is not html, nor xml for which nxml-mode is intended.

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

If sgml-mode meets your needs, use it.

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

Still available in sgml-mode

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

As intended.

regards

--

-- 
(Continue reading)

Stephen Langer | 17 Aug 2011 16:08
Favicon

Re: editing xhtml fragments


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

Dave Pawson | 17 Aug 2011 16:28
Picon
Gravatar

Re: editing xhtml fragments

On 17 August 2011 15:08, Stephen Langer <stephen.langer <at> nist.gov> 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>
(Continue reading)

Stephen Langer | 17 Aug 2011 17:40
Favicon

Re: editing xhtml fragments


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 <at> nist.gov                    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         --

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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
(Continue reading)

Dave Pawson | 17 Aug 2011 17:48
Picon
Gravatar

Re: editing xhtml fragments

On 17 August 2011 16:40, Stephen Langer <stephen.langer <at> nist.gov> 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

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

(Continue reading)

Stephen Langer | 17 Aug 2011 20:19
Favicon

Re: editing xhtml fragments


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 <at> nist.gov                    Tel: (301) 975-5423 --
-- http://math.nist.gov/~SLanger/             Fax: (301) 975-3553 --
-- NIST, 100 Bureau Drive, Stop 8910, Gaithersburg, Md 20899-8910 --
(Continue reading)

Peter Flynn | 17 Aug 2011 23:50
Picon
Favicon

Re: editing xhtml fragments

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

Dave Pawson | 18 Aug 2011 08:43
Picon
Gravatar

Re: editing xhtml fragments

On 17 August 2011 19:19, Stephen Langer <stephen.langer <at> nist.gov> 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
(Continue reading)

Steinar Bang | 20 Aug 2011 11:24
Picon
Picon
Favicon

Re: editing xhtml fragments

>>>>> Mihamina Rakotomandimby <mihamina <at> rktmb.org>:

> 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

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

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

(Continue reading)


Gmane