Diff for /Amaya/amaya/fetchXMLname.c between versions 1.43 and 1.44

version 1.43, 2001/03/16 12:05:20 version 1.44, 2001/03/16 16:40:27
Line 129  void         MapXMLElementType (int XMLt Line 129  void         MapXMLElementType (int XMLt
                                 STRING XMLname,                                  STRING XMLname,
                                 ElementType *elType,                                  ElementType *elType,
                                 STRING *mappedName,                                  STRING *mappedName,
                                 CHAR_T *content,                                  char *content,
                                 ThotBool *highEnoughLevel,                                  ThotBool *highEnoughLevel,
                                 Document doc)                                  Document doc)
 {  {
Line 174  void         MapXMLElementType (int XMLt Line 174  void         MapXMLElementType (int XMLt
        /* search in the ElemMappingTable */         /* search in the ElemMappingTable */
        i = 0;         i = 0;
        /* look for the first concerned entry in the table */         /* look for the first concerned entry in the table */
        while (ptr[i].XMLname[0] < XMLname[0] && ptr[i].XMLname[0] != WC_EOS)         while (ptr[i].XMLname[0] < XMLname[0] && ptr[i].XMLname[0] != EOS)
          i++;                i++;     
        /* look at all entries starting with the right character */         /* look at all entries starting with the right character */
        do         do
          if (ustrcmp (ptr[i].XMLname, XMLname))           if (strcmp (ptr[i].XMLname, XMLname))
            /* it's not the tag */             /* it's not the tag */
            i++;             i++;
          else if (ParsingLevel[doc] != L_Other &&           else if (ParsingLevel[doc] != L_Other &&
Line 206  void         MapXMLElementType (int XMLt Line 206  void         MapXMLElementType (int XMLt
    Generic function which searchs in the mapping table the XML name for     Generic function which searchs in the mapping table the XML name for
    a given Thot type.     a given Thot type.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 CHAR_T*           GetXMLElementName (ElementType elType, Document doc)  char*           GetXMLElementName (ElementType elType, Document doc)
 {  {
   ElemMapping        *ptr;    ElemMapping        *ptr;
   STRING              name;    STRING              name;
Line 218  CHAR_T*           GetXMLElementName (Ele Line 218  CHAR_T*           GetXMLElementName (Ele
       i = 0;        i = 0;
       /* Select the table which matches with the element schema */        /* Select the table which matches with the element schema */
       name = TtaGetSSchemaName (elType.ElSSchema);        name = TtaGetSSchemaName (elType.ElSSchema);
       if (ustrcmp ("MathML", name) == 0)        if (strcmp ("MathML", name) == 0)
         ptr = MathMLElemMappingTable;          ptr = MathMLElemMappingTable;
       else if (ustrcmp ("GraphML", name) == 0)        else if (strcmp ("GraphML", name) == 0)
         ptr = GraphMLElemMappingTable;          ptr = GraphMLElemMappingTable;
       else        else
         ptr = XHTMLElemMappingTable;          ptr = XHTMLElemMappingTable;
Line 239  CHAR_T*           GetXMLElementName (Ele Line 239  CHAR_T*           GetXMLElementName (Ele
               }                }
             i++;              i++;
           }            }
         while (ptr[i].XMLname[0] != WC_EOS);                while (ptr[i].XMLname[0] != EOS);         
     }      }
   if (invalid)    if (invalid)
     return "";      return "";
Line 267  ThotBool         IsXMLElementInline (Ele Line 267  ThotBool         IsXMLElementInline (Ele
       i = 0;        i = 0;
       /* Select the table which matches with the element schema */        /* Select the table which matches with the element schema */
       name = TtaGetSSchemaName (elType.ElSSchema);        name = TtaGetSSchemaName (elType.ElSSchema);
       if (ustrcmp ("MathML", name) == 0)        if (strcmp ("MathML", name) == 0)
         ptr = MathMLElemMappingTable;          ptr = MathMLElemMappingTable;
       else if (ustrcmp ("GraphML", name) == 0)        else if (strcmp ("GraphML", name) == 0)
         ptr = GraphMLElemMappingTable;          ptr = GraphMLElemMappingTable;
       else        else
         ptr = XHTMLElemMappingTable;          ptr = XHTMLElemMappingTable;
               
       if (ptr)        if (ptr)
         {          {
           while (ptr[i].XMLname[0] != WC_EOS &&            while (ptr[i].XMLname[0] != EOS &&
                  ptr[i].ThotType != elType.ElTypeNum)                   ptr[i].ThotType != elType.ElTypeNum)
             i++;              i++;
           if (ptr[i].ThotType == elType.ElTypeNum)            if (ptr[i].ThotType == elType.ElTypeNum)
Line 292  ThotBool         IsXMLElementInline (Ele Line 292  ThotBool         IsXMLElementInline (Ele
    the entry attrName associated to the element elementName.     the entry attrName associated to the element elementName.
    Returns the corresponding entry or -1.     Returns the corresponding entry or -1.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 int       MapXMLAttribute (int XMLtype, CHAR_T *attrName,  int       MapXMLAttribute (int XMLtype, char *attrName,
                            CHAR_T *elementName, ThotBool *highEnoughLevel,                             char *elementName, ThotBool *highEnoughLevel,
                            Document doc, int *thotType)                             Document doc, int *thotType)
 {  {
   int               i;    int               i;
Line 321  int       MapXMLAttribute (int XMLtype, Line 321  int       MapXMLAttribute (int XMLtype,
   
   /* look for the first concerned entry in the table */    /* look for the first concerned entry in the table */
   while (ptr[i].XMLattribute[0] < attrName[0] &&     while (ptr[i].XMLattribute[0] < attrName[0] && 
          ptr[i].XMLattribute[0] != WC_EOS)           ptr[i].XMLattribute[0] != EOS)
     i++;      i++;
   
   while (ptr[i].XMLattribute[0] == attrName[0])    while (ptr[i].XMLattribute[0] == attrName[0])
     {      {
       if (ustrcmp (ptr[i].XMLattribute, attrName) ||        if (strcmp (ptr[i].XMLattribute, attrName) ||
           (ptr[i].XMLelement[0] != WC_EOS &&            (ptr[i].XMLelement[0] != EOS &&
            ustrcmp (ptr[i].XMLelement, elementName)))             strcmp (ptr[i].XMLelement, elementName)))
         i++;          i++;
       else if (ptr[i].Level > ParsingLevel[doc])        else if (ptr[i].Level > ParsingLevel[doc])
         {          {
Line 350  int       MapXMLAttribute (int XMLtype, Line 350  int       MapXMLAttribute (int XMLtype,
    Generic function which searchs in the mapping table the XML name for     Generic function which searchs in the mapping table the XML name for
    a given Thot type.     a given Thot type.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 CHAR_T*           GetXMLAttributeName (AttributeType attrType,  char*           GetXMLAttributeName (AttributeType attrType,
                                        ElementType elType,                                         ElementType elType,
                                        Document doc)                                         Document doc)
 {  {
Line 370  CHAR_T*           GetXMLAttributeName (A Line 370  CHAR_T*           GetXMLAttributeName (A
       i = 0;        i = 0;
       /* Select the table which matches with the element schema */        /* Select the table which matches with the element schema */
       name = TtaGetSSchemaName (attrType.AttrSSchema);        name = TtaGetSSchemaName (attrType.AttrSSchema);
       if (ustrcmp ("MathML", name) == 0)        if (strcmp ("MathML", name) == 0)
         ptr = MathMLAttributeMappingTable;          ptr = MathMLAttributeMappingTable;
       else if (ustrcmp ("GraphML", name) == 0)        else if (strcmp ("GraphML", name) == 0)
         ptr = GraphMLAttributeMappingTable;          ptr = GraphMLAttributeMappingTable;
       else if (ustrcmp ("XLink", name) == 0)        else if (strcmp ("XLink", name) == 0)
         ptr = XLinkAttributeMappingTable;          ptr = XLinkAttributeMappingTable;
       else        else
         ptr = XHTMLAttributeMappingTable;          ptr = XHTMLAttributeMappingTable;
Line 383  CHAR_T*           GetXMLAttributeName (A Line 383  CHAR_T*           GetXMLAttributeName (A
         do          do
           {            {
             if (ptr[i].ThotAttribute == attrType.AttrTypeNum &&              if (ptr[i].ThotAttribute == attrType.AttrTypeNum &&
                 (ptr[i].XMLelement[0] == WC_EOS ||                  (ptr[i].XMLelement[0] == EOS ||
                  !ustrcmp (ptr[i].XMLelement, tag)))                   !strcmp (ptr[i].XMLelement, tag)))
               {                {
                 if (doc == 0 || ptr[i].Level <= ParsingLevel[doc])                  if (doc == 0 || ptr[i].Level <= ParsingLevel[doc])
                   return ptr[i].XMLattribute;                    return ptr[i].XMLattribute;
Line 393  CHAR_T*           GetXMLAttributeName (A Line 393  CHAR_T*           GetXMLAttributeName (A
               }                }
             i++;              i++;
           }            }
         while (ptr[i].XMLattribute[0] != WC_EOS);                   while (ptr[i].XMLattribute[0] != EOS);    
     }      }
   if (invalid)    if (invalid)
     return "";      return "";
Line 444  ThotBool   MapXMLEntity (int XMLtype, ST Line 444  ThotBool   MapXMLEntity (int XMLtype, ST
     /* Dichotomic research */      /* Dichotomic research */
     {      {
       med = (sup + inf) / 2;        med = (sup + inf) / 2;
       rescomp = ustrcmp (ptr[med].charName, entityName);        rescomp = strcmp (ptr[med].charName, entityName);
       if (rescomp == 0)        if (rescomp == 0)
         {          {
           /* entity found */            /* entity found */

Removed from v.1.43  
changed lines
  Added in v.1.44


Webmaster