[gambit-list] sxml>>xml layout question.

Oleg Parashchenko olpa at uucode.com
Fri Feb 17 18:39:17 EST 2012


Hello Hendrik,

one month later, but hopefully still useful.

On Tue, 24 Jan 2012 22:56:32 +0000 (UTC)
Hendrik Boom <hendrik at topoi.pooq.com> wrote:

> Well I got Blackhole to work though I'll still be posting a few 
> suggestions and questions later.  I used it to import and use sxml>>xml 
> successfully.
> 
> It gives me output like
> 
>      ><P
>      >P5There seems to be nothing to say. <S />After a while he
>      >stammers, 
> "Oh, I'm sorry," to fill the silence.</P
>     ><P
>      >P3</P
> 
> instead of the more conventional
> 
>      <P>
>      P5There seems to be nothing to say. <S/>After a while he stammers, 
> "Oh, I'm sorry," to fill the silence.</P>
>      <P>
>      P3</P>
> 
> Is there a technical reason to have the '>' after the newline and the 
> indentation layout instead of before them?  Or is this just the way it 
> happened to get coded?

Actually, these two XML fragments are different. The first one is:

* element "P"
* text "P5There seems to ...
... silence."
* end element "p"
* element "p"
* text "P3"
* end element "p"

And the second is:

* element "P"
* text "
     P5There seems to ...
.... silence."
* end element "p"
* element "p"
* text "
     P3"
* end element "p"

Note that the text elements contain extra whitespace. In this concrete
case, it is not a problem, but in general case the conventional indenting
can change the meaning of the document. However, we still need an XML in
a human-friendly layout instead of a one-line dump. Newline before ">"
is a neat trick, which always correct.


> 
> (Don't worry about the P5There and such -- my application put them
> there by mistake and I'll be dealing with them myself)
> 
> -- hendrik


-- 
Oleg Parashchenko  olpa@ http://uucode.com/
http://uucode.com/blog/  XML, TeX, Python, Mac, Chess




More information about the Gambit-list mailing list