Integrate SAX and StAX into one Core Timeline

Mirae http://ws.apache.org/mirae provides implementations of SAX that is defined to JSR 172 and StAX that is defined to JSR 280 respectively. This project will be an initial step to implement JSR 280, which enables mobile developers to use an updated SAX and a newly added StAX from JSR 172.


12'th June
  • Today I met mentor for project starting.
  • He explained to me JSR280.

17'th June
  • Got everything set up ,
    Mirae Source, Sun WTK2.2, CVS.
  • Built the Mirae API and got things to work in my eclipse.

21'st June
  • I studied JSR280.
  • Mirae need to add SAX2 interface and dom part for JSR 280.

22'nd - 24'th June
  • These days I spend my time understanding the Mirae SAX and StAX API.

26'th June
27 - 29'th June
  • I understood the Mirae SAX and StAX API in detail again.
  • NonValidatingParser is Mirae SAX's main class and MXParser is Mirae StAX's main class.
    These two classes are too complex to understand. I am hard to undertand tham.
  • I will create to StAX-based SAX code that are implemente
    for following four classes and interface


    1. SAXParserFactory
    2. SAXParser
    3. Attribute
    4. Location
  • I think that modified StAX API’s AttributeBase class can substitute implementation codes of Attribute and Location. ---- ----
3'rd July
  • Started to work on the mirae SAX Parser coding
  • I created interafaces and abstract Classes in SAX and StAX package.
 4'th July
  • I designed structures for SAX/StAX core
  • I had two problem since then.
  1. Problem of [SAXParserFactory] 's set/getFeature()

    • SAX's set/getFeature() are exists in SAXParserFactory class.
    • And StAX's set/getFeature() are exists in XMLStreamReader class.
    • If use SAX's set/getFeature() by StAX's set/getFeature(), must have StreamReader instnace in SAXParserFactory.
    • But, XMLStreamReader can not instantiate in SAXParserFactory.
    • Because XMLStreamReader must have Reader for InputSource.


2. Unmatched problem of SAX's Locator and Location




 5'th July
  • I created handler class for test.
  • First Goal.
 test document (test1.xml)
 ------------------------------------
<?xml version="1.0" encoding="utf-8"?> 
<root></root>
 


---- ----

 6'th July
  • Second Goal.
    1. Processing of charatecre in Element
 test document (test2.xml)
 ------------------------------------
<?xml version="1.0" encoding="utf-8" ?> 
<root><a>1111</a></root>
 


  • Third Goal.
    1. Processing of many element.
 test document (test3.xml)
 ------------------------------------
<?xml version="1.0" encoding="utf-8" ?> 
<root>root<a>a</a><b>b</b></root>
 


 10'th July
  • Fourth Goal.
    1. Processing of attribute and namespace
      2. Processing of processing instrction
 test document (test4.xml)
 ------------------------------------
<?xml version="1.0" encoding="utf-8" ?> 
<document>
   <title>The Publishers </title>
   <publisher>        
       Alfred Publishing
      15535 Morrison
      South Oaks CA 91403
   </publisher>
   <book price="$100" author = "Herold" number = "no_11">eXtensible Markup Language</book>
   <bookurn xmlns='urn:loc.gov:books' xmlns:isbn='urn:ISBN:0-395-36341-6'/> 
   <pb/>
   <pages />
</document>
 
  • Future works
    1. Processing of DTD - Entity
  • Namespace


2. Other handler method

  • ignorableWhitespace
  • notationDecl
  • resolveEntity
  • skippedEntity
  • unparseEntityDecl
  • startPrefixMapping
  • endPrefixMapping


3. set/getFeature()



  12'nd July
  • Completed work
    1. XMLInputFactory's get/setFeature() method; 2. NamespaceAware option.
  • StartPrefixMapping
  • EndPrefixMapping
     test document (test5.xml) by Beginning XML 3rd Edition
     ------------------------------------
     <?xml version = "1.0"?>
    <person xmlns ="http://sernaferna.com/pers">
    	<names id ="1">
    		<first>John</first>	
    		<middle>Fitzgerald Johansen</middle>
    		<last>Doe</last>
    	</names>
    	<position>Vice President of Marketing</position>
    	<resume>
    		<html:html xmlns:html = "http://www.w3.org/1999/xhtml">
    			<html:head><html:title>resume of John Doe</html:title></html:head>
    			<html:body>
    				<html:h1>John Doe</html:h1>
    				<html:p html:style="font-FAMILY: Arial">
    					John's a great guy, you know?
    				</html:p>
    			</html:body>
    		</html:html>
    	</resume>
    </person>
     

  • result
    START_DOCUMENT
    ---------startPrefix : "" = http://sernaferna.com/pers
    <person>
    <names>
     id="1"
    <first>
    </first>
    <middle>
    </middle>
    <last>
    </last>
    </names>
    <position>
    </position>
    <resume>
    ---------startPrefix : "html" = http://www.w3.org/1999/xhtml
    <html:html>
    <html:head>
    <html:title>
    </html:title>
    </html:head>
    <html:body>
    <html:h1>
    </html:h1>
    <html:p>
     style="font-FAMILY: Arial"
    </html:p>
    </html:body>
    </html:html>
    ---------endPrefix : html
    </resume>
    </person>
    ---------endPrefix : null
    END_DOCUMENT
     
    ---- ----
  18 - 19'nd July
  1. Current SAX API adds following interface

ContentHandler, EntityResolver, DTDHandler, and ErrorHandler interfaces.

3. I created XMLFilterImpl class.



  24 - 25'th July
  1. I implemented XMLReader in StAX-based SAX parser class.
    2. I designed simple DTD parser for SAX.

  Final
  • package org.apache.mirae.j2me.xml's
  1. Changes NonValidationParser class to stax-based StAXCoreParser class.
  • StAXCoreParser is implementation class of XMLReader in SAX2.
  • Part of DTD processing is similar almost with previous MIRAE.


2. EntityResolver class is overlapped with SAX2's EntityResolver interface.

  • No labels