logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: HTML::Mason syntax in XML/HTML files?: msg#00023

Subject: Re: HTML::Mason syntax in XML/HTML files?
Hi Mike,

Thanks for your reply.

I know that <%perl> is not a valid tag.  It (and its contents) actually
gets replaced on the server side as a result of the code execution, much
like a <?php ... ?> tag does in PHP.

So what I would wish is that nXML checks the document for validity
_except_ those sections--just pretend they are comments or something.

Of course, nXML can't possibly know all languages that may be used for
embedding code in HTML/XML, so it would be probably nice if we could
define some regexps for the regions to be ignored.  I'm not sure if this
is already possible, but if it isn't, it would be a great feature! ;-)

Here are the most common tags that HTML::Mason replaces:

        <%perl> ... </%perl>
        <%init> ... </%init>
        <%once> ... </%once>
        <%shared> ... </%shared>
        <%def subcomponent-name> ... </%def>
        <%method method-name> ... </%method>
        <& component-name, args ... &>
        <% expression %>

I listed them all to show that not all of them look the same (the last 2
are somewhat different as there's no "tag" name) so the regexp could be
more complex (or maybe better, allow multiple regexps that define such
areas).

Do you think it's possible to implement that in nXML?

Best regards,
-Mihai

On Sat, 2005-03-19 at 12:45 +0900, Michael Smith wrote:
> mihai_bazon <mihai_bazon@xxxxxxxxx> writes:
> 
> > Hey there, I'm using NXML for quite some time and I was wondering if
> > it's possible to have it ignore certain tags and treat content as
> > CDATA.  For instance, it does pretty well already with <?php ... ?>
> > syntax, as it's like an XML declaration, but not too well with
> > HTML::Mason syntax, which is like <%perl> ... </%perl> or <%args> ...
> > </%args>, etc.
> > 
> > Is it possible to customize this somehow?
> 
> <%perl> isn't well-formed XML. Element names in XML can't contain the
> percent-sign character (or most other non-alphanumeric ASCII
> characters). So even if you could manage to get nXML to ignore it,
> you're going to have problems processing it with an XSLT engine or other
> tools. Because any compliant XML tool you try to process that with is
> not going to reject it as being not well-formed.
> 
> You could just write the HTML::Mason stuff as &lt;%perl>...&lt;perl> or
> even just something like ;%perl>...;/%perl> (which would be same amount
> of typing as what you're using now) and then post-process your HTML
> output (using sed or whatever) to convert ;%perl> to <%perl> :
> 
>   sed 's#;%#<%#; s#;/%#</%#' *.html
> 
> Would that work for you?
> 
>   --Mike
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
-- 
Mihai Bazon,
  www.bazon.net/mishoo
  Founder of www.dynarch.com



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/emacs-nxml-mode/

<*> To unsubscribe from this group, send an email to:
    emacs-nxml-mode-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 






<Prev in Thread] Current Thread [Next in Thread>