Optimizing a schema.

Hi folks,

I have a need to optimize an xml schema into its simplest DFA form.
Currently I have a number of xslt stylesheets that I wrote which essentially
flattens a schema and converts the whole thing to a state automaton in JSON
to be used in a client side validator I wrote.

However, the schemas I am working with right now (From the DITA open
toolkit) when flattened have a ton of unnecessary nested structures, for
instance things like this pop up:

<xs:sequence>
 <xs:choice>
  <xs:sequence>
   <xs:choice>
    <xs:sequence>
     <xs:sequence>
      <xs:element/>
      </xs:sequence>
     <xs:sequence>
      <xs:element/>
      </xs:sequence>
     </xs:sequence>
    </xs:choice>
   </xs:sequence>
  </xs:choice>
 </xs:sequence>

The validator works great on smaller schemas, but as its written in
javascript these huge unnecessary structures slow it down a lot.

I am assuming that other schema processors simplify things like this and
before I wrote my own wanted to check with the community.

Cheers,

Casey
-- 
--
Casey Jordan
Jorsek Software LLC.
"CaseyDJordan" on LinkedIn, Twitter & Facebook
Cell (585) 348 7399
Office (585) 239 6060
Jorsek.com


This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law.  If you are not the intended recipient,
please be advised that any disclosure  copying, distribution, or use of
the information contained herein is prohibited.  If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.

Received on Wednesday, 21 July 2010 19:51:34 UTC