public override void startElement(System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
        {
            currentChars = "";
            if ("entry".Equals(local) && !"bibtex:entry".Equals(raw) && !inEntry)
            {
                inEntry = true;
                entry = new Entry();
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if (atts.GetFullName(i).Equals("id"))
                    {
                        entry.ID = atts.GetValue(i);
                    }
                    else if (atts.GetFullName(i).Equals("term"))
                    {
                        entry.Label = atts.GetValue(i);
                    }
                }
            }
            if ("metadataList".Equals(local) && !inMetadataList)
            {
                inMetadataList = true;
            }

            // if we're in a metadataList then look at individual
            // metadata nodes and check for any whose content refers
            // to QSAR metadata and save that. Currently it does'nt 
            // differentiate between descriptorType or descriptorClass.
            // Do we need to differentiate?
            //
            // RG: I think so and so I save a combination of the dictRef attribute
            // and the content attribute
            if ("metadata".Equals(local) && inMetadataList)
            {
                for (int i = 0; i < atts.GetLength() - 1; i += 2)
                {

                    System.String dictRefValue = "";
                    if (atts.GetFullName(i).Equals("dictRef"))
                    {
                        dictRefValue = atts.GetValue(i);
                    }
                    if (atts.GetFullName(i + 1).Equals("content"))
                    {
                        System.String content = atts.GetValue(i + 1);
                        if (content.IndexOf("qsar-descriptors-metadata:") == 0)
                        {
                            entry.setDescriptorMetadata(dictRefValue + "/" + content);
                        }
                    }
                }
            }
        }
示例#2
0
 public virtual void addEntry(Entry entry)
 {
     entries[entry.ID.ToLower()] = entry;
 }
示例#3
0
        public static Entry unmarshal(XmlElement entry, System.String ownNS)
        {
            //LoggingTool //logger = new LoggingTool(typeof(OWLFile));

            // create a new entry by ID
            XmlAttribute id = entry.Attributes["ID", rdfNS];
            //logger.debug("ID: ", id);
            Entry dbEntry = new Entry(id.Value);

            // set additional, optional data
            XmlElement label = (XmlElement)entry.GetElementsByTagName("label", rdfsNS)[0];
            //logger.debug("label: ", label);
            if (label != null)
                dbEntry.Label = label.Value;

            dbEntry.ClassName = entry.Name;
            //logger.debug("class name: ", dbEntry.ClassName);

            XmlElement definition = (XmlElement)entry.GetElementsByTagName("definition", ownNS)[0];
            if (definition != null)
            {
                dbEntry.Definition = definition.Value;
            }
            XmlElement description = (XmlElement)entry.GetElementsByTagName("description", ownNS)[0];
            if (description != null)
            {
                dbEntry.Description = description.Value;
            }

            if (entry.Name.Equals("Descriptor"))
                dbEntry.RawContent = entry;

            return dbEntry;
        }