Пример #1
0
        internal void SetReferencedEntityContent()
        {
            if (FirstChild != null)
            {
                return;
            }

            if (OwnerDocument.DocumentType == null)
            {
                return;
            }

            XmlEntity ent = Entity;

            if (ent == null)
            {
                InsertBefore(OwnerDocument.CreateTextNode(String.Empty), null, false, true);
            }
            else
            {
                for (int i = 0; i < ent.ChildNodes.Count; i++)
                {
                    InsertBefore(ent.ChildNodes [i].CloneNode(true), null, false, true);
                }
            }
        }
Пример #2
0
		private void ImportFromDTD ()
		{
			entities = new XmlNamedNodeMap (this);
			notations = new XmlNamedNodeMap (this);

			foreach (DTDEntityDeclaration decl in DTD.EntityDecls.Values) {
				XmlNode n = new XmlEntity (decl.Name, decl.NotationName,
					decl.PublicId, decl.SystemId, OwnerDocument);
				entities.SetNamedItem (n);
			}
			foreach (DTDNotationDeclaration decl in DTD.NotationDecls.Values) {
				XmlNode n = new XmlNotation (decl.LocalName, decl.Prefix,
					decl.PublicId, decl.SystemId, OwnerDocument);
				notations.SetNamedItem (n);
			}
		}
 private void ImportFromDTD()
 {
     this.entities  = new XmlNamedNodeMap(this);
     this.notations = new XmlNamedNodeMap(this);
     foreach (DTDNode dtdnode in this.DTD.EntityDecls.Values)
     {
         DTDEntityDeclaration dtdentityDeclaration = (DTDEntityDeclaration)dtdnode;
         XmlNode namedItem = new XmlEntity(dtdentityDeclaration.Name, dtdentityDeclaration.NotationName, dtdentityDeclaration.PublicId, dtdentityDeclaration.SystemId, this.OwnerDocument);
         this.entities.SetNamedItem(namedItem);
     }
     foreach (DTDNode dtdnode2 in this.DTD.NotationDecls.Values)
     {
         DTDNotationDeclaration dtdnotationDeclaration = (DTDNotationDeclaration)dtdnode2;
         XmlNode namedItem2 = new XmlNotation(dtdnotationDeclaration.LocalName, dtdnotationDeclaration.Prefix, dtdnotationDeclaration.PublicId, dtdnotationDeclaration.SystemId, this.OwnerDocument);
         this.notations.SetNamedItem(namedItem2);
     }
 }
Пример #4
0
        private void ImportFromDTD()
        {
            entities  = new XmlNamedNodeMap(this);
            notations = new XmlNamedNodeMap(this);

            foreach (DTDEntityDeclaration decl in DTD.EntityDecls.Values)
            {
                XmlNode n = new XmlEntity(decl.Name, decl.NotationName,
                                          decl.PublicId, decl.SystemId, OwnerDocument);
                entities.SetNamedItem(n);
            }
            foreach (DTDNotationDeclaration decl in DTD.NotationDecls.Values)
            {
                XmlNode n = new XmlNotation(decl.LocalName, decl.Prefix,
                                            decl.PublicId, decl.SystemId, OwnerDocument);
                notations.SetNamedItem(n);
            }
        }
Пример #5
0
 //The function is called when expanding the entity when its children being asked
 internal void ExpandEntity(XmlEntity ent)
 {
     ParsePartialContent(ent, EntitizeName(ent.Name), XmlNodeType.Entity);
 }
