Re: Re: entities in SXML

"Oleg A. Paraschenko" <[email protected]> Sun, 13 Mar 2005 02:38:39 +0300
Newsgroups gmane.lisp.scheme.ssax-sxml
Organization private person
Message-ID <[email protected]>
  Hello,

On Sat, 12 Mar 2005 00:11:58 -0800 (PST)
[email protected] wrote:

> 
> Hello!
> 
> There seems to be two problems: 
>     - of parser's letting the application know of `parsed',
> internal entities (which the parser normally silently inlines)
>     - SXML notation for such entities
> 
> Right? I think we're discussing the latter.

  Yes, we're discussing the latter.

> 
> Just for the record, the former problem can be solved, but it does
> pose challenges. For example, if
> 	&gt;
> appears within element content, there is no problem in general of
> representing it with (*REF* "gt") rather than with text fragment ">".
> 
> However, "&gt;" may appear within the attribute value, e.g.,
> 
> 	<a href="schema://xxxxx/&gt;xxxxx"> xxxx</a>
> 
> Now, what do we do? The value of an attribute must be a string, it
> can't include non-string SXML fragments. It's not for nothing that XML
> grammar specifically prohibits any `structure' within the attribute
> value. The attribute value must be a string. So, we can't use (*REF*
> here). The XML Recommendation (section 4.4.4) is quite clear that any
> appearance of an unparsed or external parsed entity (that is, any
> entity that can't be inlined by even a non-validating parser) is a
> _fatal_ error. Please also see Section 3.3.3, Attribute value
> normalization. The specification compels the parser to produce a
> string value (and use a particular normalization algorithm, or an
> observational equivalent thereof).

  Thank you very much for links. Unfortunately, you seem to be right
that the value of an attribute must be a string.

  But if a program expects to get an "extended" attribute value, it's
ok to give it

(a
   (@ (href "schema://xxxxx/" (& gt) "xxxxx"))
  " xxxx")


  Backgroud information: I write XML document by hand. I use entities.
Sometimes I want to modify the documents using XSLT. Obviously, I don't
want to lose the entities. Current workaround is to change &xxx; to
something like ###xxx### before processing and change all back after
processing. I think that SXML solution with "extended" attributes might
be a better alternative.

> 
> 
> Regarding the notational problem:
> 
> > http://sourceforge.net/mailarchive/message.php?msg_id=7743681
> >
> >   It suggests trying a the existing SXML notation *ENTITY*. But, in my
> > opinion, it's just an ugly workaround, not a clean solution.
> 
> What exactly is the problem with using *ENTITY* for marking not only
> unexpanded (external parsed) entities but the internal general
> entities as well?

  I'm afraid of ambiguity. What is the meaning of

(*ENTITY* "nbsp")

  Is it a reference to the character &#a0; or to the file named "nbsp"?

  The second problem is that a casual reader of my program might miss that
I work beyond the SXML specification.

> Is it verbosity, or is there a another reason? If
> verbosity, then Neil's notation seems to be the most concise and can
> serve the purposes here too.

  Well, now I use Neil's notation.

> 
> 	Cheers,
> 	Oleg
> 
>

--
Oleg Paraschenko 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click