コード例 #1
0
 private void ReadMetadataExtensions(XmlReader reader, GpxMetadata metadata)
 {
     SkipElement(reader);
 }
コード例 #2
0
        private GpxMetadata ReadGpxMetadata(XmlReader reader)
        {
            GpxMetadata metadata = new GpxMetadata();

            if (reader.IsEmptyElement)
            {
                return(metadata);
            }

            string elementName = reader.Name;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:

                    switch (reader.Name)
                    {
                    case "name":
                        metadata.Name = ReadContentAsString(reader);
                        break;

                    case "desc":
                        metadata.Description = ReadContentAsString(reader);
                        break;

                    case "author":
                        metadata.Author = ReadGpxPerson(reader);
                        break;

                    case "copyright":
                        metadata.Copyright = ReadGpxCopyright(reader);
                        break;

                    case "link":
                        metadata.Link = ReadGpxLink(reader);
                        break;

                    case "time":
                        metadata.Time = ReadContentAsDateTime(reader);
                        break;

                    case "keywords":
                        metadata.Keywords = ReadContentAsString(reader);
                        break;

                    case "bounds":
                        ReadGpxBounds(reader);
                        break;

                    case "extensions":
                        ReadMetadataExtensions(reader, metadata);
                        break;

                    default:
                        throw new FormatException(reader.Name);
                    }

                    break;

                case XmlNodeType.EndElement:
                    if (reader.Name != elementName)
                    {
                        throw new FormatException(reader.Name);
                    }
                    return(metadata);
                }
            }

            throw new FormatException(elementName);
        }