Le 13/3/16 18:46, Tudor Girba a écrit :
Hi,

I did OPAX :).

:)
So I'm doing a pass and cleaned it.
I created a small builder to generate subclasses and tags. I will release it soon.
I will play with the FILMS xml to understand what can be a solution.

Then after I will check a bit more the pluggable.

At one point there was an effort around NodeFactory, and we chose to improve 
that one.

Cheers,
Doru

On Mar 13, 2016, at 4:57 PM, stepharo <steph...@free.fr> wrote:

So I wonder why Fabrizio did OPAX do you have an idea?
You get a simple tree but it is worth?
I will finish my improvement on OPAX.

Stef

This class is a pluggable factory that can map elements to different XMLElement 
subclasses based on the name and namespace information of those elements. You 
have to create an instance, configure it to handle certain elements with 
certain classes, and then inject your instance into a DOM parser using 
#nodeFactory: before parsing. Here is an example of its use:

    doc := (XMLDOMParser on: someXML)
        nodeFactory:
            (XMLPluggableElementFactory new
                elementClass: GenericElement;
                handleElement: 'user' withClass: UserElement;
                handleElement: 'report' withClass: ReportElement;
                handleElement: 'report' namespaceURI: 'urn:specialreprot' 
withClass: SpecialReportElement)
        parseDocument.

The #handleElementsMatchingClass*: forms try to match elements to the specified classes 
based on the names of those classes when stripped of any prefix (like XML) and 
"Element" suffix and converted to both camel case and a hyphenated form. So 
this:
    XMLPluggableElementFactory new
        handleElementsMatchingClass: MYRootUserElement
        ....
will handle 'rootUser' and 'root-user' elements with the MYRootUserElement 
class.

--
www.tudorgirba.com
www.feenk.com

"Next time you see your life passing by, say 'hi' and get to know her."








Reply via email to