Exemplo n.º 1
0
        private void LoadAsUnknownXml(XmlNS.XmlReader reader)
        {
            var doc = new XmlNS.XmlDocument();

            doc.XmlResolver = null;
            doc.Load(reader);
            XmlNS.XmlElement unknownXml = doc.DocumentElement;
            _metadataSections.Add(new MetadataSection(null, null, unknownXml));
        }
Exemplo n.º 2
0
        private void LoadAsPolicy(XmlNS.XmlReader reader)
        {
            var doc = new XmlNS.XmlDocument();

            doc.XmlResolver = null;
            doc.Load(reader);
            XmlNS.XmlElement policy = doc.DocumentElement;
            _metadataSections.Add(MetadataSection.CreateFromPolicy(policy, null));
        }
Exemplo n.º 3
0
        private MetadataFileInfo AddXmlDocument(XmlNS.XmlElement document, string dialect)
        {
            MetadataFileInfo metadataFileInfo = null;

            if (document != null && !this.MetadataFiles.Any(mi => mi.Metadata == document))
            {
                var fileName = GetXmlElementFilename(document, dialect);
                var filePath = FileNameMgr.AddFileName(this.DirectoryPath, fileName, ".xml");
                metadataFileInfo = new MetadataFileInfo(document, filePath, null, document.WriteTo);
                this.MetadataFiles.Add(metadataFileInfo);
            }
            return(metadataFileInfo);
        }
Exemplo n.º 4
0
        private static string GetXmlElementFilename(XmlNS.XmlElement doc, string dialect)
        {
            string filename;

            if (dialect == MetadataSection.PolicyDialect)
            {
                filename = GetPolicyFilename(doc);
            }
            else
            {
                filename = defaultMetadataFileName;
            }

            return(filename);
        }
Exemplo n.º 5
0
        private static string GetPolicyFilename(XmlNS.XmlElement policyElement)
        {
            string id = null;

            if (policyElement.NamespaceURI == MetadataConstants.WSPolicy.NamespaceUri && policyElement.LocalName == MetadataConstants.WSPolicy.Elements.Policy)
            {
                id = policyElement.GetAttribute(MetadataConstants.Wsu.Attributes.Id, MetadataConstants.Wsu.NamespaceUri);
                if (id == null)
                {
                    id = policyElement.GetAttribute(MetadataConstants.Xml.Attributes.Id, MetadataConstants.Xml.NamespaceUri);
                }
                if (!string.IsNullOrEmpty(id))
                {
                    return(string.Format(CultureInfo.InvariantCulture, "{0}", id));
                }
            }

            return(defaultPolicyFileName);
        }