// Skips to the end tag of the current element.
public override void Skip()
{
- int startDepth = Depth;
switch (NodeType)
{
case XmlNodeType.Element:
// Skips to the end tag of the current element.
public override async Task SkipAsync()
{
- int startDepth = Depth;
switch (NodeType)
{
case XmlNodeType.Element:
{
XmlNode? nextNode = oldChild.NextSibling;
RemoveChild(oldChild);
- XmlNode? node = InsertBefore(newChild, nextNode);
+ InsertBefore(newChild, nextNode);
return oldChild;
}
{
get
{
- XmlDocument? doc = OwnerDocument;
return HasReadOnlyParent(this);
}
}
{
if (ContentType == XmlSchemaContentType.Mixed)
{
- string ctype = IsOpen ? "Any" : "TextOnly";
return IsOpen ? ContentValidator.Any : ContentValidator.TextOnly;
}
else
_contentNode.ExpandTree(contentRoot, _symbols, _positions);
// calculate followpos
- int symbolsCount = _symbols.Count;
int positionsCount = _positions.Count;
BitSet firstpos = new BitSet(positionsCount);
BitSet lastpos = new BitSet(positionsCount);
public override void InitValidation(ValidationState context)
{
- int positionsCount = _positions.Count;
List<RangePositionInfo>? runningPositions = context.RunningPositions;
if (runningPositions != null)
{
internal void CompileFacetCombinations()
{
- RestrictionFacets baseRestriction = _datatype.Restriction!;
//They are not allowed on the same type but allowed on derived types.
if (
(_derivedRestriction.Flags & RestrictionFlags.MaxInclusive) != 0 &&
throw new XmlSchemaInferenceException(SR.SchInf_particle, 0, 0);
ct.Particle = new XmlSchemaSequence();
bCreatingNewSequence = true;
- XmlSchemaElement subelement = AddElement(_xtr.LocalName, _xtr.Prefix, _xtr.NamespaceURI, parentSchema, ((XmlSchemaSequence)ct.Particle).Items, -1);
+ AddElement(_xtr.LocalName, _xtr.Prefix, _xtr.NamespaceURI, parentSchema, ((XmlSchemaSequence)ct.Particle).Items, -1);
lastUsedSeqItem = 0;
if (!bCreatingNewType)
ct.Particle.MinOccurs = 0; //previously this was simple type so subelements did not exist
{
ct.Particle = new XmlSchemaSequence();
bCreatingNewSequence = true;
- XmlSchemaElement subelement = AddElement(_xtr.LocalName, _xtr.Prefix, _xtr.NamespaceURI, parentSchema, ((XmlSchemaSequence)ct.Particle).Items, -1);
+ AddElement(_xtr.LocalName, _xtr.Prefix, _xtr.NamespaceURI, parentSchema, ((XmlSchemaSequence)ct.Particle).Items, -1);
if (!bCreatingNewType)
{
((XmlSchemaSequence)ct.Particle).MinOccurs = decimal.Zero;
else
{
bool bParticleChanged = false;
- XmlSchemaElement subelement = FindMatchingElement(bCreatingNewType || bCreatingNewSequence, _xtr, ct, ref lastUsedSeqItem, ref bParticleChanged, parentSchema, Maxoccursflag);
+ FindMatchingElement(bCreatingNewType || bCreatingNewSequence, _xtr, ct, ref lastUsedSeqItem, ref bParticleChanged, parentSchema, Maxoccursflag);
}
}
else if (_xtr.NodeType == XmlNodeType.Text)
{
TypeForwardedFromAttribute? originalAssemblyInfo = typeForwardedFromAttribute[0] as TypeForwardedFromAttribute;
Debug.Assert(originalAssemblyInfo != null);
- Assembly originalAssembly = Assembly.Load(new AssemblyName(originalAssemblyInfo.AssemblyFullName));
+ Assembly.Load(new AssemblyName(originalAssemblyInfo.AssemblyFullName));
}
}
set { _sequenceId = value; }
}
- private string GetNullableType(TypeDesc td)
- {
- // SOAP encoded arrays not mapped to Nullable<T> since they always derive from soapenc:Array
- if (td.IsMappedType || (!td.IsValueType && (Elements![0].IsSoap || td.ArrayElementTypeDesc == null)))
- return td.FullName;
- if (td.ArrayElementTypeDesc != null)
- {
- return GetNullableType(td.ArrayElementTypeDesc) + "[]";
- }
- return "System.Nullable`1[" + td.FullName + "]";
- }
-
internal MemberMapping Clone()
{
return new MemberMapping(this);
}
Member[] allMembers = allMembersList.ToArray();
- MemberMapping[] allMemberMappings = allMemberMappingList.ToArray();
UnknownNodeAction unknownNodeAction = (_) => UnknownNode(o);
WriteAttributes(allMembers, anyAttribute, unknownNodeAction, ref o);
int anyCount = 0;
var namedAnys = new List<ElementAccessor>();
ElementAccessor? unnamedAny = null; // can only have one
- string? enumTypeName = (choice != null) ? choice.Mapping!.TypeDesc!.FullName : null;
for (int i = 0; i < elements.Length; i++)
{
}
else if (element.IsUnbounded)
{
- TypeDesc arrayTypeDesc = mapping.TypeDesc!.CreateArrayTypeDesc();
var enumerable = (IEnumerable)o!;
foreach (var e in enumerable)
{
int xmlnsMember = FindXmlnsIndex(mapping.Members!);
if (xmlnsMember >= 0)
{
- MemberMapping member = mapping.Members![xmlnsMember];
var source = (XmlSerializerNamespaces)p[xmlnsMember];
if (pLength > xmlnsMember)
private void Write46_XmlSchemaElement(XmlSchemaElement? o)
{
if ((object?)o == null) return;
- System.Type t = o.GetType();
WriteStartElement("element");
WriteAttribute(@"id", @"", o.Id);
WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
private void Write47_XmlSchemaKey(XmlSchemaKey? o)
{
if ((object?)o == null) return;
- System.Type t = o.GetType();
WriteStartElement("key");
WriteAttribute(@"id", @"", ((string?)o.@Id));
WriteAttribute(@"name", @"", ((string?)o.@Name));
private void Write50_XmlSchemaKeyref(XmlSchemaKeyref? o)
{
if ((object?)o == null) return;
- System.Type t = o.GetType();
WriteStartElement("keyref");
WriteAttribute(@"id", @"", ((string?)o.@Id));
private void Write51_XmlSchemaUnique(XmlSchemaUnique? o)
{
if ((object?)o == null) return;
- System.Type t = o.GetType();
WriteStartElement("unique");
WriteAttribute(@"id", @"", ((string?)o.@Id));
private void Write52_XmlSchemaChoice(XmlSchemaChoice? o)
{
if ((object?)o == null) return;
- System.Type t = o.GetType();
WriteStartElement("choice");
WriteAttribute(@"id", @"", ((string?)o.@Id));
private void InitPrimitiveIDs()
{
if (_tokenID != null) return;
- object ns = _r.NameTable.Add(XmlSchema.Namespace);
- object ns2 = _r.NameTable.Add(UrtTypes.Namespace);
+ _r.NameTable.Add(XmlSchema.Namespace);
+ _r.NameTable.Add(UrtTypes.Namespace);
_stringID = _r.NameTable.Add("string");
_intID = _r.NameTable.Add("int");
_arrayName = arrayName + "_" + i.ToString(CultureInfo.InvariantCulture);
_choiceArrayName = "choice_" + _arrayName;
_choiceSource = choiceSource;
- ElementAccessor[]? elements = mapping.Elements;
if (mapping.TypeDesc!.IsArrayLike)
{
{
if (structMapping.TypeDesc!.IsRoot)
return;
- bool useReflection = structMapping.TypeDesc.UseReflection;
string methodName = (string)MethodNames[structMapping]!;
Writer.WriteLine();
Writer.Write("object");
private void WriteAddCollectionFixup(TypeDesc typeDesc, bool readOnly, string memberSource, string targetSource)
{
Writer.WriteLine("// get array of the collection items");
- bool useReflection = typeDesc.UseReflection;
CreateCollectionInfo? create = (CreateCollectionInfo?)_createMethods[typeDesc];
if (create == null)
{
if (!typeDesc.UseReflection)
return obj + ".@" + memberName;
- TypeDesc saveTypeDesc = typeDesc;
while (typeDesc != null)
{
string typeFullName = typeDesc.CSharpName;
int xmlnsMember = FindXmlnsIndex(mapping.Members!);
if (xmlnsMember >= 0)
{
- MemberMapping member = mapping.Members![xmlnsMember];
string source = "((" + typeof(System.Xml.Serialization.XmlSerializerNamespaces).FullName + ")p[" + xmlnsMember.ToString(CultureInfo.InvariantCulture) + "])";
Writer.Write("if (pLength > ");
if (choice != null)
{
- bool choiceUseReflection = choice.Mapping!.TypeDesc!.UseReflection;
- string choiceFullName = choice.Mapping.TypeDesc.CSharpName;
+ string choiceFullName = choice.Mapping!.TypeDesc!.CSharpName;
WriteArrayLocalDecl(choiceFullName + "[]", "c", choiceSource, choice.Mapping.TypeDesc);
// write check for the choice identifier array
Writer.WriteLine("if (c == null || c.Length < a.Length) {");
string? enumFullName = null;
- bool useReflection = element.Mapping!.TypeDesc!.UseReflection;
if (choice != null)
{
bool enumUseReflection = choice.Mapping!.TypeDesc!.UseReflection;
}
else if (element.Mapping is SpecialMapping)
{
- SpecialMapping mapping = (SpecialMapping)element.Mapping;
- bool useReflection = mapping.TypeDesc!.UseReflection;
- TypeDesc td = mapping.TypeDesc;
- string fullTypeName = td.CSharpName;
-
-
if (element.Mapping is SerializableMapping)
{
WriteElementCall("WriteSerializable", typeof(IXmlSerializable), source, name, ns, element.IsNullable, !element.Any);
int xmlnsMember = FindXmlnsIndex(mapping.Members!);
if (xmlnsMember >= 0)
{
- MemberMapping member = mapping.Members![xmlnsMember];
string source = "((" + typeof(XmlSerializerNamespaces).FullName + ")p[" + xmlnsMember.ToString(CultureInfo.InvariantCulture) + "])";
ilg.Ldloc(pLengthLoc);
WriteChoiceTypeCheck(source, fullTypeName, choice!, enumFullName, element.Mapping.TypeDesc);
- SourceInfo castedSource = source;
- castedSource = source.CastTo(element.Mapping.TypeDesc);
+ SourceInfo castedSource = source.CastTo(element.Mapping.TypeDesc);
WriteElement(element.Any ? source : castedSource, element, arrayName, writeAccessors);
}
else
{
TypeDesc td = element.IsUnbounded ? element.Mapping!.TypeDesc!.CreateArrayTypeDesc() : element.Mapping!.TypeDesc!;
- string fullTypeName = td.CSharpName;
if (wroteFirstIf) ilg.InitElseIf();
else { wroteFirstIf = true; ilg.InitIf(); }
WriteInstanceOf(source, td.Type!);
// WriteInstanceOf leave bool on the stack
ilg.AndIf();
- SourceInfo castedSource = source;
- castedSource = source.CastTo(td);
+ SourceInfo castedSource = source.CastTo(td);
WriteElement(element.Any ? source : castedSource, element, arrayName, writeAccessors);
}
}
if (elements.Length - anyCount > 0) ilg.InitElseIf();
else ilg.InitIf();
- string fullTypeName = typeof(XmlElement).FullName!;
-
source.Load(typeof(object));
ilg.IsInst(typeof(XmlElement));
ilg.Load(null);
}
if (text != null)
{
- string fullTypeName = text.Mapping!.TypeDesc!.CSharpName;
if (elements.Length > 0)
{
ilg.InitElseIf();
- WriteInstanceOf(source, text.Mapping.TypeDesc.Type!);
+ WriteInstanceOf(source, text.Mapping!.TypeDesc!.Type!);
ilg.AndIf();
SourceInfo castedSource = source.CastTo(text.Mapping.TypeDesc);
WriteText(castedSource, text);
}
else
{
- SourceInfo castedSource = source.CastTo(text.Mapping.TypeDesc);
+ SourceInfo castedSource = source.CastTo(text.Mapping!.TypeDesc!);
WriteText(castedSource, text);
}
}
ilg.Cne();
}
ilg.If();
- string fullTypeName = element.Mapping.TypeDesc.BaseTypeDesc!.CSharpName;
- SourceInfo castedSource = source.CastTo(element.Mapping.TypeDesc.BaseTypeDesc);
+ SourceInfo castedSource = source.CastTo(element.Mapping.TypeDesc.BaseTypeDesc!);
ElementAccessor e = element.Clone();
e.Mapping = ((NullableMapping)element.Mapping).BaseMapping;
WriteElement(e.Any ? source : castedSource, e, arrayName, writeAccessor);
}
else if (element.Mapping is SpecialMapping)
{
- SpecialMapping mapping = (SpecialMapping)element.Mapping;
- TypeDesc td = mapping.TypeDesc!;
- string fullTypeName = td.CSharpName;
-
-
if (element.Mapping is SerializableMapping)
{
WriteElementCall("WriteSerializable", typeof(IXmlSerializable), source, name, ns, element.IsNullable, !element.Any);
{
foreach (Type type in scope.Types)
{
- TypeDesc typeDesc = scope.GetTypeDesc(type);
+ scope.GetTypeDesc(type);
}
}
bool undefined = false;
for (int prev = record + 1; prev < exAll; prev++)
{
- string? prevPrefix, prevNsUri;
- ScopeFlags prevFlags = GetName(ref _records[prev], out prevPrefix, out prevNsUri);
+ string? prevPrefix;
+ GetName(ref _records[prev], out prevPrefix, out _);
if (
(flags & ScopeFlags.NsDecl) != 0 &&
prevPrefix == recPrefix
Debug.Assert(expr != null);
XPathScanner scanner;
QilNode result;
- int startPos = pos;
SetEnvironmentFlags(/*allowVariables:*/true, /*allowCurrent:*/true, /*allowKey:*/true);
try
// It's OK to suppress the SxS warning.
private void LoadImport()
{
- ContextInfo ctxInfo = _input.GetAttributes(_importIncludeAttributes);
+ _input.GetAttributes(_importIncludeAttributes);
if (_input.MoveToXsltAttribute(0, "href"))
{
// It's OK to suppress the SxS warning.
private void LoadInclude()
{
- ContextInfo ctxInfo = _input.GetAttributes(_importIncludeAttributes);
+ _input.GetAttributes(_importIncludeAttributes);
if (_input.MoveToXsltAttribute(0, "href"))
{
};
private void LoadOutput()
{
- ContextInfo ctxInfo = _input.GetAttributes(_outputAttributes);
+ _input.GetAttributes(_outputAttributes);
Output output = _compiler.Output;
XmlWriterSettings settings = output.Settings;
QilName keyName = ParseQNameAttribute(0)!;
string? match = ParseStringAttribute(1, "match");
string? use = ParseStringAttribute(2, "use");
- string? collation = ParseCollationAttribute(3);
+ ParseCollationAttribute(3);
_input.MoveToElement();
XslNodeType.Unknown
);
Debug.Assert(nodeType != XslNodeType.Unknown);
- bool isParam = Ref.Equal(localName, _atoms.Param);
ContextInfo ctxInfo = _input.GetAttributes(
nodeType == XslNodeType.Variable ? _variableAttributes :
nodeType == XslNodeType.Param ? _paramAttributes :
string? select = ParseStringAttribute(0, "select");
string? lang = ParseStringAttribute(1, "lang");
string? order = ParseStringAttribute(2, "order");
- string? collation = ParseCollationAttribute(3);
+ ParseCollationAttribute(3);
TriState stable = ParseYesNoAttribute(4, "stable");
string? caseOrder = ParseStringAttribute(5, "case-order");
string? dataType = ParseStringAttribute(6, "data-type");
internal override bool CompileAttribute(Compiler compiler)
{
string name = compiler.Input.LocalName;
- string value = compiler.Input.Value;
if (Ref.Equal(name, compiler.Atoms.UseAttributeSets))
{
AddAction(compiler.CreateUseAttributeSetsAction());
const string attributeUri = "existingUri";
XmlDocument doc = CreateDocumentWithElement();
XmlElement element = doc.DocumentElement;
- XmlAttribute existingAttr = element.Attributes.Append(doc.CreateAttribute(attributeName, attributeUri));
+ element.Attributes.Append(doc.CreateAttribute(attributeName, attributeUri));
XmlAttribute anotherAttr = element.Attributes.Append(doc.CreateAttribute("anotherAttribute"));
var newAttr = doc.CreateAttribute(attributeName, attributeUri);
XmlDocument doc = CreateDocumentWithElement();
XmlElement element = doc.DocumentElement;
XmlAttribute anotherAttr = element.Attributes.Append(doc.CreateAttribute("anotherAttribute"));
- XmlAttribute existingAttr = element.Attributes.Append(doc.CreateAttribute(attributeName, attributeUri));
+ element.Attributes.Append(doc.CreateAttribute(attributeName, attributeUri));
// assert on implicitly set preconditions
Assert.Same(anotherAttr, element.Attributes[0]);
var xmlDocument = new XmlDocument();
var cdata = xmlDocument.CreateCDataSection("]]>");
- AssertExtensions.Throws<ArgumentException>(null, () => { var test = cdata.OuterXml; });
+ AssertExtensions.Throws<ArgumentException>(null, () => cdata.OuterXml);
Assert.Equal(string.Empty, cdata.InnerXml);
Assert.Equal("]]>", cdata.InnerText);
Assert.Equal(XmlNodeType.CDATA, cdata.NodeType);
public static void InvalidEncoding()
{
var xmlDocument = new XmlDocument();
- var decl = xmlDocument.CreateXmlDeclaration("1.0", "wrong", "yes");
+ xmlDocument.CreateXmlDeclaration("1.0", "wrong", "yes");
}
[Fact]
public static void RespectTypesDerivedFromNameTable()
{
var customNameTable = new CustomNameTable();
- var xmlDocument = new XmlDocument(customNameTable);
+ new XmlDocument(customNameTable);
Assert.True(customNameTable.NumberOfCallsToAddStringMethod > 0);
}
var xmlDocument = new XmlDocument();
var fragment = xmlDocument.CreateDocumentFragment();
- var text1 = xmlDocument.CreateTextNode("test_test1");
- var text2 = xmlDocument.CreateTextNode("test_test2");
+ xmlDocument.CreateTextNode("test_test1");
+ xmlDocument.CreateTextNode("test_test2");
fragment.Normalize();
Assert.Equal(string.Empty, fragment.OuterXml);
[Fact]
public void NodeReaderConstructionWithNull()
{
- Assert.Throws<ArgumentNullException>(() =>
- {
- var nodeReader = new XmlNodeReader(null);
- });
+ Assert.Throws<ArgumentNullException>(() => new XmlNodeReader(null));
}
}
}
public void SetSchemaSetWithInvalidContent_TypeCollision()
{
XmlSchemaValidator val;
- XmlSchemaInfo info = new XmlSchemaInfo();
XmlSchemaSet sch = new XmlSchemaSet();
public void AddSchemasWithTypeCollision()
{
XmlSchemaValidator val = CreateValidator(new XmlSchemaSet());
- XmlSchemaInfo info = new XmlSchemaInfo();
val.AddSchema(XmlSchema.Read(XmlReader.Create(new StringReader("<?xml version=\"1.0\" ?>\n" +
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" +
public void CallAtRootLevel_Without_With_PartialValidationSet(bool partialValidation)
{
XmlSchemaValidator val;
- XmlSchemaInfo info = new XmlSchemaInfo();
XmlSchemaSet schemas = CreateSchemaSet("", "<?xml version=\"1.0\"?>\n" +
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" +
" <xs:attribute name=\"attr1\" />\n" +
{
XmlSchemaValidator val;
XmlSchemaInfo info = new XmlSchemaInfo();
- XmlSchemaSet schemas = new XmlSchemaSet();
XmlSchemaParticle[] result;
val = CreateValidator(XSDFILE_GET_EXPECTED_PARTICLES);
public void SetPartiaValidationAndCallValidate_Text_WhiteSpace_Valid(string typeToValidate)
{
XmlSchemaValidator val;
- XmlSchemaInfo info = new XmlSchemaInfo();
XmlSchemaSet schemas = new XmlSchemaSet();
schemas.Add("", Path.Combine(TestData, XSDFILE_PARTIAL_VALIDATION));
res.CalledGetEntity += new XmlTestResolverEventHandler(holder.CallBackGetEntity);
XmlNamespaceManager manager = new XmlNamespaceManager(new NameTable());
- XmlSchemaInfo info = new XmlSchemaInfo();
XmlSchemaValidator val = new XmlSchemaValidator(new NameTable(),
new XmlSchemaSet(),
manager,
res.CalledGetEntity += new XmlTestResolverEventHandler(holder.CallBackGetEntity);
XmlNamespaceManager manager = new XmlNamespaceManager(new NameTable());
- XmlSchemaInfo info = new XmlSchemaInfo();
XmlSchemaValidator val = new XmlSchemaValidator(new NameTable(),
new XmlSchemaSet(),
manager,
public void PassNullXmlSchemaInfo__Valid()
{
XmlSchemaValidator val = CreateValidator(XSDFILE_VALIDATE_ATTRIBUTE);
- XmlSchemaInfo info = new XmlSchemaInfo();
val.Initialize();
val.ValidateElement("OneAttributeElement", "", null);
public class TCGetUnspecifiedDefaultAttributes : CXmlSchemaValidatorTestCase
{
- private ITestOutputHelper _output;
public TCGetUnspecifiedDefaultAttributes(ITestOutputHelper output) : base(output)
{
- _output = output;
}
[Fact]
public void PassNull__Invalid()
{
XmlSchemaValidator val = CreateValidator(XSDFILE_VALIDATE_ATTRIBUTE);
- XmlSchemaInfo info = new XmlSchemaInfo();
val.Initialize();
val.ValidateElement("OneAttributeElement", "", null);
public void CallWithoutValidationOfRequiredAttribute()
{
XmlSchemaValidator val = CreateValidator(XSDFILE_VALIDATE_ATTRIBUTE);
- ArrayList atts = new ArrayList();
val.Initialize();
val.ValidateElement("RequiredAttributeElement", "", null);
public void PassNullXmlSchemaInfo__Valid()
{
XmlSchemaValidator val = CreateValidator(XSDFILE_VALIDATE_ATTRIBUTE);
- XmlSchemaInfo info = new XmlSchemaInfo();
val.Initialize();
val.ValidateElement("OneAttributeElement", "", null);
public void ProvideValidXsiType()
{
XmlSchemaValidator val;
- XmlSchemaInfo info = new XmlSchemaInfo();
XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable());
XmlSchemaSet schemas = new XmlSchemaSet();
public void ProvideInvalidXsiType()
{
XmlSchemaValidator val;
- XmlSchemaInfo info = new XmlSchemaInfo();
XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable());
XmlSchemaSet schemas = new XmlSchemaSet();
XmlSchema Schema = XmlSchema.Read(XmlReader.Create(xsd), ValidationCallback);
ss.XmlResolver = new XmlUrlResolver();
- XmlSchema Schema1 = ss.Add(Schema);
+ ss.Add(Schema);
ValidateSchemaSet(ss, expCount, false, 0, 0, 0, "Validation after add");
ValidateWithSchemaInfo(ss);
ValidateSchemaSet(ss, expCount, true, expCountGT, expCountGE, expCountGA, "Validation after add/comp");
ValidateWithSchemaInfo(ss);
- XmlSchema Schema2 = null;
foreach (XmlSchema schema in ss.Schemas())
- Schema2 = ss.Reprocess(schema);
+ ss.Reprocess(schema);
ValidateSchemaSet(ss, expCount, false, 1, 0, 0, "Validation after repr");
ValidateWithSchemaInfo(ss);
XmlSchema Schema = XmlSchema.Read(XmlReader.Create(xsd), ValidationCallback);
ss.XmlResolver = new XmlUrlResolver();
- XmlSchema Schema1 = ss.Add(Schema);
+ ss.Add(Schema);
ValidateSchemaSet(ss, expCount, false, 0, 0, 0, "Validation after add");
ValidateWithXmlReader(ss, xml, xsd);
XmlSchema Schema = XmlSchema.Read(XmlReader.Create(xsd), ValidationCallback);
ss.XmlResolver = new XmlUrlResolver();
- XmlSchema Schema1 = ss.Add(Schema);
+ ss.Add(Schema);
ValidateSchemaSet(ss, expCount, false, 0, 0, 0, "Validation after add");
ValidateWithSchemaInfo(ss);
XmlSchema Schema = XmlSchema.Read(XmlReader.Create(xsd), ValidationCallback);
ss.XmlResolver = new XmlUrlResolver();
- XmlSchema Schema1 = ss.Add(Schema);
+ ss.Add(Schema);
ValidateSchemaSet(ss, expCount, false, 0, 0, 0, "Validation after add");
ValidateWithXmlReader(ss, xml, xsd);
ValidateSchemaSet(ss, expCount - 1, true, expCountGERC, expCountGER, 0, "Validation after add");
ValidateWithXmlReader(ss, xml, xsd);
- XmlSchema Schema2 = null;
try
{
- Schema2 = ss.Reprocess(Schema);
+ ss.Reprocess(Schema);
Assert.True(false);
}
catch (ArgumentException e)
XmlSchemaSet ss = new XmlSchemaSet();
ss.XmlResolver = new XmlUrlResolver();
XmlSchema Schema = XmlSchema.Read(XmlReader.Create(xsd), null);
- XmlSchema Schema1 = ss.Add(Schema);
+ ss.Add(Schema);
ValidateSchemaSet(ss, expCount, false, 0, 0, 0, "Validation after add");
ss.Compile();
XmlSchemaSet ss = new XmlSchemaSet();
XmlSchema Schema = XmlSchema.Read(XmlReader.Create(xsd), null);
- XmlSchema Schema1 = ss.Add(Schema);
+ ss.Add(Schema);
ValidateSchemaSet(ss, 1, false, 0, 0, 0, "Validation after add");
ss.Compile();
}
}
- XmlSchema removedSchema = ss.Remove(schema);
+ ss.Remove(schema);
Assert.Equal(0, ss.Count);
ss.Compile();
Assert.Equal(0, ss.Count);
while (xmlReader.Read()) ;
}
- XmlSchema removedSchema = ss.Remove(schema);
+ ss.Remove(schema);
Assert.Equal(0, ss.Count);
ss.Compile();
Assert.Equal(0, ss.Count);
{
Initialize();
- Regex regex = new Regex(@"^\w+$");
string schemaContent = @"<xs:schema elementFormDefault='qualified' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name='validationTest'>
<xs:simpleType>
XmlReflectionMember member = members[0] = new XmlReflectionMember();
member.MemberType = typeof(TypeWithQNameArrayAsXmlAttributeInvalidDefaultValue);
XmlMembersMapping mappings = importer.ImportMembersMapping("root", "", members, true);
- XmlMemberMapping xmp = mappings[0];
XmlSchemas schema = new XmlSchemas();
XmlSchemaExporter exporter = new XmlSchemaExporter(schema);
AssertExtensions.Throws<XmlException,Exception>(() => exporter.ExportMembersMapping(mappings));
string xmlFileContent = @"<root><date>2003-01-08T15:00:00-00:00</date></root>";
Stream sm = GenerateStreamFromString(xmlFileContent);
XmlTextReader reader = new XmlTextReader(sm);
- MyXmlTextParser text = new MyXmlTextParser(reader);
+ new MyXmlTextParser(reader);
}
[Fact]
public static void XmlMembersMapping_TypeWithXmlAttributes()
{
string memberName = "data";
- string ns = s_defaultNs;
- XmlReflectionMember member = GetReflectionMember<TypeWithXmlAttributes>(memberName, ns);
- var members = new XmlReflectionMember[] { member };
TypeWithXmlAttributes value = new TypeWithXmlAttributes { MyName = "fooname", Today = DateTime.Now };
var actual = RoundTripWithXmlMembersMapping<TypeWithXmlAttributes>(value,
</TypeWithByteProperty>");
writer.Flush();
stream.Position = 0;
- Assert.Throws<InvalidOperationException>(() => {
- var deserializedObj = (TypeWithByteProperty)serializer.Deserialize(stream);
- });
+ Assert.Throws<InvalidOperationException>(() => (TypeWithByteProperty)serializer.Deserialize(stream));
}
}
[Fact]
public static void Xml_SimpleType()
{
- var serializer = new XmlSerializer(typeof(SimpleType));
var obj = new SimpleType { P1 = "foo", P2 = 1 };
var deserializedObj = SerializeAndDeserialize(obj,
@"<?xml version=""1.0"" encoding=""utf-16""?>