2 Replies Latest reply on Nov 13, 2005 7:03 PM by adrian.brock

    Eat our own dogfood xsd parser

      This relates to this discussion thread:
      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=71257

      I was actually trying to fork the jbxb bindings but got caught up in the inability
      to replace the implementation.

      So I've written an alternate in (which I suppose I should call the "Friday" parser).

      The core of the parser is:
      org.jboss.test.xml.prototype.impl.SchemaBindingResolver
      which basically acts to resolve and load (once) schemas.

      It does this by using some hardwired SchemaBindings (which are very incomplete).
      org.jboss.test.xml.prototype.impl.XSDSchemaBinding
      org.jboss.test.xml.prototype.impl.JBXBSchemaBinding

      The reason I call it "Eat our own dogfood" because this shows what is missing
      in the current jbxb bindings.
      i.e. I have to subclass the bindings to make them "lazy" and then
      introduce an "endElement" method such that I can invoke
      ParsedSchemaBinding.resolve()
      to tie all the elements and types together.
      It is an impossible problem using a simple event parser (due to recursion).

      NOTE: I relaxed some of the access to some of the fields so I can create
      my subclasses.
      The worst change is the DefaultHandlers class. There was some hardwiring
      of the Rt*Handler classes that I couldn't override.

        • 1. Re: Eat our own dogfood xsd parser

          It works pretty well and it is now relatively easily extensible (once it is completed of course :-)

          0 DEBUG [SimpleTestCase] ==== setUp org.jboss.test.xml.prototype.test.SimpleTestCase ====
          55 DEBUG [SimpleTestCase] ==== Starting testOne ====
          59 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml
          497 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 438ms.
          498 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@1c0ec97
          498 DEBUG [SimpleTestCase] testOne took 443ms
          498 DEBUG [SimpleTestCase] ==== Stopping testOne ====
          498 DEBUG [SimpleTestCase] ==== Starting testLots ====
          499 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          525 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 26ms.
          525 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@ecb281
          526 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          571 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 45ms.
          572 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@1bb60c3
          573 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          620 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 47ms.
          621 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@1de256f
          623 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          644 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 21ms.
          644 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@16bd8ea
          644 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          659 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 15ms.
          659 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@16e1fb1
          660 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          676 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 16ms.
          677 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@b5dac4
          678 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          700 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 21ms.
          701 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@12d96f2
          702 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          725 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 23ms.
          725 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@17e4ca
          726 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          745 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 19ms.
          745 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@175d6ab
          746 DEBUG [SimpleTestCase] Parsing: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleT
          estCase.xml
          765 DEBUG [SimpleTestCase] Parsed: file:/home/adrian/jboss-head/workspace/testsuite/src/resources/org/jboss/test/xml/prototype/test/SimpleTe
          stCase.xml in 19ms.
          765 DEBUG [SimpleTestCase] org.jboss.test.xml.prototype.support.Root@1484a05
          765 DEBUG [SimpleTestCase] testLots took 267ms
          765 DEBUG [SimpleTestCase] ==== Stopping testLots ====
          765 DEBUG [SimpleTestCase] ==== tornDown org.jboss.test.xml.prototype.test.SimpleTestCase ====
          


          • 2. Re: Eat our own dogfood xsd parser

            Now I can get on with extending the jbxb schema to support "holders"
            which was my original intent.