You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Jean-Daniel Fekete <Je...@emn.fr> on 2001/04/08 17:24:13 UTC

SAC and CSS

Hello to the list, and thanks for the excellent package.

I am currently adding SAC support to xerces-c and soon CSS/DOM.  Would that be of interest for people maintaining the xerces-c package?

How should I proceed to have it available for everyone?

  Jean-Daniel Fekete
  Ecole des Mines de Nantes, 4 rue Alfred Kastler, La Chantrerie,
  BP 20722, 44307 Nantes Cedex 03, France
  Voice: +33-2-51-85-82-08  | Fax: +33-2-51-85-82-49
  Jean-Daniel.Fekete@emn.fr | http://www.emn.fr/fekete/




Re: SAC and CSS

Posted by Jean-Daniel Fekete <Je...@emn.fr>.
There are two reasons (in no particular order):
1) implementing SAC shares several mechanisms with SAX and relying on
Xerces-C simplify its implementation
2) applying a CSS style sheet on an XML document requires to search inside
the DOM and therefore needs an implementation of the DOM.

Much like with SAX, you could either parse "on the fly" or load the document
first and use it afterwards.
Having a DOM/CSS implementation inside Xerces-C would enable some queries
like: what are all the style attributes for a given element node?
SVG and XHTML allow an attribute called "style" to specify graphic
attributes or override rules.
For example, a toplevel CSS rule might say the H1 elements are in red with
the following rule:
H1 { color: red; }
Whereas a specific element may change that by saying <H1 style="color:
blue;">..
This mechanism is also used by SVG.
A user program that needs to compute the graphical/typographical attributes
for each element would then ask DOM/CSS to resolve the inherited and
overriden values itself.

Style attributes depend on the element names, their attributes and lots of
context computed by DOM-CSS that could be optimized when the internal
structure of the DOM is known.
If Xerces-C users want to implement "styled" DTDs, then SAC and DOM-CSS is a
great relief for them.  Others won't care.

I once thought about an "add-on" to Xerces-C, much like Xalan.  However,
DOM-CSS is much simpler than XSLT and could be -- in my opinion -- included
inside Xerces-C without growing it too much.

Also, note that DOM-CSS is part of the DOM specification so it makes sense
to have it inside Xerces-C that is advertised as implementing the DOM
interface in C++.

  Jean-Daniel Fekete
  Ecole des Mines de Nantes, 4 rue Alfred Kastler, La Chantrerie,
  BP 20722, 44307 Nantes Cedex 03, France
  Voice: +33-2-51-85-82-08  | Fax: +33-2-51-85-82-49
  Jean-Daniel.Fekete@emn.fr | http://www.emn.fr/fekete/


----- Original Message -----
From: "Curt Arnold" <ca...@houston.rr.com>
To: <xe...@xml.apache.org>
Sent: Sunday, April 08, 2001 10:20 PM
Subject: Re: SAC and CSS


> Since I hadn't heard of SAC, I thought it might be reasonable that some
> others on the list hadn't either.  SAC is "Simple API for CSS" and was
> submitted as a W3C note last summer: http://www.w3.org/TR/SAC/
>
> I'm curious why a SAC implementation would need to be integrated into the
> XML parser and just an independent layer.  It would seem that a CSS parser
> would be called from an application specific SAX Document handler, for
> example, a DocumentHandler for SVG would know that a <svg:style
> type="text/css"> tag or a style attribute of <svg:rect> (and others) was a
> CSS fragment, however you might have another namespace where style meant
> something else.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: SAC and CSS

Posted by Curt Arnold <ca...@houston.rr.com>.
Since I hadn't heard of SAC, I thought it might be reasonable that some
others on the list hadn't either.  SAC is "Simple API for CSS" and was
submitted as a W3C note last summer: http://www.w3.org/TR/SAC/

I'm curious why a SAC implementation would need to be integrated into the
XML parser and just an independent layer.  It would seem that a CSS parser
would be called from an application specific SAX Document handler, for
example, a DocumentHandler for SVG would know that a <svg:style
type="text/css"> tag or a style attribute of <svg:rect> (and others) was a
CSS fragment, however you might have another namespace where style meant
something else.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: SAC and CSS

Posted by Jean-Daniel Fekete <Je...@emn.fr>.
Here are some explanations:

