private void Write5_XmlSchemaAnnotation(XmlSchemaAnnotation?o) { if ((object?)o == null) { return; } WriteStartElement("annotation"); WriteAttribute(@"id", @"", ((string?)o.@Id)); WriteAttributes((XmlAttribute[]?)o.@UnhandledAttributes, o); System.Xml.Schema.XmlSchemaObjectCollection a = (System.Xml.Schema.XmlSchemaObjectCollection)o.@Items; if (a != null) { for (int ia = 0; ia < a.Count; ia++) { XmlSchemaObject ai = (XmlSchemaObject)a[ia]; if (ai is XmlSchemaAppInfo) { Write7_XmlSchemaAppInfo((XmlSchemaAppInfo)ai); } else if (ai is XmlSchemaDocumentation) { Write6_XmlSchemaDocumentation((XmlSchemaDocumentation)ai); } } } WriteEndElement(); }
private static XmlElement?ImportAnnotation(XmlSchemaAnnotation?annotation, XmlQualifiedName annotationQualifiedName) { if (annotation != null && annotation.Items != null && annotation.Items.Count > 0 && annotation.Items[0] is XmlSchemaAppInfo) { XmlSchemaAppInfo appInfo = (XmlSchemaAppInfo)annotation.Items[0]; XmlNode?[]? markup = appInfo.Markup; if (markup != null) { for (int i = 0; i < markup.Length; i++) { XmlElement?annotationElement = markup[i] as XmlElement; if (annotationElement != null && annotationElement.LocalName == annotationQualifiedName.Name && annotationElement.NamespaceURI == annotationQualifiedName.Namespace) { return(annotationElement); } } } } return(null); }
internal static XmlQualifiedName ImportActualType(XmlSchemaAnnotation?annotation, XmlQualifiedName defaultTypeName, XmlQualifiedName typeName) { XmlElement?actualTypeElement = ImportAnnotation(annotation, ActualTypeAnnotationName); if (actualTypeElement == null) { return(defaultTypeName); } XmlNode?nameAttribute = actualTypeElement.Attributes.GetNamedItem(ImportGlobals.ActualTypeNameAttribute); if (nameAttribute?.Value == null) { throw ExceptionUtil.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.AnnotationAttributeNotFound, ActualTypeAnnotationName.Name, typeName.Name, typeName.Namespace, ImportGlobals.ActualTypeNameAttribute))); } XmlNode?nsAttribute = actualTypeElement.Attributes.GetNamedItem(ImportGlobals.ActualTypeNamespaceAttribute); if (nsAttribute?.Value == null) { throw ExceptionUtil.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.AnnotationAttributeNotFound, ActualTypeAnnotationName.Name, typeName.Name, typeName.Namespace, ImportGlobals.ActualTypeNamespaceAttribute))); } return(new XmlQualifiedName(nameAttribute.Value, nsAttribute.Value)); }
internal override void AddAnnotation(XmlSchemaAnnotation annotation) { _annotation = annotation; }