W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2010

Optimizing a schema.

From: Casey Jordan <casey.jordan@jorsek.com>
Date: Wed, 21 Jul 2010 15:50:50 -0400
Message-ID: <AANLkTimY1eNwPV1EucQ-OBfmgL-pZ1sUnoMblzgcfqyY@mail.gmail.com>
To: xmlschema-dev@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:22 GMT