Ejemplo n.º 1
0
        public void WriteTarget (Target target, DisplayOptions options, XmlWriter writer) {
            if (target == null) throw new ArgumentNullException("target");
            if (writer == null) throw new ArgumentNullException("writer");

            NamespaceTarget space = target as NamespaceTarget;
            if (space != null) {
                WriteNamespaceTarget(space, options, writer);
                return;
            }

            TypeTarget type = target as TypeTarget;
            if (type != null) {
                WriteTypeTarget(type, options, writer);
                return;
            }

            MemberTarget member = target as MemberTarget;
            if (member != null) {
                WriteMemberTarget(member, options, writer);
                return;
            }

            throw new InvalidOperationException();
        }
Ejemplo n.º 2
0
        // Target factory methods

        public static Target CreateTarget (XPathNavigator topic, LinkType2 type) {
            if (topic == null) throw new ArgumentNullException("topic");

            bool isApiTarget = (bool)topic.Evaluate("boolean(apidata)");

            Target target;
            if (isApiTarget) {
                target = CreateApiTarget(topic, type);
            } else {
                target = new Target();
            }

            if (target == null) throw new XmlSchemaValidationException(String.Format("The target file '{0}' is not valid.", topic.BaseURI));

            target.id = (string)topic.Evaluate(topicIdExpression);
            if (String.IsNullOrEmpty(target.id)) throw new XmlSchemaValidationException(String.Format("The target file '{0}' is not valid.", topic.BaseURI));

            target.container = (string)topic.Evaluate(topicContainerExpression);

            target.file = (string)topic.Evaluate(topicFileExpression);
            if (String.IsNullOrEmpty(target.file)) throw new XmlSchemaValidationException(String.Format("The target file '{0}' is not valid.", topic.BaseURI));

            target.type = type;

            return(target);
        }
Ejemplo n.º 3
0
        // change the collection

        public void Add (Target target) {
            index[target.Id] = target;
            //index.Add(target.Id, target);
        }