Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

emacs-nxml-mode · New XML Mode for Emacs

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 239
  • Category: XML
  • Founded: Sep 5, 2003
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 1080 - 1109 of 2146   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#1080 From: Kathy S <kathy_tn189@...>
Date: Fri Nov 4, 2005 3:18 am
Subject: Must see : Website of the week
kathy_tn189
Send Email Send Email
 
Hello!
Do check the website of the week by visiting
http://newwebsitepick.info .
The website also says how you can nomiate your website
if you have one.
Regards,
Kathy





__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

#1081 From: Lennart Borgman <lennart.borgman.073@...>
Date: Sun Nov 6, 2005 7:51 pm
Subject: php and nxml
nlborgman
Send Email Send Email
 
I have something like this in a php file:

     <a href="<?php echo get_settings('home'); ?>">Home</a>

The nxml parser gets upset when finding < inside the doublequotes. I
think this is correct according to the DTD, but I would like a more php
friendly dtd. All I really want at the moment is then that < is allowed
in the href value.

Is this easy to fix? Has someone tried to do it?

#1082 From: "J.Pietschmann" <j3322ptm@...>
Date: Sun Nov 6, 2005 8:45 pm
Subject: Re: php and nxml
j3322ptm
Send Email Send Email
 
Lennart Borgman wrote:
> I have something like this in a php file:
>
>     <a href="<?php echo get_settings('home'); ?>">Home</a>
>
> The nxml parser gets upset when finding < inside the doublequotes.

PHP scripts are not XML. Repeat: PHP scripts are not XML. At least not
in general. The XML spec forbids literal < and & in attribute values.
No amount of fiddling with schemas will change this.

J.Pietschmann

#1083 From: Lennart Borgman <lennart.borgman.073@...>
Date: Sun Nov 6, 2005 8:58 pm
Subject: Re: php and nxml
nlborgman
Send Email Send Email
 
J.Pietschmann wrote:

>Lennart Borgman wrote:
>
>
>>I have something like this in a php file:
>>
>>    <a href="<?php echo get_settings('home'); ?>">Home</a>
>>
>>The nxml parser gets upset when finding < inside the doublequotes.
>>
>>
>
>PHP scripts are not XML. Repeat: PHP scripts are not XML. At least not
>in general. The XML spec forbids literal < and & in attribute values.
>No amount of fiddling with schemas will change this.
>
>J.Pietschmann
>
>
Yes, thanks, but does the nxml parser forbid it? It would be very
convinient if the parser allowed it. Is it possible in some way to allow
it?

Or, maybe rather: Is is easy to change the nxml-parser to allow < and &
in attribute values?

#1084 From: Lennart Borgman <lennart.borgman.073@...>
Date: Sun Nov 6, 2005 10:18 pm
Subject: Re: php and nxml
nlborgman
Send Email Send Email
 
Lennart Borgman wrote:

>J.Pietschmann wrote:
>
>
>
>>Lennart Borgman wrote:
>>
>>
>>
>>
>>>I have something like this in a php file:
>>>
>>>   <a href="<?php echo get_settings('home'); ?>">Home</a>
>>>
>>>The nxml parser gets upset when finding < inside the doublequotes.
>>>
>>>
>>>
>>>
>>PHP scripts are not XML. Repeat: PHP scripts are not XML. At least not
>>in general. The XML spec forbids literal < and & in attribute values.
>>No amount of fiddling with schemas will change this.
>>
>>J.Pietschmann
>>
>>
>>
>>
>Yes, thanks, but does the nxml parser forbid it? It would be very
>convinient if the parser allowed it. Is it possible in some way to allow
>it?
>
>Or, maybe rather: Is is easy to change the nxml-parser to allow < and &
>in attribute values?
>
>
Here are some further comments if someone is thinking about this:


The idea of
.php web pages as far as I understand it is that a php page looks like a
xhtml (or html) page except for some parts having the special <?php ..
?> markup. These parts are preprocessed by php before the page is sent
to the users browser.

I guess that in a well formed php page <?php ... ?> part corresponds to
something that perhaps can be called a "syntactic unit" (this name is
just my invention) in xml. It could be a whole tag or an attribute value
for example.

It seems like nxml knows a bit about the <?php ... ?> syntax. If it is
at "tag level" then at least nxml-forward-element passes that part if it
is in the inner of an element to move over. Is there something in the
xml specifications that corresponds to this behaviour?

