XML SCHEMA INFERENCE WITH XSLT - University of SCHEMA INFERENCE WITH XSLT By SCOTT MCCOLLUM BUNTIN ... XML Namespaces ... XML Schema

  • View
    218

  • Download
    3

Embed Size (px)

Text of XML SCHEMA INFERENCE WITH XSLT - University of SCHEMA INFERENCE WITH XSLT By SCOTT MCCOLLUM BUNTIN...

  • XML SCHEMA INFERENCE WITH XSLT

    By

    SCOTT MCCOLLUM BUNTIN

    A THESIS PRESENTED TO THE GRADUATE SCHOOL OF THE UNIVERSITY OF FLORIDA IN PARTIAL FULFILLMENT

    OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE

    UNIVERSITY OF FLORIDA

    2001

  • ii

    ACKNOWLEDGMENTS

    I would like to express my sincere gratitude to the chairman of my committee Dr.

    Wilson for his guidance, support and encouragement. Thanks also go to my committee

    members Dr. Bermudez and Dr. Hammer. I greatly appreciate my family, including my

    wife, my parents and my sister, for always being there for me.

  • iii

    TABLE OF CONTENTS

    ACKNOWLEDGMENTS................................................................................................... ii LIST OF FIGURES............................................................................................................ vi ABSTRACT......................................................................................................................vii CHAPTERS 1 INTRODUCTION.......................................................................................................... 1 2 XML AND XSLT .......................................................................................................... 6

    XML................................................................................................................................ 6 Document Object Model ............................................................................................. 6 XML Syntax................................................................................................................ 9 XML Namespaces ..................................................................................................... 10

    XSLT............................................................................................................................. 11 Parsers ....................................................................................................................... 12 XSLT Processing Model ........................................................................................... 12 Context ...................................................................................................................... 15 Templates .................................................................................................................. 17 Variables.................................................................................................................... 18 Data Structures .......................................................................................................... 19 Expressions................................................................................................................ 20 Patterns ...................................................................................................................... 24

    3 DTDS AND XML SCHEMAS.................................................................................... 25

    Document Type Definition ........................................................................................... 25 Element Type Declarations ....................................................................................... 26 Attribute List Declaration.......................................................................................... 27 Entity Declarations.................................................................................................... 28 Notation Declarations................................................................................................ 30

    XML Schema ................................................................................................................ 30 Advantages of XML Schemas................................................................................... 30 Validation .................................................................................................................. 32 XML Schema Spefication Methodology................................................................... 32 Abstract Data Model. ................................................................................................ 33 Primary Components................................................................................................. 35 Secondary Components............................................................................................. 46

  • iv

    Helper Components................................................................................................... 50 4 THE XSLTENGINE .................................................................................................... 56

    Perl ................................................................................................................................ 56 Overview of XSLTEngine ............................................................................................ 57 The XSLTEngine Implementation................................................................................ 59

    Initiation and Preprocessing ...................................................................................... 61 Environments for Variable Evaluation...................................................................... 63 Processing Model for the XSLTEngine .................................................................... 64 Expressions................................................................................................................ 66 Patterns ...................................................................................................................... 69 Instructions (XSLT Elements) .................................................................................. 71 Functions ................................................................................................................... 72 Variables.................................................................................................................... 73 Parameters ................................................................................................................. 76 Expansion of XSLT Expression Evaluation ............................................................. 77

    Extension Elements....................................................................................................... 80 AppendCopy.............................................................................................................. 82 ReplaceCopy ............................................................................................................. 86 AddAttributes ............................................................................................................ 89 Simulation of Extension Functions with Standard XSLT......................................... 92

    5 SCHEMA ENGINE ..................................................................................................... 94

    The SchemaEngine Implementation ............................................................................. 94 Overview ................................................................................................................... 94 Design of XML Schema Document Output.............................................................. 96 Initialization .............................................................................................................. 97 Processing model....................................................................................................... 99 Comparing New Nodes with Previous Nodes......................................................... 100 Construction of Complex Type Defintions ............................................................. 101 Construction of SimpleType Definitions ................................................................ 105 Refining Schemas.................................................................................................... 106

    6 DISCUSSION ............................................................................................................ 107

    Advantages and Disadvantages of the XSLT Approach............................................. 107 Future Work ................................................................................................................ 108

    APPENDICES A EXAMPLE XML DOCUMENT................................................................................ 110 B SAMPLE DTD FOR RECIPE BOOK EXAMPLE IN APPENDIX A...................... 111 C INITIAL OUTPUT XML SCHEMA DOCUMENT FROM SCHEMAENGINE FOR RECIPE BOOK EXAMPLE OF APPENDIX A ......................................... 112

  • v

    D POSSIBLE CUSTOMIZED SCHEMA DOCUMENT OF SCHEMA IN APPENDIX C ................................................................................................... 114 E THE SCHEMAENGINE ............................................................................................ 116 BIBLIOGRAPHY ........................................................................................................... 132 BIOGRAPHICAL SKETCH .......................................................................................... 135

  • vi

    LIST OF FIGURES

    Figure page

    1: Document Object Model (DOM).................................................................................... 8 2: StyleSheet Structure ...................................................................................................... 15 3: Scope of Variables in XSLT Programs......................................................................... 18 4: XML Schema Type De