Пример #6
0
        private void LoadDocumentType(IDtdInfo dtdInfo, XmlDocumentType dtNode)
        {
            SchemaInfo schInfo = dtdInfo as SchemaInfo;

            if (schInfo == null)
            {
                throw new XmlException(SR.Xml_InternalError, string.Empty);
            }

            dtNode.DtdSchemaInfo = schInfo;
            if (schInfo != null)
            {
                //set the schema information into the document
                _doc.DtdSchemaInfo = schInfo;

                // Notation hashtable
                if (schInfo.Notations != null)
                {
                    foreach (SchemaNotation scNot in schInfo.Notations.Values)
                    {
                        dtNode.Notations.SetNamedItem(new XmlNotation(scNot.Name.Name, scNot.Pubid, scNot.SystemLiteral, _doc));
                    }
                }

                // Entity hashtables
                if (schInfo.GeneralEntities != null)
                {
                    foreach (SchemaEntity scEnt in schInfo.GeneralEntities.Values)
                    {
                        XmlEntity ent = new XmlEntity(scEnt.Name.Name, scEnt.Text, scEnt.Pubid, scEnt.Url, scEnt.NData.IsEmpty ? null : scEnt.NData.Name, _doc);
                        ent.SetBaseURI(scEnt.DeclaredURI);
                        dtNode.Entities.SetNamedItem(ent);
                    }
                }

                if (schInfo.ParameterEntities != null)
                {
                    foreach (SchemaEntity scEnt in schInfo.ParameterEntities.Values)
                    {
                        XmlEntity ent = new XmlEntity(scEnt.Name.Name, scEnt.Text, scEnt.Pubid, scEnt.Url, scEnt.NData.IsEmpty ? null : scEnt.NData.Name, _doc);
                        ent.SetBaseURI(scEnt.DeclaredURI);
                        dtNode.Entities.SetNamedItem(ent);
                    }
                }
                _doc.Entities = dtNode.Entities;

                //extract the elements which has attribute defined as ID from the element declarations
                IDictionaryEnumerator elementDecls = schInfo.ElementDecls.GetEnumerator();
                if (elementDecls != null)
                {
                    elementDecls.Reset();
                    while (elementDecls.MoveNext())
                    {
                        SchemaElementDecl elementDecl = (SchemaElementDecl)elementDecls.Value;
                        if (elementDecl.AttDefs != null)
                        {
                            IDictionaryEnumerator attDefs = elementDecl.AttDefs.GetEnumerator();
                            while (attDefs.MoveNext())
                            {
                                SchemaAttDef attdef = (SchemaAttDef)attDefs.Value;
                                if (attdef.Datatype.TokenizedType == XmlTokenizedType.ID)
                                {
                                    //we only register the XmlElement based on their Prefix/LocalName and skip the namespace
                                    _doc.AddIdInfo(
                                        _doc.AddXmlName(elementDecl.Prefix, elementDecl.Name.Name, string.Empty, null),
                                        _doc.AddAttrXmlName(attdef.Prefix, attdef.Name.Name, string.Empty, null));
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #7
0
 //The function is called when expanding the entity when its children being asked
 internal void ExpandEntity(XmlEntity ent)
 {
     ParsePartialContent(ent, EntitizeName(ent.Name), XmlNodeType.Entity);
 }
Пример #8
0
        private void LoadDocumentType(IDtdInfo dtdInfo, XmlDocumentType dtNode)
        {
            SchemaInfo info = dtdInfo as SchemaInfo;

            if (info == null)
            {
                throw new XmlException("Xml_InternalError", string.Empty);
            }
            dtNode.DtdSchemaInfo = info;
            if (info != null)
            {
                this.doc.DtdSchemaInfo = info;
                if (info.Notations != null)
                {
                    foreach (SchemaNotation notation in info.Notations.Values)
                    {
                        dtNode.Notations.SetNamedItem(new XmlNotation(notation.Name.Name, notation.Pubid, notation.SystemLiteral, this.doc));
                    }
                }
                if (info.GeneralEntities != null)
                {
                    foreach (SchemaEntity entity in info.GeneralEntities.Values)
                    {
                        XmlEntity node = new XmlEntity(entity.Name.Name, entity.Text, entity.Pubid, entity.Url, entity.NData.IsEmpty ? null : entity.NData.Name, this.doc);
                        node.SetBaseURI(entity.DeclaredURI);
                        dtNode.Entities.SetNamedItem(node);
                    }
                }
                if (info.ParameterEntities != null)
                {
                    foreach (SchemaEntity entity3 in info.ParameterEntities.Values)
                    {
                        XmlEntity entity4 = new XmlEntity(entity3.Name.Name, entity3.Text, entity3.Pubid, entity3.Url, entity3.NData.IsEmpty ? null : entity3.NData.Name, this.doc);
                        entity4.SetBaseURI(entity3.DeclaredURI);
                        dtNode.Entities.SetNamedItem(entity4);
                    }
                }
                this.doc.Entities = dtNode.Entities;
                IDictionaryEnumerator enumerator = info.ElementDecls.GetEnumerator();
                if (enumerator != null)
                {
                    enumerator.Reset();
                    while (enumerator.MoveNext())
                    {
                        SchemaElementDecl decl = (SchemaElementDecl)enumerator.Value;
                        if (decl.AttDefs != null)
                        {
                            IDictionaryEnumerator enumerator2 = decl.AttDefs.GetEnumerator();
                            while (enumerator2.MoveNext())
                            {
                                SchemaAttDef def = (SchemaAttDef)enumerator2.Value;
                                if (def.Datatype.TokenizedType == XmlTokenizedType.ID)
                                {
                                    this.doc.AddIdInfo(this.doc.AddXmlName(decl.Prefix, decl.Name.Name, string.Empty, null), this.doc.AddAttrXmlName(def.Prefix, def.Name.Name, string.Empty, null));
                                    continue;
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #9
0
        private void LoadDocumentType( XmlValidatingReader vr , XmlDocumentType dtNode ) {
            SchemaInfo schInfo = vr.GetSchemaInfo();
            if (schInfo != null) {
                //set the schema information into the document
                doc.SchemaInformation = schInfo;

                // Notation hashtable
                if (schInfo.Notations != null) {
                    foreach( SchemaNotation scNot in schInfo.Notations.Values ) {
                        dtNode.Notations.SetNamedItem(new XmlNotation( scNot.Name.Name, scNot.Pubid, scNot.SystemLiteral, doc ));
                    }
                }

                // Entity hashtables
                if (schInfo.GeneralEntities != null) {
                    foreach( SchemaEntity scEnt in schInfo.GeneralEntities.Values ) {
                        XmlEntity ent = new XmlEntity( scEnt.Name.Name, scEnt.Text, scEnt.Pubid, scEnt.Url, scEnt.NData.IsEmpty ? null : scEnt.NData.Name, doc );
                        ent.SetBaseURI( scEnt.DeclaredURI );
                        dtNode.Entities.SetNamedItem( ent );
                    }
                }

                if (schInfo.ParameterEntities != null) {
                    foreach( SchemaEntity scEnt in schInfo.ParameterEntities.Values ) {
                        XmlEntity ent = new XmlEntity( scEnt.Name.Name, scEnt.Text, scEnt.Pubid, scEnt.Url, scEnt.NData.IsEmpty ? null : scEnt.NData.Name, doc );
                        ent.SetBaseURI( scEnt.DeclaredURI );
                        dtNode.Entities.SetNamedItem( ent );
                    }
                }
                doc.Entities = dtNode.Entities;

                //extract the elements which has attribute defined as ID from the element declarations
                IDictionaryEnumerator elementDecls = schInfo.ElementDecls.GetEnumerator();
                if (elementDecls != null) {
                    elementDecls.Reset();
                    while (elementDecls.MoveNext()) {
                        SchemaElementDecl elementDecl = (SchemaElementDecl)elementDecls.Value;
                        if (elementDecl.AttDefs != null) {
                            IDictionaryEnumerator attDefs =  elementDecl.AttDefs.GetEnumerator();
                            while (attDefs.MoveNext()) {
                                SchemaAttDef attdef = (SchemaAttDef)attDefs.Value;
                                if (attdef.Datatype.TokenizedType == XmlTokenizedType.ID) {
                                    doc.AddIdInfo(
                                        doc.GetXmlName(elementDecl.Name.Name, elementDecl.Name.Namespace),
                                        doc.GetXmlName(attdef.Name.Name, attdef.Name.Namespace));
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #10
0
        private void LoadDocumentType(IDtdInfo dtdInfo, XmlDocumentType dtNode)
        {
            SchemaInfo schInfo = dtdInfo as SchemaInfo;
            if (schInfo == null)
            {
                throw new XmlException(SR.Xml_InternalError, string.Empty);
            }

            dtNode.DtdSchemaInfo = schInfo;
            if (schInfo != null)
            {
                //set the schema information into the document
                _doc.DtdSchemaInfo = schInfo;

                // Notation hashtable
                if (schInfo.Notations != null)
                {
                    foreach (SchemaNotation scNot in schInfo.Notations.Values)
                    {
                        dtNode.Notations.SetNamedItem(new XmlNotation(scNot.Name.Name, scNot.Pubid, scNot.SystemLiteral, _doc));
                    }
                }

                // Entity hashtables
                if (schInfo.GeneralEntities != null)
                {
                    foreach (SchemaEntity scEnt in schInfo.GeneralEntities.Values)
                    {
                        XmlEntity ent = new XmlEntity(scEnt.Name.Name, scEnt.Text, scEnt.Pubid, scEnt.Url, scEnt.NData.IsEmpty ? null : scEnt.NData.Name, _doc);
                        ent.SetBaseURI(scEnt.DeclaredURI);
                        dtNode.Entities.SetNamedItem(ent);
                    }
                }

                if (schInfo.ParameterEntities != null)
                {
                    foreach (SchemaEntity scEnt in schInfo.ParameterEntities.Values)
                    {
                        XmlEntity ent = new XmlEntity(scEnt.Name.Name, scEnt.Text, scEnt.Pubid, scEnt.Url, scEnt.NData.IsEmpty ? null : scEnt.NData.Name, _doc);
                        ent.SetBaseURI(scEnt.DeclaredURI);
                        dtNode.Entities.SetNamedItem(ent);
                    }
                }
                _doc.Entities = dtNode.Entities;

                //extract the elements which has attribute defined as ID from the element declarations
                IDictionaryEnumerator elementDecls = schInfo.ElementDecls.GetEnumerator();
                if (elementDecls != null)
                {
                    elementDecls.Reset();
                    while (elementDecls.MoveNext())
                    {
                        SchemaElementDecl elementDecl = (SchemaElementDecl)elementDecls.Value;
                        if (elementDecl.AttDefs != null)
                        {
                            IDictionaryEnumerator attDefs = elementDecl.AttDefs.GetEnumerator();
                            while (attDefs.MoveNext())
                            {
                                SchemaAttDef attdef = (SchemaAttDef)attDefs.Value;
                                if (attdef.Datatype.TokenizedType == XmlTokenizedType.ID)
                                {
                                    //we only register the XmlElement based on their Prefix/LocalName and skip the namespace
                                    _doc.AddIdInfo(
                                        _doc.AddXmlName(elementDecl.Prefix, elementDecl.Name.Name, string.Empty, null),
                                        _doc.AddAttrXmlName(attdef.Prefix, attdef.Name.Name, string.Empty, null));
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #11
0
		internal DOMEntity(XmlEntity/*!*/ xmlEntity)
			: base(ScriptContext.CurrentContext, true)
		{
			this.XmlEntity = xmlEntity;
		}
Пример #12
0
        private void LoadDocumentType(XmlValidatingReader vr, XmlDocumentType dtNode)
        {
            SchemaInfo schInfo = vr.GetSchemaInfo();

            if (schInfo != null)
            {
                //set the schema information into the document
                doc.SchemaInformation = schInfo;

                // Notation hashtable
                if (schInfo.Notations != null)
                {
                    foreach (SchemaNotation scNot in schInfo.Notations.Values)
                    {
                        dtNode.Notations.SetNamedItem(new XmlNotation(scNot.Name.Name, scNot.Pubid, scNot.SystemLiteral, doc));
                    }
                }

                // Entity hashtables
                if (schInfo.GeneralEntities != null)
                {
                    foreach (SchemaEntity scEnt in schInfo.GeneralEntities.Values)
                    {
                        XmlEntity ent = new XmlEntity(scEnt.Name.Name, scEnt.Text, scEnt.Pubid, scEnt.Url, scEnt.NData.IsEmpty ? null : scEnt.NData.Name, doc);
                        ent.SetBaseURI(scEnt.DeclaredURI);
                        dtNode.Entities.SetNamedItem(ent);
                    }
                }

                if (schInfo.ParameterEntities != null)
                {
                    foreach (SchemaEntity scEnt in schInfo.ParameterEntities.Values)
                    {
                        XmlEntity ent = new XmlEntity(scEnt.Name.Name, scEnt.Text, scEnt.Pubid, scEnt.Url, scEnt.NData.IsEmpty ? null : scEnt.NData.Name, doc);
                        ent.SetBaseURI(scEnt.DeclaredURI);
                        dtNode.Entities.SetNamedItem(ent);
                    }
                }
                doc.Entities = dtNode.Entities;

                //extract the elements which has attribute defined as ID from the element declarations
                IDictionaryEnumerator elementDecls = schInfo.ElementDecls.GetEnumerator();
                if (elementDecls != null)
                {
                    elementDecls.Reset();
                    while (elementDecls.MoveNext())
                    {
                        SchemaElementDecl elementDecl = (SchemaElementDecl)elementDecls.Value;
                        if (elementDecl.AttDefs != null)
                        {
                            IDictionaryEnumerator attDefs = elementDecl.AttDefs.GetEnumerator();
                            while (attDefs.MoveNext())
                            {
                                SchemaAttDef attdef = (SchemaAttDef)attDefs.Value;
                                if (attdef.Datatype.TokenizedType == XmlTokenizedType.ID)
                                {
                                    doc.AddIdInfo(
                                        doc.GetXmlName(elementDecl.Name.Name, elementDecl.Name.Namespace),
                                        doc.GetXmlName(attdef.Name.Name, attdef.Name.Namespace));
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
 private void LoadDocumentType(IDtdInfo dtdInfo, XmlDocumentType dtNode)
 {
     SchemaInfo info = dtdInfo as SchemaInfo;
     if (info == null)
     {
         throw new XmlException("Xml_InternalError", string.Empty);
     }
     dtNode.DtdSchemaInfo = info;
     if (info != null)
     {
         this.doc.DtdSchemaInfo = info;
         if (info.Notations != null)
         {
             foreach (SchemaNotation notation in info.Notations.Values)
             {
                 dtNode.Notations.SetNamedItem(new XmlNotation(notation.Name.Name, notation.Pubid, notation.SystemLiteral, this.doc));
             }
         }
         if (info.GeneralEntities != null)
         {
             foreach (SchemaEntity entity in info.GeneralEntities.Values)
             {
                 XmlEntity node = new XmlEntity(entity.Name.Name, entity.Text, entity.Pubid, entity.Url, entity.NData.IsEmpty ? null : entity.NData.Name, this.doc);
                 node.SetBaseURI(entity.DeclaredURI);
                 dtNode.Entities.SetNamedItem(node);
             }
         }
         if (info.ParameterEntities != null)
         {
             foreach (SchemaEntity entity3 in info.ParameterEntities.Values)
             {
                 XmlEntity entity4 = new XmlEntity(entity3.Name.Name, entity3.Text, entity3.Pubid, entity3.Url, entity3.NData.IsEmpty ? null : entity3.NData.Name, this.doc);
                 entity4.SetBaseURI(entity3.DeclaredURI);
                 dtNode.Entities.SetNamedItem(entity4);
             }
         }
         this.doc.Entities = dtNode.Entities;
         IDictionaryEnumerator enumerator = info.ElementDecls.GetEnumerator();
         if (enumerator != null)
         {
             enumerator.Reset();
             while (enumerator.MoveNext())
             {
                 SchemaElementDecl decl = (SchemaElementDecl) enumerator.Value;
                 if (decl.AttDefs != null)
                 {
                     IDictionaryEnumerator enumerator2 = decl.AttDefs.GetEnumerator();
                     while (enumerator2.MoveNext())
                     {
                         SchemaAttDef def = (SchemaAttDef) enumerator2.Value;
                         if (def.Datatype.TokenizedType == XmlTokenizedType.ID)
                         {
                             this.doc.AddIdInfo(this.doc.AddXmlName(decl.Prefix, decl.Name.Name, string.Empty, null), this.doc.AddAttrXmlName(def.Prefix, def.Name.Name, string.Empty, null));
                             continue;
                         }
                     }
                 }
             }
         }
     }
 }
Пример #14
0
        private void StartElement(IfcPersistedInstanceCache cache, XmlReader input, XbimEntityCursor entityTable, XbimLazyDBTransaction transaction)
        {
            string elementName = input.LocalName;
            bool isRefType;
            int id = GetId(input, out isRefType);

            IfcType ifcType;
            
            IfcParserType parserType;
            IfcMetaProperty prop;
            int propIndex;


            if (id > -1 && IsIfcEntity(elementName, out ifcType)) //we have an element which is an Ifc Entity
            {
                IPersistIfcEntity ent;
                if (!cache.Contains(id))
                {
                    // not been declared in a ref yet
                    // model.New creates an instance uisng type and id
                    ent = cache.CreateNew(ifcType.Type, id);
                   
                }
                else
                {
                    ent = cache.GetInstance(id, false, true);
                }

                XmlEntity xmlEnt = new XmlEntity(_currentNode, ent);
               
                //if we have a completely empty element that is not a ref we need to make sure it is written to the database as EndElement will not be called
                if (input.IsEmptyElement && !isRefType)
                {
                    _entitiesParsed++;
                    //now write the entity to the database
                    entityTable.AddEntity(xmlEnt.Entity);
                    if (_entitiesParsed % _transactionBatchSize == (_transactionBatchSize - 1))
                    {
                        transaction.Commit();
                        transaction.Begin();
                    }
                    

                }


                string pos = input.GetAttribute(_posAttribute);
                if (string.IsNullOrEmpty(pos)) pos = input.GetAttribute("pos"); //try without namespace
                if (!string.IsNullOrEmpty(pos))
                    xmlEnt.Position = Convert.ToInt32(pos);
                if (!input.IsEmptyElement)
                {
                    // add the entity to its parent if its parent is a list
                    //if (!(_currentNode is XmlUosCollection) && _currentNode is XmlCollectionProperty && !(_currentNode.Parent is XmlUosCollection))
                    //    ((XmlCollectionProperty)_currentNode).Entities.Add(xmlEnt);

                    _currentNode = xmlEnt;
                }
                else if (_currentNode is XmlProperty)
                {
                    // if it is a ref then it will be empty element and wont have an end tag
                    // so nither SetValue nor EndElement will be called, so set the value of ref here e.g. #3
                    ((XmlProperty)(_currentNode)).SetValue(ent);
                }
                else if (!(_currentNode is XmlUosCollection) && _currentNode is XmlCollectionProperty && !(_currentNode.Parent is XmlUosCollection))
                {
                    ((XmlCollectionProperty)_currentNode).Entities.Add(xmlEnt);
                }
            }
            else if (input.IsEmptyElement)
            {
                if (IsIfcProperty(elementName, out propIndex, out prop))
                {
                    XmlProperty node = new XmlProperty(_currentNode, prop.PropertyInfo, propIndex); ;
                    PropertyValue propVal = new PropertyValue();
                    Type t = node.Property.PropertyType;

                    if (!typeof(ExpressEnumerable).IsAssignableFrom(t)) // if its a empty collection then dont do anything
                    {
                        if (t != null && t.IsGenericType && t.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
                            t = Nullable.GetUnderlyingType(t);
                        ExpressType et = null;
                        if (t != null && typeof(ExpressType).IsAssignableFrom(t))
                            et = (ExpressType)(Activator.CreateInstance(t));

                        IfcParserType pt;
                        if (et != null)
                            pt = primitives[et.UnderlyingSystemType.Name];
                        else
                        {
                            if (t.IsEnum)
                            {
                                pt = IfcParserType.Enum;
                            }
                            else
                                pt = primitives[t.Name];
                        }

                        if (pt.ToString().ToLower() == "string")
                            propVal.Init("'" + input.Value + "'", pt);
                        else
                        {
                            if (pt.ToString().ToLower() == "boolean")
                                propVal.Init(Convert.ToBoolean(input.Value) ? ".T." : ".F", pt);
                            else
                                propVal.Init(input.Value, pt);
                        }
                        ((XmlEntity)node.Parent).Entity.IfcParse(node.PropertyIndex - 1, propVal);
                    }

                }
                else if (IsIfcType(elementName, out ifcType))
                {
                    IPersistIfc ent;
                    object[] param = new object[1];
                    param[0] = ""; // empty element
                    ent = (IPersistIfc)Activator.CreateInstance(ifcType.Type, param);

                    ((XmlProperty)_currentNode).SetValue(ent);
                }

                return;
            }
            else if (id == -1 && IsIfcProperty(elementName, out propIndex, out prop)) //we have an element which is a property
            {

                string cType = input.GetAttribute(_cTypeAttribute);
                if (string.IsNullOrEmpty(cType)) cType = input.GetAttribute("cType"); //in case namespace omitted
                if (IsCollection(prop)) //the property is a collection
                {
                    XmlCollectionProperty xmlColl = new XmlCollectionProperty(_currentNode, prop.PropertyInfo, propIndex);
                    switch (cType)
                    {
                        case "list":
                            xmlColl.CType = CollectionType.List;
                            break;
                        case "list-unique":
                            xmlColl.CType = CollectionType.ListUnique;
                            break;
                        case "set":
                            xmlColl.CType = CollectionType.Set;
                            break;
                        default:
                            xmlColl.CType = CollectionType.List;
                            break;
                    }

                    _currentNode = xmlColl;
                }
                else //it is a simple value property;
                {


                    // its parent can be a collection, if yes then this property needs to be added to parent
                    XmlNode n = new XmlProperty(_currentNode, prop.PropertyInfo, propIndex);
                    if (_currentNode is XmlCollectionProperty && !(_currentNode.Parent is XmlUosCollection))
                        ((XmlCollectionProperty)_currentNode).Entities.Add(n);

                    if (!input.IsEmptyElement) _currentNode = n;
                }
            }
            else if (id == -1 && IsIfcType(elementName, out ifcType)) // we have an Ifc ExpressType
            {


                // its parent can be a collection, if yes then this property needs to be added to parent
                XmlNode n = new XmlExpressType(_currentNode, ifcType.Type);
                if (_currentNode is XmlCollectionProperty && !(_currentNode.Parent is XmlUosCollection))
                    ((XmlCollectionProperty)_currentNode).Entities.Add(n);

                if (!input.IsEmptyElement) _currentNode = n;
            }
            else if (id == -1 && IsPrimitiveType(elementName, out parserType)) // we have an basic type i.e. double, bool etc
            {
                // its parent can be a collection, if yes then this property needs to be added to parent
                XmlNode n = new XmlBasicType(_currentNode, parserType);
                if (_currentNode is XmlCollectionProperty && !(_currentNode.Parent is XmlUosCollection))
                    ((XmlCollectionProperty)_currentNode).Entities.Add(n);

                if (!input.IsEmptyElement) _currentNode = n;
            }
            else
                throw new Exception("Illegal XML element tag");
        }