However when <?php ... ?> is the attribute value then nxml parser fails
to handle it (and it should). I suspect that it fails very early in the
parsing. It looks like there is a regexp pattern in xmltok.el called
xmltok-attribute that does not allow < in the attribute value. But I am
not sure of this, since I do not understand how it works. Maybe it is
possible to change this regexp pattern, but later phases in the parsing
process might depend on it.

And then in a later phase (I guess) the attribute value check must be
skipped.

This was just some comments if anyone else is also interested in getting
this working. The reason someone maybe could be is that nxml is good for
editing xhtml files.

#1085 From: Søren Lund <soren@...>
Date: Mon Nov 7, 2005 7:23 am
Subject: Re: php and nxml
soren_lund
Send Email Send Email
 
--- In emacs-nxml-mode@yahoogroups.com, Lennart Borgman
<lennart.borgman.073@s...> wrote:
>
> I have something like this in a php file:
>
>     <a href="<?php echo get_settings('home'); ?>">Home</a>
>

The above way of doing php is a bit "old fashioned". I would suggest
switching to a template engine, like Smarty (http://smarty.php.net/).
Then the line could be written as:

    <a href="{$settings[home]}">Home</a>

Not only does it look nicer to humans, it shouldn't upset the nxml
parser (and you get all the extra features that Smarty delivers).


- Søren

#1086 From: Lennart Borgman <lennart.borgman.073@...>
Date: Mon Nov 7, 2005 1:32 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Søren Lund wrote:

>--- In emacs-nxml-mode@yahoogroups.com, Lennart Borgman
><lennart.borgman.073@s...> wrote:
>
>
>>I have something like this in a php file:
>>
>>    <a href="<?php echo get_settings('home'); ?>">Home</a>
>>
>>
>>
>
>The above way of doing php is a bit "old fashioned". I would suggest
>switching to a template engine, like Smarty (http://smarty.php.net/).
>Then the line could be written as:
>
>   <a href="{$settings[home]}">Home</a>
>
>Not only does it look nicer to humans, it shouldn't upset the nxml
>parser (and you get all the extra features that Smarty delivers).
>
>
>
>
Thanks Søren. I did not know about that. However in this particular case
I am not the author, rather the user. The application I am using is
WordPress. I thought I would not roll my own this time ...

I think it is a more general issue with nxml-mode. I do not believe
James Clark thought that we should use it for php pages. They are of
course not xml. But since he wrote such a nice peace of software it is
tempting to try to use it for a little bit more than he thought of at
the time he wrote it.

I looked a bit at the code, but it is not easy. What I am thinking about
is if there would be any way to tell the scanner to just skip over
certain parts. If it could skip over <?php ... ?> that would do the
trick here. That could perhaps be generalized to other situations where
nxml should not scan the whole file. (Style tags for example.)

Ideas are wellcome!;-)

#1087 From: Dave Pawson <dave.pawson@...>
Date: Mon Nov 7, 2005 2:01 pm
Subject: Re: Re: php and nxml
dpawson2000
Send Email Send Email
 
On 07/11/05, Lennart Borgman <lennart.borgman.073@...> wrote:

> I think it is a more general issue with nxml-mode. I do not believe
> James Clark thought that we should use it for php pages.

No, it is written for XML, and handles that very well.
If you choose to use it for other syntax's then you'll need
to accept that there are risks.


>
> I looked a bit at the code, but it is not easy. What I am thinking about
> is if there would be any way to tell the scanner to just skip over
> certain parts. If it could skip over <?php ... ?>

Why, when that would screw the handling of XML?
http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-pi

regards


-
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

#1088 From: Lennart Borgman <lennart.borgman.073@...>
Date: Mon Nov 7, 2005 3:14 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Dave Pawson wrote:

>No, it is written for XML, and handles that very well.
>If you choose to use it for other syntax's then you'll need
>to accept that there are risks.
>
>
Yes, I know and I agree. It is just that it would be nice in my opinion
to have a little bit tweaked nxml-mode working for php as well. But php
pages are not always xml. Please excuse me and correct me however if I
say stupidities, I am not at all an xml expert!

>
>
>
>>I looked a bit at the code, but it is not easy. What I am thinking about
>>is if there would be any way to tell the scanner to just skip over
>>certain parts. If it could skip over <?php ... ?>
>>
>>
>
>Why, when that would screw the handling of XML?
>http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-pi
>
>
Thanks. Can you please explain this a bit to me? Does that mean that
<?php ... ?> could be part of an xml document when it is on "tag level"?
I was not aware of that.

My current problem is that <?php ... ?> is used as attribute value,
something like this:

     <a href="<?php home_page(); ?>">Home</a>

That is not allowed in xml I have learned now. All I want now is
nxml-mode to forgive this bad syntax and pretend it is good (using some
switch). Maybe it is a bad idea, but I can not find any better at the
moment?

#1089 From: Dave Pawson <dave.pawson@...>
Date: Mon Nov 7, 2005 3:24 pm
Subject: Re: Re: php and nxml
dpawson2000
Send Email Send Email
 
On 07/11/05, Lennart Borgman <lennart.borgman.073@...> wrote:

> Yes, I know and I agree. It is just that it would be nice in my opinion
> to have a little bit tweaked nxml-mode working for php as well. But php
> pages are not always xml.

Which makes the two things incompatible?
XML and *some* php files?



> >>I looked a bit at the code, but it is not easy. What I am thinking about
> >>is if there would be any way to tell the scanner to just skip over
> >>certain parts. If it could skip over <?php ... ?>
> >>
> >>
> >
> >Why, when that would screw the handling of XML?
> >http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-pi
> >
> >
> Thanks. Can you please explain this a bit to me? Does that mean that
> <?php ... ?> could be part of an xml document when it is on "tag level"?
> I was not aware of that.

Yes, if you look at the url, it is a Processing instruction;
Meant to be application specific,
e.g.
<?mynewPage ?> might be used to output a new page in a page oriented
application.




>
> My current problem is that <?php ... ?> is used as attribute value,
> something like this:
>
>     <a href="<?php home_page(); ?>">Home</a>
>
> That is not allowed in xml I have learned now. All I want now is
> nxml-mode to forgive this bad syntax and pretend it is good (using some
> switch). Maybe it is a bad idea, but I can not find any better at the
> moment?

http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-AttValue

	 AttValue    ::=    '"' ([^<&"] | Reference)* '"'
			 |  "'" ([^<&'] | Reference)* "'"

So it looks like an XML attribute cannot contain the '<'  character?


Perhaps a PHP mode for emacs, if there is one?
http://sourceforge.net/projects/php-mode/  etc.

If you want nxml-mode to do something it is not meant to do,
then you will have to modify it?

regards



--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

#1090 From: Vincent Lefevre <vincent@...>
Date: Mon Nov 7, 2005 3:26 pm
Subject: Re: Re: php and nxml
vinc17fr
Send Email Send Email
 
On 2005-11-07 14:32:53 +0100, Lennart Borgman wrote:
> I think it is a more general issue with nxml-mode.

It is not a nxml-mode issue, but a PHP issue.

> I do not believe James Clark thought that we should use it for php
> pages. They are of course not xml. But since he wrote such a nice
> peace of software it is tempting to try to use it for a little bit
> more than he thought of at the time he wrote it.

There exists a php-mode. Why don't you use it? If you don't like
some features in it either, then this is this mode that should be
modified, not nxml-mode, that works very well with XML.

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

#1091 From: Lennart Borgman <lennart.borgman.073@...>
Date: Mon Nov 7, 2005 3:30 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Dave Pawson wrote:

>Which makes the two things incompatible?
>XML and *some* php files?
>
>
Yes.

>Yes, if you look at the url, it is a Processing instruction;
>Meant to be application specific,
>e.g.
><?mynewPage ?> might be used to output a new page in a page oriented
>application.
>
>
Thanks, I see. Then it looks like php was written to be xml compliant,
but that it fails in the case below.

>>My current problem is that <?php ... ?> is used as attribute value,
>>something like this:
>>
>>    <a href="<?php home_page(); ?>">Home</a>
>>
>>That is not allowed in xml I have learned now. All I want now is
>>nxml-mode to forgive this bad syntax and pretend it is good (using some
>>switch). Maybe it is a bad idea, but I can not find any better at the
>>moment?
>>
>>
>
>http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-AttValue
>
> AttValue    ::=    '"' ([^<&"] | Reference)* '"'
> 	 |  "'" ([^<&'] | Reference)* "'"
>
>So it looks like an XML attribute cannot contain the '<'  character?
>
>
Thanks.

>
>Perhaps a PHP mode for emacs, if there is one?
>http://sourceforge.net/projects/php-mode/  etc.
>
>
nxml-mode is better for my purposes I believe ;-)

>If you want nxml-mode to do something it is not meant to do,
>then you will have to modify it?
>
>
Yes, I am trying to understand how to do this little modification.
Asking here is a way of clearing my thoughts and also getting to know if
someone else has tried this.

#1092 From: Vincent Lefevre <vincent@...>
Date: Mon Nov 7, 2005 3:48 pm
Subject: Re: Re: php and nxml
vinc17fr
Send Email Send Email
 
On 2005-11-07 16:14:44 +0100, Lennart Borgman wrote:
> My current problem is that <?php ... ?> is used as attribute value,
> something like this:
>
>     <a href="<?php home_page(); ?>">Home</a>
>
> That is not allowed in xml I have learned now. All I want now is
> nxml-mode to forgive this bad syntax and pretend it is good (using some
> switch). Maybe it is a bad idea, but I can not find any better at the
> moment?

I think the only way would be a configuration variable that makes
"<" allowed in an attribute; normal users would let it set to nil,
and PHP users could set it to allow things like:

   <a href="<?php home_page(); ?>">Home</a>

I haven't looked at the code (a nxml-mode developer could tell you),
and I'm not sure that this is possible since nxml-mode should allow
to cope with "errors" in a nice way for the user. I mean, when you
are editing a document, errors must occur just because you haven't
finished editing it.

For instance, consider

   <elem attr="><child>"></child></elem>
               ^cursor

that can happen when you're adding an attribute. If "<" is allowed
in an attribute value, then the error information given by nxml-mode
would have to be very different. So, assuming that "<" can sometimes
be allowed could make the code (current or future) not adapted for
normal XML users. In short, this is not acceptable.

If this just needs a few lines change, why not... But I wonder if
this would solve any problem. If " is allowed inside <?php ... ?>,
then I don't think there would be a simple change in nxml-mode.

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

#1093 From: Lennart Borgman <lennart.borgman.073@...>
Date: Mon Nov 7, 2005 4:02 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Vincent Lefevre wrote:

>I think the only way would be a configuration variable that makes
>"<" allowed in an attribute; normal users would let it set to nil,
>and PHP users could set it to allow things like:
>
>  <a href="<?php home_page(); ?>">Home</a>
>
>
Yes, that is the way I am thinking.

>I haven't looked at the code (a nxml-mode developer could tell you),
>and I'm not sure that this is possible since nxml-mode should allow
>to cope with "errors" in a nice way for the user. I mean, when you
>are editing a document, errors must occur just because you haven't
>finished editing it.
>
>For instance, consider
>
>  <elem attr="><child>"></child></elem>
>              ^cursor
>
>
That is difficult to handle, but at the moment I want to skip that. An
argument would just be anything between "..." (or '...') with the flag
above turned on. For my purpose that would be quite good.

However a better solution would probably be to deal with just that <?php
... ?> inside the attribute value. If there is any such thing then turn
on the flag above for that attribute, otherwise not. (No I am mixing
different meanings of "flag" - global or local - but I think this is
possible to understand?)

>If this just needs a few lines change, why not... But I wonder if
>this would solve any problem. If " is allowed inside <?php ... ?>,
>then I don't think there would be a simple change in nxml-mode.
>
>
Maybe that could be handled with a little extension to what I suggested
as the "bigger" solution above.

Now I will take some rest and think about it. Thanks everyone for the
comments! More comments are still wellcome!

#1094 From: Justus Piater <Justus.Piater@...>
Date: Wed Nov 9, 2005 9:49 am
Subject: Re: Re: php and nxml
jpiater
Send Email Send Email
 
I use emacs' mmm-mode (http://mmm-mode.sourceforge.net/) for exactly
this purpose. It allows to assign different major modes to different
sections within the same buffer. I have set it up to handle .php files
under nxml-mode, but <?php...?> sections within them are handled by
php-mode. Works well for me (after some tweaking for my particular
setup; ask for details if you run into problems.)

Justus

--
Justus H. Piater, Ph.D.         http://www.montefiore.ulg.ac.be/~piater/
Institut Montefiore, B28        Phone: +32-4-366-2279
Université de Liège, Belgium    Fax:   +32-4-366-2620

#1095 From: Lennart Borgman <lennart.borgman.073@...>
Date: Wed Nov 9, 2005 10:02 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Justus Piater wrote:

>I use emacs' mmm-mode (http://mmm-mode.sourceforge.net/) for exactly
>this purpose. It allows to assign different major modes to different
>sections within the same buffer. I have set it up to handle .php files
>under nxml-mode, but <?php...?> sections within them are handled by
>php-mode. Works well for me (after some tweaking for my particular
>setup; ask for details if you run into problems.)
>
>
Thanks Justus, that sounds nice. There is actually an entry on
http://www.emacswiki.org/cgi-bin/wiki/NxmlModeForXHTML where Dean Scarff
says he has got mmm-mode nearly working with nxml-mode. Maybe you could
have a look at that and clarify how you got it working? You could send
me the info and I can edit the wiki page or you can edit the wiki page
yourself.

Does indentation also work with mmm-mode?

#1096 From: Justus Piater <Justus.Piater@...>
Date: Fri Nov 11, 2005 10:19 am
Subject: Re: Re: php and nxml
jpiater
Send Email Send Email
 
Lennart Borgman <lennart.borgman.073@...> wrote on Wed, 09
Nov 2005 23:02:37 +0100:

> Justus Piater wrote:
>>I use emacs' mmm-mode (http://mmm-mode.sourceforge.net/)
>>
> There is actually an entry on
> http://www.emacswiki.org/cgi-bin/wiki/NxmlModeForXHTML where Dean
> Scarff says he has got mmm-mode nearly working with nxml-mode. Maybe
> you could have a look at that and clarify how you got it working?

I think it worked out-of-the-box. All I did specially has to do with
my personal setup:

- Most of my PHP pages require() a header and a footer, so they are
   not valid XHTML documents. I worked around this by defining a
   trivial customization of the XHTML rnc grammar that is happy with a
   <div> root element. This requires that each .php source's content be
   enclosed in a <div>, but this does not impose any limitations.

- My pages use ISO-8859-1 encoding, whereas nxml-mode insists on utf-8
   unless otherwise specified in the xml declaration. However, with my
   setup an xml declaration would yield invalid XHTML, so I cannot use
   it. My (ugly) workaround is to set write-contents-hooks to nil in
   the Local variables: section, which requires user confirmation when
   the file is loaded into Emacs. It would be nice if nxml-mode
   included a customizable local variable for the default encoding, but
   James Clark seems too busy.

The fontification problems associated with mmm-mode are real, but I
don't find them too disturbing. When you edit a PHP section, sooner or
later the fontification will catch up.

IIRC, the upcoming Emacs release will provide native support for
multiple major modes within a single buffer.

> Does indentation also work with mmm-mode?

Yes, no problem.

Justus

--
Justus H. Piater, Ph.D.         http://www.montefiore.ulg.ac.be/~piater/
Institut Montefiore, B28        Phone: +32-4-366-2279
Université de Liège, Belgium    Fax:   +32-4-366-2620

#1097 From: Lennart Borgman <lennart.borgman.073@...>
Date: Fri Nov 11, 2005 1:28 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Justus Piater wrote:

>I think it worked out-of-the-box.
>
  From your comments it looks more like out-of-the-head  ;-)

>- Most of my PHP pages require() a header and a footer, so they are
>  not valid XHTML documents. I worked around this by defining a
>  trivial customization of the XHTML rnc grammar that is happy with a
>  <div> root element.
>
>
I would be glad if you wanted to share this "trivial" customization with
us. That would perhaps be good for a start.

>- My pages use ISO-8859-1 encoding, whereas nxml-mode insists on utf-8
>  unless otherwise specified in the xml declaration. However, with my
>  setup an xml declaration would yield invalid XHTML, so I cannot use
>  it. My (ugly) workaround is to set write-contents-hooks to nil in
>  the Local variables: section, which requires user confirmation when
>  the file is loaded into Emacs. It would be nice if nxml-mode
>  included a customizable local variable for the default encoding, but
>  James Clark seems too busy.
>
>
Hm. Could be part of another problem I have seen where I have trouble
enter an a with ring. Would not that be a trivial change? ;-)

>The fontification problems associated with mmm-mode are real, but I
>don't find them too disturbing. When you edit a PHP section, sooner or
>later the fontification will catch up.
>
>
Thanks for the info. But does not nxml-mode still insists on fontifying
the php sections?

>IIRC, the upcoming Emacs release will provide native support for
>multiple major modes within a single buffer.
>
>
Is it? Can you tell me what you think of? This is nothing that I am
aware of, but it would be very good.

>
>
>>Does indentation also work with mmm-mode?
>>
>>
>
>Yes, no problem.
>
>
Thanks, then maybe I should learn more about how indentation works in
php-mode. Which php-mode where you using? (BTW it would be good if they
had different names.)

#1098 From: Jason Rumney <jasonr@...>
Date: Fri Nov 11, 2005 1:38 pm
Subject: Re: Re: php and nxml
jprumney
Send Email Send Email
 
Lennart Borgman wrote:

>Justus Piater wrote:
>
>
>> It would be nice if nxml-mode
>> included a customizable local variable for the default encoding, but
>> James Clark seems too busy.
>>
>>
>Hm. Could be part of another problem I have seen where I have trouble
>enter an a with ring. Would not that be a trivial change? ;-)
>
>
It might be trivial, but it would also be wrong. Part of the xml spec is
that the encoding is utf-8 unless otherwise specified in the xml header.
The strength of nxml-mode compared to psgml-mode and others is that it
limits itself to XML, and does that well. All these hacks to make
nxml-mode work better with not-quite-xml documents would be better done
with psgml-mode or another SGML mode, that is designed to handle these
sorts of cases.

#1099 From: Lennart Borgman <lennart.borgman.073@...>
Date: Fri Nov 11, 2005 2:00 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Jason Rumney wrote:

>It might be trivial, but it would also be wrong. Part of the xml spec is
>that the encoding is utf-8 unless otherwise specified in the xml header.
>The strength of nxml-mode compared to psgml-mode and others is that it
>limits itself to XML, and does that well. All these hacks to make
>nxml-mode work better with not-quite-xml documents would be better done
>with psgml-mode or another SGML mode, that is designed to handle these
>sorts of cases.
>
>
Thanks, then the current behaviour is surely correct from that point of
view. However in my case I will have to think about a workaround since
php was not fond of the xhtml spec.

Perhaps psgml-mode would be better to use for files that are not all
xml, like php files. But nxml-mode is very nice because it knows the DTD
and can help with syntax. It is also very nice because it tries to
"resync" with the DTD if there is an error in the file. Am I missing
something about psgml-mode?

I still have the feeling that it could be good to have a way for
nxml-mode to not care about certain parts of the file. Even if that is
not correct xml syntax it could be very useful for editing php files for
example. I guess no one would think it is correct xml syntax so it does
not disturb the user. Maybe it destroys the nxml code and that would be
very bad. To me it seems however that the possiblity to tell nxml-mode
to neglect region is nearly there since rng can "resync".

A problem is I do not understand this things very well and the nxml code
is difficult, at least for me. For someone who understands the code well
it could be a very small and rather trivial change.

#1100 From: Dave Pawson <dave.pawson@...>
Date: Fri Nov 11, 2005 2:15 pm
Subject: Re: Re: php and nxml
dpawson2000
Send Email Send Email
 
On 11/11/05, Lennart Borgman <lennart.borgman.073@...> wrote:



> Perhaps psgml-mode would be better to use for files that are not all
> xml, like php files.

> I guess no one would think it is correct xml syntax so it does
> not disturb the user.
But it does 'disturb' the validity to the XML standard, as used by nxml-mode?

> Maybe it destroys the nxml code and that would be
> very bad.

Yes, I agree. nxml-mode is very good for XML.
Let's keep it that way.



Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

#1101 From: Lennart Borgman <lennart.borgman.073@...>
Date: Fri Nov 11, 2005 2:20 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Dave Pawson wrote:

>
>But it does 'disturb' the validity to the XML standard, as used by nxml-mode?
>
>
Why? Nxml could just as now say that the buffer is not valid XML syntax.

#1102 From: David Reitter <david.reitter@...>
Date: Fri Nov 11, 2005 3:09 pm
Subject: run-mode-hooks instead of run-hooks
davidswelt
Send Email Send Email
 
Hi,

it seems like the hooks in after-change-major-mode-hook are not run
when entering nxml-mode.
  From what I can see, this is due to using run-hooks instead of run-
mode-hooks.

Best,
David

--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://www.reitter-it-media.de



*** nxml-mode.old.el    Sat Oct  2 12:56:50 2004
--- nxml-mode.el        Fri Nov 11 14:48:53 2005
***************
*** 585,591 ****
          (setq buffer-file-coding-system nxml-default-buffer-file-
coding-system))
        (when nxml-auto-insert-xml-declaration-flag
          (nxml-insert-xml-declaration)))
!   (run-hooks 'nxml-mode-hook))

    (defun nxml-degrade (context err)
      (message "Internal nXML mode error in %s (%s), degrading"
--- 585,591 ----
          (setq buffer-file-coding-system nxml-default-buffer-file-
coding-system))
        (when nxml-auto-insert-xml-declaration-flag
          (nxml-insert-xml-declaration)))
!   (run-mode-hooks 'nxml-mode-hook))

    (defun nxml-degrade (context err)
      (message "Internal nXML mode error in %s (%s), degrading"

#1103 From: "davidswelt" <david.reitter@...>
Date: Sat Nov 12, 2005 11:55 am
Subject: Re: run-mode-hooks instead of run-hooks
davidswelt
Send Email Send Email
 
--- In emacs-nxml-mode@yahoogroups.com, David Reitter <david.reitter@g...>
wrote:

> it seems like the hooks in after-change-major-mode-hook are not run
> when entering nxml-mode.
>  From what I can see, this is due to using run-hooks instead of run-
> mode-hooks.

And if you want to be backwards-compatible (run-mode-hooks doesn't exist in
older Emacs
versions, possibly <21.3):

(if (fboundp 'run-mode-hooks)
     (run-mode-hooks ',hook)
   (run-hooks ',hook))

#1104 From: Justus Piater <Justus.Piater@...>
Date: Mon Nov 14, 2005 10:25 am
Subject: Re: Re: php and nxml
jpiater
Send Email Send Email
 
Lennart Borgman <lennart.borgman.073@...> wrote on Fri, 11
Nov 2005 14:28:48 +0100:

> I would be glad if you wanted to share this "trivial" customization with
> us. That would perhaps be good for a start.

Here's what I use:

-------------------------------------------------------------------------
# div blocks containing a subset of XHTML Strict, without namespace

include "datatypes.rnc"
include "attribs.rnc"

include "struct.rnc" {
     start = \div
   }

include "text.rnc"
include "hypertext.rnc"
include "list.rnc"
include "image.rnc"
include "base.rnc"
include "link.rnc"
include "meta.rnc"
include "param.rnc"
include "object.rnc"
include "pres.rnc"
include "edit.rnc"
include "form.rnc"
include "style.rnc"
include "script.rnc"
include "table.rnc"
include "events.rnc"
include "inlstyle.rnc"
include "nameident.rnc"
-------------------------------------------------------------------------

I don't remember why I stripped the namespace, probably because the
namespace declaration is generated by included PHP code and is not
visible within my .php files.

> Hm. Could be part of another problem I have seen where I have trouble
> enter an a with ring. Would not that be a trivial change? ;-)

C-c C-u "latin small letter a with ring above" works perfectly for me.

> Thanks for the info. But does not nxml-mode still insists on fontifying
> the php sections?

Yes, intermittently, but I can live with that.

>>IIRC, the upcoming Emacs release will provide native support for
>>multiple major modes within a single buffer.
>>
> Is it? Can you tell me what you think of? This is nothing that I am
> aware of, but it would be very good.

From the Emacs TODO:

** Implement a clean way to use different major modes for
   different parts of a buffer.

So, it's on the wish list, but who knows when it will become
reality. It is not mentioned in the NEWS (yet). That's all I know.

> Which php-mode where you using?

;;; php-mode.el --- major mode for editing PHP code

;; Copyright (C) 1999-2004 Turadg Aleahmad

;; Maintainer: Turadg Aleahmad <turadg at users.sourceforge.net>
;; Keywords: php languages oop
;; Created: 1999-05-17
;; Modified: 2004-01-24
;; X-URL:   http://php-mode.sourceforge.net/

(defconst php-version "1.1.0"
   "PHP Mode version number.")


Jason Rumney <jasonr@...> wrote on Fri, 11 Nov 2005 13:38:25
+0000:

>>Justus Piater wrote:
>>
>>> It would be nice if nxml-mode included a customizable local
>>> variable for the default encoding
>>
> It might be trivial, but it would also be wrong. Part of the xml spec is
> that the encoding is utf-8 unless otherwise specified in the xml header.

You are absolutely right. I abuse nxml-mode to help me edit text that
is not XML but very close to it.

Justus

--
Justus H. Piater, Ph.D.         http://www.montefiore.ulg.ac.be/~piater/
Institut Montefiore, B28        Phone: +32-4-366-2279
Université de Liège, Belgium    Fax:   +32-4-366-2620

#1105 From: Vincent Lefevre <vincent@...>
Date: Mon Nov 14, 2005 11:08 am
Subject: Re: Re: php and nxml
vinc17fr
Send Email Send Email
 
On 2005-11-11 15:20:01 +0100, Lennart Borgman wrote:
> Dave Pawson wrote:
> >But it does 'disturb' the validity to the XML standard, as used by
> >nxml-mode?
> >
> Why? Nxml could just as now say that the buffer is not valid XML syntax.

nxml-mode does more than that. It also says where the errors are and
does this very nicely, with a minimal set of errors. For instance, the
fact that the character < cannot appear in an attribute value is used
by nxml-mode in this way. Allowing the user to say that some parts
should be ignored would probably make things much more complicated to
do validation on the fly.

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

#1106 From: Vincent Lefevre <vincent@...>
Date: Mon Nov 14, 2005 11:02 am
Subject: Re: Re: php and nxml
vinc17fr
Send Email Send Email
 
On 2005-11-11 15:00:43 +0100, Lennart Borgman wrote:
> Perhaps psgml-mode would be better to use for files that are not all
> xml, like php files. But nxml-mode is very nice because it knows the DTD
> and can help with syntax. It is also very nice because it tries to

nxml-mode doesn't use the DTD (or possibly only for entities?), but
a RNC schema.

> I still have the feeling that it could be good to have a way for
> nxml-mode to not care about certain parts of the file.

Only if this wouldn't bloat it; nxml-mode must still be very fast
in the "normal" cases.

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

#1107 From: Vincent Lefevre <vincent@...>
Date: Mon Nov 14, 2005 11:18 am
Subject: Re: Re: php and nxml
vinc17fr
Send Email Send Email
 
On 2005-11-14 11:25:24 +0100, Justus Piater wrote:
> Jason Rumney <jasonr@...> wrote on Fri, 11 Nov 2005 13:38:25
> +0000:
>
> >>Justus Piater wrote:
> >>
> >>> It would be nice if nxml-mode included a customizable local
> >>> variable for the default encoding
> >>
> > It might be trivial, but it would also be wrong. Part of the xml
> > spec is that the encoding is utf-8 unless otherwise specified in
> > the xml header.
>
> You are absolutely right. I abuse nxml-mode to help me edit text
> that is not XML but very close to it.

No, this is not completely true. The encoding may be specified in an
external way. A customizable local variable could be such an external
declaration; so, such a feature would be acceptable and not contrary
to the XML specification, which says:

4.3.3 Character Encoding in Entities
[...]
   Although an XML processor is required to read only entities in the
   UTF-8 and UTF-16 encodings, it is recognized that other encodings
   are used around the world, and it may be desired for XML processors
   to read entities that use them. In the absence of external character
   encoding information (such as MIME headers), parsed entities which
   are stored in an encoding other than UTF-8 or UTF-16 MUST begin with
   a text declaration (see 4.3.1 The Text Declaration) containing an
   encoding declaration:
[...]

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

#1108 From: Lennart Borgman <lennart.borgman.073@...>
Date: Mon Nov 14, 2005 2:32 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Vincent Lefevre wrote:

>nxml-mode does more than that. It also says where the errors are and
>does this very nicely, with a minimal set of errors. For instance, the
>fact that the character < cannot appear in an attribute value is used
>by nxml-mode in this way. Allowing the user to say that some parts
>should be ignored would probably make things much more complicated to
>do validation on the fly.
>
>
I guess the result would be no better and no worse than if the sections
to ignore where just erased instead.

At least that is the simple case I am after now. It could perhaps be
made better. You could say that what will be inserted will make the
final document valid XML. Probably that would require quite a lot more
effort.

#1109 From: Lennart Borgman <lennart.borgman.073@...>
Date: Mon Nov 14, 2005 3:06 pm
Subject: Re: Re: php and nxml
nlborgman
Send Email Send Email
 
Justus Piater wrote:

>Here's what I use:
>
>
Thanks for the education. I save this.

>C-c C-u "latin small letter a with ring above" works perfectly for me.
>
>
I had no idea this was there. Thanks.

>>Which php-mode where you using?
>>
>>
>
>;;; php-mode.el --- major mode for editing PHP code
>
>;; Copyright (C) 1999-2004 Turadg Aleahmad
>
>;; Maintainer: Turadg Aleahmad <turadg at users.sourceforge.net>
>;; Keywords: php languages oop
>;; Created: 1999-05-17
>;; Modified: 2004-01-24
>;; X-URL:   http://php-mode.sourceforge.net/
>
>(defconst php-version "1.1.0"
>  "PHP Mode version number.")
>
>
On the page http://www.emacswiki.org/cgi-bin/wiki/PhpMode it says that
this modes misbehaves sometimes. What do you think about that?

(I am using the other php mode because of the statement on that page.)

Messages 1080 - 1109 of 2146   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help