exip  Alpha 0.5.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Enumerations | Functions
treeTableSchema.h File Reference

Defining a TreeTable structure for schema definitions; Functions for converting the XML schema definitions to a TreeTable structure, and TreeTable manipulations. More...

#include "procTypes.h"
#include "dynamicArray.h"
#include "protoGrammars.h"
#include "hashtable.h"
#include "grammarGenerator.h"

Go to the source code of this file.

Data Structures

struct  PfxNsEntry
 Namespace and prefix defined in a XML schema file. More...
 
struct  PfxNsTable
 An array of namespaces and prefixes defined in a XML schema file. More...
 
struct  QNameIDGrIndx
 uri/ln indices (QNameID) of an element in the string tables and the associated grammar index More...
 
struct  QualifiedTreeTableEntry
 A TreeTableEntry in particular TreeTable It is defined from which XML Schema file (TreeTable) it comes from. More...
 
struct  TreeTableEntry
 Represents a single definition (i.e XML element) from the XML schema. More...
 
struct  TreeTable
 Tree structure to store parsed schema structure and attributes; a schema tree. More...
 
struct  NsTable
 Some schema attributes (e.g. More...
 
struct  SubtGroupHead
 In case there are Substitution groups in the schema, this structure represents a Substitution group head. More...
 
struct  SubstituteTable
 In case there are Substitution groups in the schema, this structure sotres all Substitution group heads. More...
 

Typedefs

typedef enum ElemEnum ElemEnum
 
typedef enum AttrEnum AttrEnum
 
typedef struct PfxNsEntry PfxNsEntry
 
typedef struct PfxNsTable PfxNsTable
 
typedef enum FormType FormType
 
typedef struct QNameIDGrIndx QNameIDGrIndx
 
typedef struct
QualifiedTreeTableEntry 
QualifiedTreeTableEntry
 
typedef struct TreeTableEntry TreeTableEntry
 
typedef struct TreeTable TreeTable
 
typedef struct NsTable NsTable
 
typedef struct SubtGroupHead SubtGroupHead
 
typedef struct SubstituteTable SubstituteTable
 

Enumerations

enum  ElemEnum {
  ELEMENT_ELEMENT =0, ELEMENT_ATTRIBUTE =1, ELEMENT_CHOICE =2, ELEMENT_COMPLEX_TYPE =3,
  ELEMENT_COMPLEX_CONTENT =4, ELEMENT_GROUP =5, ELEMENT_IMPORT =6, ELEMENT_SEQUENCE =7,
  ELEMENT_ALL =8, ELEMENT_EXTENSION =9, ELEMENT_RESTRICTION =10, ELEMENT_SIMPLE_CONTENT =11,
  ELEMENT_ANY =12, ELEMENT_SIMPLE_TYPE =13, ELEMENT_MIN_INCLUSIVE =14, ELEMENT_ANNOTATION =15,
  ELEMENT_DOCUMENTATION =16, ELEMENT_MAX_LENGTH =17, ELEMENT_MAX_INCLUSIVE =18, ELEMENT_LIST =19,
  ELEMENT_UNION =20, ELEMENT_ATTRIBUTE_GROUP =21, ELEMENT_ANY_ATTRIBUTE =22, ELEMENT_ENUMERATION =23,
  ELEMENT_KEY =24, ELEMENT_SELECTOR =25, ELEMENT_FIELD =26, ELEMENT_NOTATION =27,
  ELEMENT_INCLUDE =28, ELEMENT_REDEFINE =29, ELEMENT_MIN_EXCLUSIVE =30, ELEMENT_MAX_EXCLUSIVE =31,
  ELEMENT_TOTAL_DIGITS =32, ELEMENT_FRACTION_DIGITS =33, ELEMENT_LENGTH =34, ELEMENT_MIN_LENGTH =35,
  ELEMENT_WHITE_SPACE =36, ELEMENT_PATTERN =37, ELEMENT_APPINFO =38, ELEMENT_VOID =39
}
 Enumeration of elements found in the schema. More...
 
enum  AttrEnum {
  ATTRIBUTE_NAME =0, ATTRIBUTE_TYPE =1, ATTRIBUTE_REF =2, ATTRIBUTE_MIN_OCCURS =3,
  ATTRIBUTE_MAX_OCCURS =4, ATTRIBUTE_FORM =5, ATTRIBUTE_BASE =6, ATTRIBUTE_USE =7,
  ATTRIBUTE_NAMESPACE =8, ATTRIBUTE_PROC_CONTENTS =9, ATTRIBUTE_VALUE =10, ATTRIBUTE_NILLABLE =11,
  ATTRIBUTE_ITEM_TYPE =12, ATTRIBUTE_MEMBER_TYPES =13, ATTRIBUTE_MIXED =14, ATTRIBUTE_SCHEMA_LOCATION =15,
  ATTRIBUTE_SUBSTITUTION_GROUP =16, ATTRIBUTE_ABSTRACT =17, ATTRIBUTE_CONTEXT_ARRAY_SIZE =18
}
 Codes for the attributes found in the schema. More...
 
enum  FormType { QUALIFIED =0, UNQUALIFIED =1 }
 The possible values of the schema attributes: elementFormDefault and attributeFormDefault. More...
 

Functions

errorCode initTreeTable (TreeTable *treeT)
 Initialize a TreeTable object. More...
 
void destroyTreeTable (TreeTable *treeT)
 Destroy a TreeTable object (free the memory allocations) More...
 
errorCode generateTreeTable (BinaryBuffer buffer, SchemaFormat schemaFormat, EXIOptions *opt, TreeTable *treeT, EXIPSchema *schema)
 Performs two things: builds a treeTable and the string tables of the EXIPSchema object. More...
 
errorCode resolveIncludeImportReferences (EXIPSchema *schema, TreeTable **treeT, unsigned int *count, errorCode(*loadSchemaHandler)(String *namespace, String *schemaLocation, BinaryBuffer **buffers, unsigned int *bufCount, SchemaFormat *schemaFormat, EXIOptions **opt))
 Given a set of TreeTable instances, resolve the or <import> dependencies. More...
 
errorCode resolveTypeHierarchy (EXIPSchema *schema, TreeTable *treeT, unsigned int count, SubstituteTable *subsTbl)
 Links derived types to base types, elements to types and references to global elements. More...
 
errorCode convertTreeTablesToExipSchema (TreeTable *treeT, unsigned int count, EXIPSchema *schema, SubstituteTable *subsTbl)
 Given types resolved TreeTable objects that are created from a XML schema files, builds the EXIP grammars in the EXIPSchema object. More...
 
errorCode getTypeQName (EXIPSchema *schema, TreeTable *treeT, const String typeLiteral, QNameID *qname)
 Given a type value encoded as QName string in the form "prefix:localname" derives the "namespace" part and the "local name" part. More...
 
errorCode getNsList (TreeTable *treeT, String nsList, NsTable *nsTable)
 Given a namespace="..." attribute containing a list of namespaces as a sting, returns an array of these namespaces. More...
 
void printTreeTableEntry (TreeTableEntry *treeTableEntryIn, int indentIdx, char *prefix)
 Print a tree table entry. More...
 

Detailed Description

Date
Mar 13, 2012
Author
Rumen Kyusakov
Robert Cragie
Version
0.5
[Revision] $Id: treeTableSchema.h 332 2014-05-05 18:22:55Z kjussakov $

Definition in file treeTableSchema.h.

Typedef Documentation

typedef enum AttrEnum AttrEnum

Definition at line 117 of file treeTableSchema.h.

typedef enum ElemEnum ElemEnum

Definition at line 91 of file treeTableSchema.h.

typedef enum FormType FormType

Definition at line 146 of file treeTableSchema.h.

typedef struct NsTable NsTable

Definition at line 293 of file treeTableSchema.h.

typedef struct PfxNsEntry PfxNsEntry

Definition at line 126 of file treeTableSchema.h.

typedef struct PfxNsTable PfxNsTable

Definition at line 136 of file treeTableSchema.h.

typedef struct QNameIDGrIndx QNameIDGrIndx

Definition at line 155 of file treeTableSchema.h.

Definition at line 166 of file treeTableSchema.h.

Definition at line 318 of file treeTableSchema.h.

typedef struct SubtGroupHead SubtGroupHead

Definition at line 307 of file treeTableSchema.h.

typedef struct TreeTable TreeTable

Definition at line 275 of file treeTableSchema.h.

Definition at line 217 of file treeTableSchema.h.

Enumeration Type Documentation

enum AttrEnum
Enumerator
ATTRIBUTE_NAME 
ATTRIBUTE_TYPE 
ATTRIBUTE_REF 
ATTRIBUTE_MIN_OCCURS 
ATTRIBUTE_MAX_OCCURS 
ATTRIBUTE_FORM 
ATTRIBUTE_BASE 
ATTRIBUTE_USE 
ATTRIBUTE_NAMESPACE 
ATTRIBUTE_PROC_CONTENTS 
ATTRIBUTE_VALUE 
ATTRIBUTE_NILLABLE 
ATTRIBUTE_ITEM_TYPE 
ATTRIBUTE_MEMBER_TYPES 
ATTRIBUTE_MIXED 
ATTRIBUTE_SCHEMA_LOCATION 
ATTRIBUTE_SUBSTITUTION_GROUP 
ATTRIBUTE_ABSTRACT 
ATTRIBUTE_CONTEXT_ARRAY_SIZE 

Definition at line 94 of file treeTableSchema.h.

enum ElemEnum
Enumerator
ELEMENT_ELEMENT 
ELEMENT_ATTRIBUTE 
ELEMENT_CHOICE 
ELEMENT_COMPLEX_TYPE 
ELEMENT_COMPLEX_CONTENT 
ELEMENT_GROUP 
ELEMENT_IMPORT 
ELEMENT_SEQUENCE 
ELEMENT_ALL 
ELEMENT_EXTENSION 
ELEMENT_RESTRICTION 
ELEMENT_SIMPLE_CONTENT 
ELEMENT_ANY 
ELEMENT_SIMPLE_TYPE 
ELEMENT_MIN_INCLUSIVE 
ELEMENT_ANNOTATION 
ELEMENT_DOCUMENTATION 
ELEMENT_MAX_LENGTH 
ELEMENT_MAX_INCLUSIVE 
ELEMENT_LIST 
ELEMENT_UNION 
ELEMENT_ATTRIBUTE_GROUP 
ELEMENT_ANY_ATTRIBUTE 
ELEMENT_ENUMERATION 
ELEMENT_KEY 
ELEMENT_SELECTOR 
ELEMENT_FIELD 
ELEMENT_NOTATION 
ELEMENT_INCLUDE 
ELEMENT_REDEFINE 
ELEMENT_MIN_EXCLUSIVE 
ELEMENT_MAX_EXCLUSIVE 
ELEMENT_TOTAL_DIGITS 
ELEMENT_FRACTION_DIGITS 
ELEMENT_LENGTH 
ELEMENT_MIN_LENGTH 
ELEMENT_WHITE_SPACE 
ELEMENT_PATTERN 
ELEMENT_APPINFO 
ELEMENT_VOID 

Definition at line 47 of file treeTableSchema.h.

enum FormType
Enumerator
QUALIFIED 
UNQUALIFIED 

Definition at line 140 of file treeTableSchema.h.

Function Documentation

errorCode convertTreeTablesToExipSchema ( TreeTable treeT,
unsigned int  count,
EXIPSchema schema,
SubstituteTable subsTbl 
)
Parameters
[in]treeTan array of tree table objects
[in]countthe number of tree table objects
[out]schemaschema information used for processing EXI streams in schema mode
[in]subsTblIn case of substitutionGroups in the schema maps the heads of the substitutionGroups to their members
Returns
Error handling code

For every tree table

For every global entry in the tree table

Definition at line 294 of file treeTableToGrammars.c.

void destroyTreeTable ( TreeTable treeT)
Parameters
[in,out]treeTa tree table object
Returns
Error handling code

Definition at line 269 of file treeTableManipulate.c.

errorCode generateTreeTable ( BinaryBuffer  buffer,
SchemaFormat  schemaFormat,
EXIOptions opt,
TreeTable treeT,
EXIPSchema schema 
)
  1. From the XML schema definitions builds an analogous treeTable
  2. Fills in the pre-populated entries in the string tables of the EXIPSchema object

The pre-populated entries in the string tables are sorted in generateSchemaInformedGrammars() after all the treeTables are generated.

The schema and treeT objects should be initialized before calling this function.

Parameters
[in]bufferan input buffer holding (part of) the representation of the schema
[in]schemaFormatEXI, XSD, DTD or any other schema representation supported
[in]optoptions used for EXI schemaFormat - otherwise NULL. If options are set then they will be used for processing the EXI XSD stream although no options are specified in the EXI header. If there are options defined in the EXI header of the XSD stream then this parameter must be NULL.
[out]treeTa memory representation of the XML schema definitions. Must be initialized.
[out]schemapartly built schema information (only the string tables) used for processing EXI streams. Must be initialized.
Returns
Error handling code

Definition at line 161 of file treeTableBuild.c.

errorCode getNsList ( TreeTable treeT,
String  nsList,
NsTable nsTable 
)

This function also resolves the special values "##targetNamespace" and "##local"

Parameters
[in]treeTthe tree table object
[in]nsLista sting containing the space separated namespaces
[out]nsTablean array of namespaces
Returns
Error handling code

Definition at line 663 of file treeTableManipulate.c.

errorCode getTypeQName ( EXIPSchema schema,
TreeTable treeT,
const String  typeLiteral,
QNameID qname 
)

Used for the value of the "type" attribute of element and attribute use definitions

Parameters
[in]schemathe EXIPSchema object
[in]treeTa tree table object
[in]typeLiteralthe type literal
[out]qnameqname of the type
Returns
Error handling code

Definition at line 514 of file treeTableManipulate.c.

errorCode initTreeTable ( TreeTable treeT)
Parameters
[in,out]treeTa tree table container
Returns
Error handling code

Definition at line 228 of file treeTableManipulate.c.

void printTreeTableEntry ( TreeTableEntry treeTableEntryIn,
int  indentIdx,
char *  prefix 
)
Parameters
[in]treeTableEntryIna tree table object
[in]indentIdxIndent index
[in]prefixprefix for the C definitions

Definition at line 839 of file treeTableBuild.c.

errorCode resolveIncludeImportReferences ( EXIPSchema schema,
TreeTable **  treeT,
unsigned int *  count,
errorCode(*)(String *namespace, String *schemaLocation, BinaryBuffer **buffers, unsigned int *bufCount, SchemaFormat *schemaFormat, EXIOptions **opt)  loadSchemaHandler 
)
Parameters
[in,out]schemathe EXIPSchema object
[in,out]treeTa pointer to an array of tree table objects (can be RE-ALLOCED!)
[in,out]countthe number of tree table objects
[in]loadSchemaHandlerCall-back handler for loading -ed or <import>-ed schema files; Can be left NULL if no or <import> statements are used in the XML schema.
Returns
Error handling code

Definition at line 49 of file treeTableManipulate.c.

errorCode resolveTypeHierarchy ( EXIPSchema schema,
TreeTable treeT,
unsigned int  count,
SubstituteTable subsTbl 
)

In case of:

  1. type="..." attribute - finds the corresponding type definition and links it to the child pointer of that entry
  2. ref="..." attribute - finds the corresponding element definition and links it to the child pointer of that entry
  3. base="..." attribute - finds the corresponding type definition and links it to the supertype pointer of that entry
  4. substitutionGroup="..." attribute - finds the corresponding substituion group head and adds the head and the substitute in the SubstituteTable
Parameters
[in]schemathe EXIPSchema object
[in,out]treeTan array of tree table objects
[in]countthe number of tree table objects
[in]subsTblIn case of substitutionGroups in the schema maps the heads of the substitutionGroups to their members
Returns
Error handling code

Definition at line 293 of file treeTableManipulate.c.