I am currently working on a high performance SVG engine and use Xerces-C for loading the SVG document in memory.
For this, I need to parse CSS declarations inside the SVG document.  Therefore, I have implemented the W3C SAC API (Simple API for CSS, see http://www.w3.org/Style/CSS/SAC/).
This implementation is very close the the Java implementation and is complete, if not fully tested.
It can load and parse CSS from files, URL or memory strings and call a handler for each event happening in the CSS files.
SAC is the first step towards full DOM/CSS implementation, much like SAX is the first step towards core DOM.

Implementing SAC and CSS/DOM should be useful to any project requiring to load and manage XML files along with the CSS style sheets.  SVG is one, XHTML another one,  as well as SMIL and probably others to come.  Implementing SAC and DOM/CSS without the support of a package such as Xerces-C would require the rewriting of several utility classes already available with Xerces-C, which would be a loss of time and energy.  Including SAC and DOM/CSS in the Xerces-C distribution does not modify any working software.  If footprint is an issue, it could be made optional in the configuration.

I can send a tar file of SAC on that list or make it available on my web site for committers to check (the tgz file is 60k long).
On this current version, all the files are located in the src/sac directory but should probably migrate to others like internals, utils or DOM.
I haven't fully understood the hierarchy in the distribution and rely on different parts from the following src subdirectories: utils, dom, framework and internal.

Besides, the parser is currently written using the ANTLR parser generator (see www.antlr.org).  With sufficient energy, it could be done manually but ANTLR is great and flexible and would allow for a much easier migration to DOM3 when times come.  The main drawback is the need for the ANTLR library, which can be included in the source distribution without legal problem though.

Hoping it helps the community,

  Jean-Daniel Fekete
  Ecole des Mines de Nantes, 4 rue Alfred Kastler, La Chantrerie,
  BP 20722, 44307 Nantes Cedex 03, France
  Voice: +33-2-51-85-82-08  | Fax: +33-2-51-85-82-49
  Jean-Daniel.Fekete@emn.fr | http://www.emn.fr/fekete/

  ----- Original Message ----- 
  From: Dean Roddey 
  To: xerces-c-dev@xml.apache.org 
  Sent: Sunday, April 08, 2001 8:23 PM
  Subject: Re: SAC and CSS


  Post the details of your proposal here for discussion. If its generally agreed to be a good thing and in a sufficiently correct form for the project, and written correctly, one of the committers can check it in for you.

  --------------------------
  Dean Roddey
  The CIDLib C++ Frameworks
  Charmed Quark Software
  droddey@charmedquark.com
  http://www.charmedquark.com

  "The belief that everything is just an illusion,
  is just an illusion"

    ----- Original Message ----- 
    From: Jean-Daniel Fekete 
    To: xerces-c-dev@xml.apache.org 
    Cc: fekete@emn.fr 
    Sent: Sunday, April 08, 2001 8:24 AM
    Subject: SAC and CSS


    Hello to the list, and thanks for the excellent package.

    I am currently adding SAC support to xerces-c and soon CSS/DOM.  Would that be of interest for people maintaining the xerces-c package?

    How should I proceed to have it available for everyone?

      Jean-Daniel Fekete
      Ecole des Mines de Nantes, 4 rue Alfred Kastler, La Chantrerie,
      BP 20722, 44307 Nantes Cedex 03, France
      Voice: +33-2-51-85-82-08  | Fax: +33-2-51-85-82-49
      Jean-Daniel.Fekete@emn.fr | http://www.emn.fr/fekete/




Re: SAC and CSS

Posted by Dean Roddey <dr...@charmedquark.com>.
Post the details of your proposal here for discussion. If its generally agreed to be a good thing and in a sufficiently correct form for the project, and written correctly, one of the committers can check it in for you.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"The belief that everything is just an illusion,
is just an illusion"

  ----- Original Message ----- 
  From: Jean-Daniel Fekete 
  To: xerces-c-dev@xml.apache.org 
  Cc: fekete@emn.fr 
  Sent: Sunday, April 08, 2001 8:24 AM
  Subject: SAC and CSS


  Hello to the list, and thanks for the excellent package.

  I am currently adding SAC support to xerces-c and soon CSS/DOM.  Would that be of interest for people maintaining the xerces-c package?

  How should I proceed to have it available for everyone?

    Jean-Daniel Fekete
    Ecole des Mines de Nantes, 4 rue Alfred Kastler, La Chantrerie,
    BP 20722, 44307 Nantes Cedex 03, France
    Voice: +33-2-51-85-82-08  | Fax: +33-2-51-85-82-49
    Jean-Daniel.Fekete@emn.fr | http://www.emn.fr/fekete/