コード例 #1
0
        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);
                        }
                    }
                }
            }
        }