Пример #1
0
 public DesignModelProperty(string name, IDataType type, object value, ISchemaElementAttribute definition = null, IParseLocationInfo parseLocation = null)
 {
     Name          = name;
     Type          = type;
     Value         = value;
     ParseLocation = parseLocation;
     Definition    = definition;
 }
Пример #2
0
        /// <summary>
        /// Adds an attribute.
        /// </summary>
        /// <param name="attribute"></param>
        public void AddAttribute(ISchemaElementAttribute attribute)
        {
            if (_attributes.Any(x => x.Name == attribute.Name))
            {
                throw new SchemaException($"Attribute '{attribute.Name}' is already defined for schema element '{Name}'.");
            }

            if (_attributes.Any(x => x.Name == attribute.Name))
            {
                throw new SchemaException($"Attribute '{attribute.Name}' is already defined for schema element '{Name}'.");
            }

            _attributes.Add(attribute);
        }
Пример #3
0
        private XElement CreateAttributeElement(ISchemaElementAttribute schemaElementAttribute)
        {
            var attributeXmlElement = new XElement(XsdNamespace + "attribute",
                                                   new XAttribute("name", schemaElementAttribute.Name.LocalName),
                                                   new XAttribute("type", schemaElementAttribute.Type.XsdName)
                                                   );

            if (schemaElementAttribute.IsMandatory)
            {
                attributeXmlElement.Add(new XAttribute("use", "required"));
            }

            this.AddDocumentationElement(attributeXmlElement, schemaElementAttribute.Description);

            return(attributeXmlElement);
        }
Пример #4
0
 public XmlAttribute(ISchemaElementAttribute definition, string value, IParseLocationInfo parseLocation)
 {
     this.Definition    = definition;
     this.Value         = value;
     this.ParseLocation = parseLocation;
 }