Beispiel #1
0
        public void SimpleFileName()
        {
            string fileName    = @"C:\temp\foo.xml";
            string expectedUri = "file:///C:/temp/foo.xml";

            Assert.AreEqual(expectedUri, XmlSchemaCompletion.GetUri(fileName));
        }
 XmlSchemaCompletion ReadSchema(string fileName, bool readOnly)
 {
     try {
         string baseUri             = XmlSchemaCompletion.GetUri(fileName);
         XmlSchemaCompletion schema = factory.CreateXmlSchemaCompletionData(baseUri, fileName);
         schema.FileName   = FileName.Create(fileName);
         schema.IsReadOnly = readOnly;
         return(schema);
     } catch (Exception ex) {
         schemaErrors.Add(new RegisteredXmlSchemaError("Unable to read schema '" + fileName + "'.", ex));
     }
     return(null);
 }
        /// <summary>
        /// Creates two schemas, one which references the other via an
        /// xs:include.  Both schemas will exist in the same folder.
        /// </summary>
        /// <param name="mainSchema">The main schema's xml.</param>
        /// <param name="includedSchema">The included schema's xml.</param>
        public static XmlSchemaCompletion CreateSchemaCompletionDataObject(string mainSchema, string includedSchema)
        {
            if (!Directory.Exists(schemaPath))
            {
                Directory.CreateDirectory(schemaPath);
            }

            CreateSchema(Path.Combine(schemaPath, mainSchemaFileName), mainSchema);
            CreateSchema(Path.Combine(schemaPath, includedSchemaFileName), includedSchema);

            // Parse schema.
            string schemaFileName = Path.Combine(schemaPath, mainSchemaFileName);
            string baseUri        = XmlSchemaCompletion.GetUri(schemaFileName);

            return(new XmlSchemaCompletion(baseUri, schemaFileName));
        }
        public void BaseUriUsedWhenCreatingXmlSchemaCompletionData()
        {
            string baseUri = XmlSchemaCompletion.GetUri(addinSchemaFileName);

            Assert.AreEqual(baseUri, factory.GetBaseUri(addinSchemaFileName));
        }
Beispiel #5
0
        public void BaseUriUsedWhenCreatingNewXmlSchemaObject()
        {
            string baseUri = XmlSchemaCompletion.GetUri(newXmlSchemaFileName);

            Assert.AreEqual(baseUri, factory.GetBaseUri(newXmlSchemaFileName));
        }
Beispiel #6
0
 public void EmptyString()
 {
     Assert.AreEqual(String.Empty, XmlSchemaCompletion.GetUri(String.Empty));
 }
Beispiel #7
0
 public void NullFileName()
 {
     Assert.AreEqual(String.Empty, XmlSchemaCompletion.GetUri(null));
 }
        XmlSchemaCompletion LoadSchema(string fileName)
        {
            string baseUri = XmlSchemaCompletion.GetUri(fileName);

            return(factory.CreateXmlSchemaCompletionData(baseUri, fileName));
        }