[jira] Created: (OFBIZ-2390) Proof Of Concept: SAX Parsing in Screen Widgets

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-2390) Proof Of Concept: SAX Parsing in Screen Widgets

Nicolas Malin (Jira)
Proof Of Concept: SAX Parsing in Screen Widgets
-----------------------------------------------

                 Key: OFBIZ-2390
                 URL: https://issues.apache.org/jira/browse/OFBIZ-2390
             Project: OFBiz
          Issue Type: Improvement
    Affects Versions: SVN trunk
            Reporter: Adrian Crum
            Priority: Trivial


See the comments for details.


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-2390) Proof Of Concept: SAX Parsing in Screen Widgets

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-2390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704409#action_12704409 ]

Adrian Crum commented on OFBIZ-2390:
------------------------------------

I had suggested on the developer's mailing list that we look into using SAX XML file parsing in OFBiz instead of the current DOM parsing. The current XML file reading code uses DOM parsing - which results in two parsing passes: one to convert XML into DOM objects, and a second pass to convert the DOM objects into OFBiz objects. Using SAX, the XML elements are converted directly to OFBiz objects - bypassing the DOM tree construction step.

The responses to my suggestion brought up two points:

1. The XML files being parsed are relatively small. They are parsed once, then the objects are cached in memory. So, the performance improvement using SAX would be negligible.

2. SAX parsing code would be more complicated than the current DOM parsing code.

Point number one is probably right. It was point number two I wanted to explore: How complicated would the SAX parsing code be?

I found a small public-domain SAX parsing framework, so I started with that. I used the model screen widgets as a test. The conversion was pretty easy, and the SAX parsing code isn't any more complicated than the existing DOM parsing code. The attached patch is the result of my work.

This Jira issue is here for experimental and educational purposes only. The attached patch is NOT intended to be included in the project.



> Proof Of Concept: SAX Parsing in Screen Widgets
> -----------------------------------------------
>
>                 Key: OFBIZ-2390
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2390
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk
>            Reporter: Adrian Crum
>            Priority: Trivial
>
> See the comments for details.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-2390) Proof Of Concept: SAX Parsing in Screen Widgets

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-2390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Crum updated OFBIZ-2390:
-------------------------------

    Attachment: saxwidgets.patch

The attached patch is for trunk revision 769991. It will not be maintained or updated. Please read these comments carefully - I will not answer questions that are already answered here.

1. This is Proof Of Concept code. It is messy. There are few comments. I'm sure there are many things that could be changed to make it more elegant or more understandable, but that wasn't my goal.
2. I copied the SAX parsing framework into UtilXml.java. If you want to learn how it works, go here - http://www.javaworld.com/javaworld/jw-03-2002/jw-0329-xmljava2.html?page=1 .
3. Only the model screen widgets, model screen actions, and model screen conditions were converted to SAX. The rest of the model widgets still use DOM.
4. SAX parsing is controlled with the widget.parseSAX property in widget.properties. You can switch back and forth between DOM and SAX parsing by changing the property, then clear the caches in Webtools.
5. This code is not fully tested or debugged. If you encounter an error while using it, then Oh well.


> Proof Of Concept: SAX Parsing in Screen Widgets
> -----------------------------------------------
>
>                 Key: OFBIZ-2390
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2390
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: SVN trunk
>            Reporter: Adrian Crum
>            Priority: Trivial
>         Attachments: saxwidgets.patch
>
>
> See the comments for details.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.