Re: using ixml with mixed content - a design problem

I was going to say, you can use a rule like

 content: c*.
 -c: ~["<"]; lt.
 -lt: -"<", +"&lt;".

but then I realised that this works just fine:

 content: ~[]*.


Input:
<test lang="en" class='test'>
  This <em>is</em> a test.
</test>


Output:
<content>&lt;test lang="en" class='test'>
  This &lt;em>is&lt;/em> a test.
&lt;/test>
</content>

Steven

On Monday 19 June 2023 13:34:21 (+02:00), Norm Tovey-Walsh wrote:

> > In the short run, serializing and reparsing is going to simpler and
> > quicker to implement.
> 
> It does occur to me that if the markup iXML adds isn’t well balanced
> with respect to the serialized markup, you’re going to run into trouble.
> For example, if
> 
>   here’s a
>   <start>
>   thing
>   </start>
> 
> becomes
> 
>   here’s a
>   <start>
>   thing
>   </start>
> 
> > For the literate programming case, the XML that can occur within a code
> > scrap is restricted enough that serializing the XML and re-parsing it
> > would not be too hard.  For the Roman history case, and other cases in
> > general, where the XML might be arbitrarily complex, I really like
> > Liam's idea of an easy-to-parse placeholder, which can easily be
> > replaced with the original element (or other item).
> 
> Yes, that works too.
> 
> NineML is prepared to parse a sequence of tokens. For iXML, that’s a
> sequence of characters, but it doesn’t have to be. What would happen if
> it wasn’t is, uh, untested. :-)
> 
>                                         Be seeing you,
>                                           norm
> 
> --
> Norm Tovey-Walsh
> Saxonica
> 

Received on Monday, 19 June 2023 14:55:54 UTC