Author: atsushi
Date: 2006-01-12 22:47:20 -0500 (Thu, 12 Jan 2006)
New Revision: 55476
Added:
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
tags/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
Modified:
tags/mono-1-1-13/mcs/class/System.XML/ChangeLog
tags/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
tags/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/ChangeLog
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlAtomicValue.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml/ChangeLog
tags/mono-1-1-13/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlWriter.cs
tags/mono-1-1-13/mcs/class/System.XML/System.Xml_test.dll.sources
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/ChangeLog
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
tags/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
Log:
2006-01-13 Atsushi Enomoto <[EMAIL PROTECTED]>
merged 55290, 55291, 55309, 55359, 55360, 55364, 55371, 55414, 55415 and
55418 from trunk.
Modified: tags/mono-1-1-13/mcs/class/System.XML/ChangeLog
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/ChangeLog 2006-01-13 03:22:19 UTC
(rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/ChangeLog 2006-01-13 03:47:20 UTC
(rev 55476)
@@ -1,3 +1,12 @@
+2006-01-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * System.Xml_test.dll.sources : added XmlSchemaTypeTests.cs.
+
+2006-01-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * System.Xml_test.dll.sources : XmlSchemaDatatypeTests.cs was missing.
+ collected sys.xml.schema lines.
+
2005-12-28 Gert Driesen <[EMAIL PROTECTED]>
* System.Xml_test.dll.sources: Added XmlSchemaExporterTests.cs.
Modified: tags/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
2006-01-13 03:47:20 UTC (rev 55476)
@@ -1,3 +1,9 @@
+2006-01-11 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlSchemaValidatingReader.cs : removed unused constructors.
+ Now it implements IXmlSchemaInfo. Use XmlSchemaType instead of
+ Object to represent schema types.
+
2006-01-06 Atsushi Enomoto <[EMAIL PROTECTED]>
* XsdValidatingReader.cs :
Modified:
tags/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
===================================================================
---
tags/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++
tags/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -76,7 +76,8 @@
namespace Mono.Xml.Schema
{
- internal class XmlSchemaValidatingReader : XmlReader, IXmlLineInfo
+ internal class XmlSchemaValidatingReader : XmlReader, IXmlLineInfo,
+ IXmlSchemaInfo
{
static readonly XsAttr [] emptyAttributeArray =
new XsAttr [0];
@@ -91,7 +92,6 @@
IXmlLineInfo readerLineInfo;
ValidationType validationType;
IXmlNamespaceResolver nsResolver;
-// IHasXmlSchemaInfo sourceReaderSchemaInfo;
int startDepth;
StringBuilder tmpBuilder = new StringBuilder ();
@@ -100,48 +100,14 @@
int currentDefaultAttribute = -1;
ArrayList defaultAttributesCache = new ArrayList ();
bool defaultAttributeConsumed;
- object currentAttrType;
+ XmlSchemaType currentAttrType;
// Extra for XmlSchemaValidtingReader
// (not in XsdValidatingReader)
XsElement element; // ... xsinfo.Element?
- object xsiType; // ... xsinfo.SchemaType?
#endregion
- public XmlSchemaValidatingReader (XmlReader reader,
XmlSchemaSet schemas)
- {
- nsResolver = reader as IXmlNamespaceResolver;
- if (nsResolver == null)
- throw new ArgumentException ("Argument
XmlReader must implement IXmlNamespaceResolver.");
- options = ValidationFlags.ReportValidationWarnings
- | ValidationFlags.ProcessSchemaLocation
- | ValidationFlags.ProcessInlineSchema;
-
- this.reader = reader;
- if (schemas == null)
- schemas = new XmlSchemaSet ();
- v = new XmlSchemaValidator (
- reader.NameTable,
- schemas,
- nsResolver,
- options);
-
- readerLineInfo = reader as IXmlLineInfo;
- startDepth = reader.Depth;
- getter = delegate () { return Value; };
- xsinfo = new XmlSchemaInfo (); // transition cache
- v.LineInfoProvider = this;
- v.ValidationEventSender = reader;
-#if !NON_MONO
- v.XmlResolver = schemas.XmlResolver;
-#else
- v.XmlResolver = new XmlUrlResolver ();
-#endif
- v.SourceUri = new Uri (null, reader.BaseURI); // FIXME:
it is in fact not in MS.NET.
- v.Initialize ();
- }
-
public XmlSchemaValidatingReader (XmlReader reader,
XmlReaderSettings settings)
{
@@ -164,6 +130,7 @@
readerLineInfo = reader as IXmlLineInfo;
startDepth = reader.Depth;
getter = delegate () { return Value; };
+ xsinfo = new XmlSchemaInfo (); // transition cache
v.LineInfoProvider = this;
v.ValidationEventSender = reader;
#if !NON_MONO
@@ -177,48 +144,11 @@
v.Initialize ();
}
- public XmlSchemaValidatingReader (
- XPathNavigator navigator,
- XmlSchemaSet schemas,
- ValidationEventHandler handler)
- {
- this.reader = navigator.ReadSubtree ();
- startDepth = reader.Depth;
- IXmlSchemaInfo info = navigator.SchemaInfo;
- SchemaType schemaType = info != null ?
- info.SchemaType : null;
-
- if (schemas == null && schemaType == null)
- throw new ArgumentException ("Neither of
XmlSchemaSet is specified, nor XPathNavigator does not provide schema type
information on current node.");
-
- if (schemas == null)
- schemas = new XmlSchemaSet (reader.NameTable);
-
- v = new XmlSchemaValidator (
- navigator.NameTable,
- schemas,
- navigator,
- ValidationFlags.ProcessIdentityConstraints);
-
- readerLineInfo = navigator as IXmlLineInfo;
- getter = delegate () { return Value; };
- v.LineInfoProvider = this;
- v.ValidationEventSender = navigator;
-#if !NON_MONO
- v.XmlResolver = schemas.XmlResolver;
-#else
- v.XmlResolver = new XmlUrlResolver ();
-#endif
- v.Initialize (schemaType);
- }
-
public ValidationEventHandler ValidationEventHandler;
- public object ActualType {
+ public XmlSchemaType ElementSchemaType {
get {
- return xsiType != null ?
- xsiType :
- element != null ? element.ElementType :
null;
+ return element != null ?
element.ElementSchemaType : null;
}
}
@@ -242,24 +172,24 @@
get { return readerLineInfo != null ?
readerLineInfo.LinePosition : 0; }
}
- public object SchemaType {
+ public XmlSchemaType SchemaType {
get {
if (ReadState != ReadState.Interactive)
return null;
switch (NodeType) {
case XmlNodeType.Element:
- if (ActualType != null)
- return ActualType;
+ if (ElementSchemaType != null)
+ return ElementSchemaType;
else
return
null;//SourceReaderSchemaType;
case XmlNodeType.Attribute:
if (currentAttrType == null) {
- ComplexType ct = ActualType as
ComplexType;
+ ComplexType ct =
ElementSchemaType as ComplexType;
if (ct != null) {
XsAttr attdef =
ct.AttributeUses [new XmlQualifiedName (LocalName, NamespaceURI)] as XsAttr;
if (attdef != null)
- currentAttrType
= attdef.AttributeType;
+ currentAttrType
= attdef.AttributeSchemaType;
return currentAttrType;
}
// currentAttrType =
SourceReaderSchemaType;
@@ -450,7 +380,7 @@
}
public override IXmlSchemaInfo SchemaInfo {
- get { return xsinfo; }
+ get { return this; }
}
public override string Value {
@@ -855,6 +785,30 @@
}
#endregion
+
+ #region IXmlSchemaInfo
+
+ public bool IsNil {
+ get { return xsinfo.IsNil; }
+ }
+
+ public XmlSchemaSimpleType MemberType {
+ get { return xsinfo.MemberType; }
+ }
+
+ public XmlSchemaAttribute SchemaAttribute {
+ get { return xsinfo.SchemaAttribute; }
+ }
+
+ public XmlSchemaElement SchemaElement {
+ get { return xsinfo.SchemaElement; }
+ }
+
+ public XmlSchemaValidity Validity {
+ get { return xsinfo.Validity; }
+ }
+
+ #endregion
}
}
Modified: tags/mono-1-1-13/mcs/class/System.XML/System.Xml/ChangeLog
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml/ChangeLog 2006-01-13
03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml/ChangeLog 2006-01-13
03:47:20 UTC (rev 55476)
@@ -1,3 +1,28 @@
+2006-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlTextWriter.cs : Do not local duplicate of automatically-created
+ prefixes (i.e. check local autocreated prefixes other than
+ namespaces from ancestors). Fixed bug #77086 and #77087.
+
+2006-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlWriter.cs : use XmlChar.IsNmToken() to check argument and throw
+ ArgumentException in WriteNmTokenInternal().
+
+2006-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlTextWriter.cs : Fixed bug #77094. Only XmlTextWriter checks
+ such invalid "xml" prefix which is being mapped to different
+ namespace URI than the predefined one.
+ Removed comment that does not make sense.
+ * XmlNamespaceManager.cs : IsValidDeclaration() could be private.
+ Added some comments.
+
+2006-01-11 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * DTDObjectModel.cs : dtd2xsd fix; set use="optional" when an
+ attribute is #IMPLIED.
+
2006-01-06 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlWriter.cs : In WriteNode(XPathNavigator, bool), Avoid
Modified: tags/mono-1-1-13/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -833,6 +833,8 @@
SetLineInfo (a);
a.Name = Name;
a.DefaultValue = resolvedNormalizedDefaultValue;
+ if (OccurenceType != DTDAttributeOccurenceType.Required)
+ a.Use = XmlSchemaUse.Optional;
XmlQualifiedName qname = XmlQualifiedName.Empty;
ArrayList enumeration = null;
Modified:
tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -170,9 +170,11 @@
decls [declPos].Uri = uri;
}
- internal static string IsValidDeclaration (string prefix,
string uri, bool throwException)
+ static string IsValidDeclaration (string prefix, string uri,
bool throwException)
{
string message = null;
+ // It is funky, but it does not check whether prefix
+ // is equivalent to "xml" in case-insensitive means.
if (prefix == PrefixXml && uri != XmlnsXml)
message = String.Format ("Prefix \"xml\" can
only be bound to the fixed namespace URI \"{0}\". \"{1}\" is invalid.",
XmlnsXml, uri);
else if (message == null && prefix == "xmlns")
Modified: tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -752,8 +752,6 @@
public override void WriteStartAttribute (string prefix, string
localName, string ns)
{
if (prefix == "xml") {
- // MS.NET looks to allow other names than
- // lang and space (e.g. xml:link, xml:hack).
ns = XmlNamespaceManager.XmlnsXml;
if (localName == "lang")
openXmlLang = true;
@@ -799,7 +797,7 @@
string formatPrefix = "";
if (ns != String.Empty && prefix != "xmlns") {
- string existingPrefix =
namespaceManager.LookupPrefix (ns, false);
+ string existingPrefix = GetExistingPrefix (ns);
if (existingPrefix == null || existingPrefix ==
"") {
bool createPrefix = false;
@@ -854,6 +852,15 @@
}
}
+ string GetExistingPrefix (string ns)
+ {
+ if (newAttributeNamespaces.ContainsValue (ns))
+ foreach (DictionaryEntry de in
newAttributeNamespaces)
+ if (de.Value as string == ns)
+ return (string) de.Key;
+ return namespaceManager.LookupPrefix (ns, false);
+ }
+
private string CheckNewPrefix (bool createPrefix, string
prefix, string ns)
{
do {
@@ -916,6 +923,14 @@
if ((prefix != null && prefix.Length > 0) && ((ns ==
null)))
throw ArgumentError ("Cannot use a prefix with
an empty namespace.");
+ // Considering the fact that WriteStartAttribute()
+ // automatically changes argument namespaceURI, this
+ // is kind of silly implementation. See bug #77094.
+ if (Namespaces &&
+ ns != XmlNamespaceManager.XmlnsXml &&
+ String.Compare (prefix, "xml", true) == 0)
+ throw new ArgumentException ("A prefix cannot
be equivalent to \"xml\" in case-insensitive match.");
+
// ignore non-namespaced node's prefix.
if (ns == null || ns == String.Empty)
prefix = String.Empty;
Modified: tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlWriter.cs
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlWriter.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlWriter.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -360,16 +360,19 @@
internal virtual void WriteNmTokenInternal (string name)
{
+ bool valid = true;
#if NET_2_0
switch (Settings.ConformanceLevel) {
case ConformanceLevel.Document:
case ConformanceLevel.Fragment:
- XmlConvert.VerifyNMTOKEN (name);
- break;
+ valid = XmlChar.IsNmToken (name);
+ break;
}
#else
- XmlConvert.VerifyNMTOKEN (name);
+ valid = XmlChar.IsNmToken (name);
#endif
+ if (!valid)
+ throw new ArgumentException ("Argument name is
not a valid NMTOKEN.");
WriteString (name);
}
Modified: tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/ChangeLog
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/ChangeLog
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/ChangeLog
2006-01-13 03:47:20 UTC (rev 55476)
@@ -1,3 +1,18 @@
+2006-01-11 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlSchemaAttribute.cs, XmlSchemaElement.cs : AttributeSchemaType
+ and ElementSchemaType were not working fine for anySimpleType.
+ * XmlSchemaValidator.cs : When actual schema type was complex,
+ schema types was not filled correctly. Modified some extra comments.
+ * XmlSchemaSet.cs, XmlSchemaType.cs : removed extra MonoTODOs.
+
+2006-01-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlAtomicValue.cs : it won't be implemented since there is no way
+ to test it inside sys.xml. Thus remarked MonoTODO.
+ * XmlSchemaDatatype.cs : implemented IsDerivedFrom(), which is however
+ mostly useless.
+
2006-01-06 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlSchemaSet.cs : Add() rollbacks IsCompiled to false.
Modified:
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlAtomicValue.cs
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlAtomicValue.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlAtomicValue.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -36,6 +36,7 @@
namespace System.Xml.Schema
{
+ [MonoTODO ("This class is unused and thus won't be finished.")]
public sealed class XmlAtomicValue : XPathItem, ICloneable
{
bool booleanValue;
@@ -53,7 +54,6 @@
#region Constructors
- [MonoTODO]
internal XmlAtomicValue (bool value, XmlSchemaType xmlType)
{
Init (value, xmlType);
@@ -68,7 +68,6 @@
schemaType = xmlType;
}
- [MonoTODO]
internal XmlAtomicValue (DateTime value, XmlSchemaType xmlType)
{
Init (value, xmlType);
@@ -83,7 +82,6 @@
schemaType = xmlType;
}
- [MonoTODO]
internal XmlAtomicValue (decimal value, XmlSchemaType xmlType)
{
Init (value, xmlType);
@@ -98,7 +96,6 @@
schemaType = xmlType;
}
- [MonoTODO]
internal XmlAtomicValue (double value, XmlSchemaType xmlType)
{
Init (value, xmlType);
@@ -113,7 +110,6 @@
schemaType = xmlType;
}
- [MonoTODO]
internal XmlAtomicValue (int value, XmlSchemaType xmlType)
{
Init (value, xmlType);
@@ -128,7 +124,6 @@
schemaType = xmlType;
}
- [MonoTODO]
internal XmlAtomicValue (long value, XmlSchemaType xmlType)
{
Init (value, xmlType);
@@ -143,7 +138,6 @@
schemaType = xmlType;
}
- [MonoTODO]
internal XmlAtomicValue (float value, XmlSchemaType xmlType)
{
Init (value, xmlType);
@@ -158,7 +152,6 @@
schemaType = xmlType;
}
- [MonoTODO]
internal XmlAtomicValue (string value, XmlSchemaType xmlType)
{
Init (value, xmlType);
@@ -175,7 +168,6 @@
schemaType = xmlType;
}
- [MonoTODO]
internal XmlAtomicValue (object value, XmlSchemaType xmlType)
{
Init (value, xmlType);
@@ -281,13 +273,11 @@
return this.Clone ();
}
- [MonoTODO]
public XmlAtomicValue Clone ()
{
return new XmlAtomicValue (this, schemaType);
}
- [MonoTODO]
public override object ValueAs (Type type,
IXmlNamespaceResolver nsResolver)
{
switch (XmlTypeCodeFromRuntimeType (type, false)) {
@@ -338,7 +328,6 @@
}
}
- [MonoTODO]
public override object TypedValue {
get {
switch (ResolvedTypeCode) {
@@ -360,7 +349,6 @@
}
}
- [MonoTODO]
// This method works like ValueAsString.
public override string Value {
get {
@@ -425,7 +413,6 @@
}
}
- [MonoTODO]
public override bool ValueAsBoolean {
get {
switch (xmlTypeCode) {
@@ -457,7 +444,6 @@
}
}
- [MonoTODO]
public override DateTime ValueAsDateTime {
get {
switch (xmlTypeCode) {
@@ -478,7 +464,6 @@
}
}
- [MonoTODO]
public override double ValueAsDouble {
get {
switch (xmlTypeCode) {
@@ -509,7 +494,6 @@
}
}
- [MonoTODO]
public override int ValueAsInt {
get {
switch (xmlTypeCode) {
@@ -540,7 +524,6 @@
}
}
- [MonoTODO]
public override long ValueAsLong {
get {
switch (xmlTypeCode) {
@@ -571,12 +554,10 @@
}
}
- [MonoTODO]
public override Type ValueType {
get { return schemaType.Datatype.ValueType; }
}
- [MonoTODO]
public override XmlSchemaType XmlType {
get { return schemaType; }
}
Modified:
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
===================================================================
---
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -448,9 +448,13 @@
validatedUse = Use;
#if NET_2_0
- attributeSchemaType = attributeType as
XmlSchemaSimpleType;
- if (attributeSchemaType == null)
- attributeSchemaType =
XmlSchemaType.GetBuiltInSimpleType (((XmlSchemaDatatype)
attributeType).TypeCode);
+ if (attributeType != null) {
+ attributeSchemaType = attributeType as
XmlSchemaSimpleType;
+ if (attributeType ==
XmlSchemaSimpleType.AnySimpleType)
+ attributeSchemaType =
XmlSchemaSimpleType.XsAnySimpleType;
+ if (attributeSchemaType == null)
+ attributeSchemaType =
XmlSchemaType.GetBuiltInSimpleType (SchemaTypeName);
+ }
#endif
ValidationId = schema.ValidationId;
Modified:
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
===================================================================
---
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -79,10 +79,12 @@
throw new NotImplementedException ();
}
- [MonoTODO]
public virtual bool IsDerivedFrom (XmlSchemaDatatype datatype)
{
- throw new NotImplementedException ();
+ // It is documented to return always false, but
+ // actually returns true when the argument is for
+ // the same type (and it does not check null argument).
+ return this == datatype;
}
#endif
Modified:
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -743,9 +743,13 @@
ident.Validate (h, schema);
#if NET_2_0
- elementSchemaType = elementType as XmlSchemaType;
- if (elementSchemaType == null && elementType != null)
- elementSchemaType =
XmlSchemaType.GetBuiltInType (((XmlSchemaDatatype) elementType).TypeCode);
+ if (elementType != null) {
+ elementSchemaType = elementType as
XmlSchemaType;
+ if (elementType ==
XmlSchemaSimpleType.AnySimpleType)
+ elementSchemaType =
XmlSchemaSimpleType.XsAnySimpleType;
+ if (elementSchemaType == null)
+ elementSchemaType =
XmlSchemaType.GetBuiltInSimpleType (SchemaTypeName);
+ }
#endif
ValidationId = schema.ValidationId;
Modified:
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -181,7 +181,6 @@
Add (schema);
}
- [MonoTODO ("We need to research more about the expected
behavior")]
public XmlSchema Add (XmlSchema schema)
{
schemas.Add (schema);
Modified:
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -134,7 +134,6 @@
}
#if NET_2_0
- [MonoTODO]
// LAMESPEC: for IDREFS it returns Idref. for ENTITIES
// it returns Entity. for NMTOKENS it returns NmToken.
[XmlIgnore]
Modified:
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs
===================================================================
---
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++
tags/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -181,11 +181,8 @@
set { xmlResolver = value; }
}
- [MonoTODO]
public Uri SourceUri {
get { return sourceUri; }
- // FIXME: actually there seems no setter, but then
- // it will never make sense.
set { sourceUri = value; }
}
#endregion
@@ -791,7 +788,7 @@
object parsedValue = null;
try {
parsedValue = getter ();
- } catch (Exception ex) { // FIXME: (wishlist)
It is bad manner ;-(
+ } catch (Exception ex) { // It is inevitable
and bad manner.
HandleError ("Attribute value is
invalid against its data type " + dt.TokenizedType, ex);
}
XmlSchemaType type = info != null ?
info.SchemaType : null;
@@ -937,8 +934,8 @@
if (info != null) {
info.IsNil = xsiNilDepth >= 0;
info.SchemaElement = null;
- info.SchemaType = st;
- if (st == null)
+ info.SchemaType = Context.ActualType as
XmlSchemaType;
+ if (info.SchemaType == null)
info.SchemaType =
XmlSchemaType.GetBuiltInSimpleType (dt.TypeCode);
info.SchemaAttribute = null;
info.IsDefault = false; // FIXME: might be true
@@ -981,7 +978,7 @@
if (itemDatatype != null) {
try {
retValues [vi]
= itemDatatype.ParseValue (each, nameTable, nsResolver);
- } catch (Exception ex)
{ // FIXME: (wishlist) better exception handling ;-(
+ } catch (Exception ex)
{ // It is inevitable and bad manner.
HandleError
("List type value contains one or more invalid values.", ex);
break;
}
@@ -1003,7 +1000,7 @@
if (itemDatatype !=
null) {
try {
ret =
itemDatatype.ParseValue (each, nameTable, nsResolver);
- } catch
(Exception) { // FIXME: (wishlist) better exception handling ;-(
+ } catch
(Exception) { // It is inevitable and bad manner.
continue;
}
}
@@ -1048,7 +1045,7 @@
if (validatedDatatype != null) {
try {
ret = validatedDatatype.ParseValue
(value, nameTable, nsResolver);
- } catch (Exception ex) { // FIXME:
(wishlist) It is bad manner ;-(
+ } catch (Exception ex) { // It is inevitable
and bad manner.
HandleError (String.Format ("Invalidly
typed data was specified."), ex);
}
}
@@ -1232,7 +1229,7 @@
if (dt != null) {
try {
identity =
dt.ParseValue (value, nameTable, nsResolver);
- } catch (Exception ex) { //
FIXME: (wishlist) This is bad manner ;-(
+ } catch (Exception ex) { // It
is inevitable and bad manner.
HandleError ("Identity
value is invalid against its data type " + dt.TokenizedType, ex);
}
}
@@ -1394,7 +1391,7 @@
for (int i = 0; i < tmp.Length; i += 2) {
try {
schema = ReadExternalSchema (tmp [i +
1]);
- } catch (Exception ex) { // FIXME: (wishlist)
It is bad manner ;-(
+ } catch (Exception ex) { // It is inevitable
and bad manner.
HandleError ("Could not resolve schema
location URI: " + schemaLocation, ex, true);
continue;
}
@@ -1423,7 +1420,7 @@
try {
schema = ReadExternalSchema
(noNsSchemaLocation);
- } catch (Exception ex) { // FIXME: (wishlist) It is bad
manner ;-(
+ } catch (Exception ex) { // It is inevitable and bad
manner.
HandleError ("Could not resolve schema location
URI: " + noNsSchemaLocation, ex, true);
}
if (schema != null && schema.TargetNamespace != null)
Modified: tags/mono-1-1-13/mcs/class/System.XML/System.Xml_test.dll.sources
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/System.Xml_test.dll.sources
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/System.Xml_test.dll.sources
2006-01-13 03:47:20 UTC (rev 55476)
@@ -44,9 +44,13 @@
System.Xml/nist_dom/fundamental/NamedNodeMap/NamedNodeMap.cs
System.Xml/nist_dom/fundamental/NodeList/NodeList.cs
System.Xml/nist_dom/fundamental/Text/Text.cs
+System.Xml.Schema/XmlSchemaAssertion.cs
+System.Xml.Schema/XmlSchemaBuiltInDatatypeTests.cs
+System.Xml.Schema/XmlSchemaDatatypeTests.cs
+System.Xml.Schema/XmlSchemaLengthFacetTests.cs
System.Xml.Schema/XmlSchemaTests.cs
+System.Xml.Schema/XmlSchemaTypeTests.cs
System.Xml.Schema/XmlSchemaSetTests.cs
-System.Xml.Schema/XmlSchemaLengthFacetTests.cs
System.Xml.Serialization/ComplexDataStructure.cs
System.Xml.Serialization/DeserializeTests.cs
System.Xml.Serialization/SoapAttributeAttributeTests.cs
@@ -70,8 +74,6 @@
System.Xml.Serialization/XmlSerializationWriterTests.cs
System.Xml.Serialization/XmlTextAttributeTests.cs
System.Xml.Serialization/XmlTypeAttributeTests.cs
-System.Xml.Schema/XmlSchemaAssertion.cs
-System.Xml.Schema/XmlSchemaBuiltInDatatypeTests.cs
System.Xml.Serialization/XmlSerializerTests.cs
System.Xml.Serialization/XmlSerializerTestClasses.cs
System.Xml.XPath/SelectNodesTests.cs
Modified: tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/ChangeLog
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/ChangeLog
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/ChangeLog
2006-01-13 03:47:20 UTC (rev 55476)
@@ -1,3 +1,17 @@
+2006-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlTextWriterTests.cs : Split AutoCreatePrefixes() and marked as
+ Ignore rather than NotWorking. Also it is not for bug #77086 and
+ #77077 (they were fixed). See bug #77088.
+
+2006-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlTextWriterTests.cs : re-enabled WriteNmToken_InvalidChars().
+
+2006-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlTextWriterTests.cs : re-enabled bug #77094 related tests.
+
2006-01-06 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlWriterTests.cs : added tests for WriteNode(XPathNavigator, bool)
Modified:
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -205,29 +205,26 @@
}
[Test]
- [Category ("NotWorking")] // bug #77086, #77087 and #77088
+ [Ignore ("Due to the (silly) dependency on bug #77088, this
test will not be fixed. The test could be rewritten but it depends on the
original test author.")]
public void AutoCreatePrefixes ()
{
+ xtw.WriteStartElement ("root");
xtw.WriteAttributeString (null, "abc",
"http://somenamespace.com", "http://abc.def");
xtw.WriteAttributeString (null, "def",
"http://somenamespace.com", "http://def.ghi");
xtw.WriteAttributeString (null, "ghi",
"http://othernamespace.com", "http://ghi.jkl");
+ xtw.WriteEndElement ();
-#if NET_2_0
- Assert.AreEqual ("d0p1:abc='http://abc.def'
d0p1:def='http://def.ghi'" +
- " d0p2:ghi='http://ghi.jkl'", StringWriterText,
"#1");
-#else
- // on 1.x a new prefix is always created when level is
0 ?
- Assert.AreEqual ("d0p1:abc='http://abc.def'
d0p2:def='http://def.ghi'" +
- " d0p3:ghi='http://ghi.jkl'", StringWriterText,
"#1");
-#endif
+ Assert.AreEqual ("<root d1p1:abc='http://abc.def'
d1p1:def='http://def.ghi' d1p2:ghi='http://ghi.jkl'
xmlns:d1p2='http://othernamespace.com' xmlns:d1p1='http://somenamespace.com'
/>", StringWriterText, "#1");
+ }
- sw.GetStringBuilder ().Length = 0;
- CreateXmlTextWriter ();
-
+ [Test]
+ [Ignore ("Due to the (silly) dependency on bug #77088, this
test will not be fixed. The test could be rewritten but it depends on the
original test author.")]
+ public void AutoCreatePrefixes2 ()
+ {
xtw.WriteStartElement ("person");
- xtw.WriteAttributeString (null, "name",
"http://somenamespace.com", "Gates");
- xtw.WriteAttributeString (null, "initials",
"http://othernamespace.com", "BG");
- xtw.WriteAttributeString (null, "firstName",
"http://somenamespace.com", "Bill");
+ xtw.WriteAttributeString (null, "name",
"http://somenamespace.com", "Driesen");
+ xtw.WriteAttributeString (null, "initials",
"http://othernamespace.com", "GD");
+ xtw.WriteAttributeString (null, "firstName",
"http://somenamespace.com", "Gert");
xtw.WriteStartElement ("address");
xtw.WriteAttributeString (null, "street",
"http://somenamespace.com", "Campus");
xtw.WriteAttributeString (null, "number",
"http://othernamespace.com", "1");
@@ -238,9 +235,9 @@
Assert.AreEqual (
"<person" +
- " d1p1:name='Gates'" +
- " d1p2:initials='BG'" +
- " d1p1:firstName='Bill'" +
+ " d1p1:name='Driesen'" +
+ " d1p2:initials='GD'" +
+ " d1p1:firstName='Gert'" +
"
xmlns:d1p2='http://othernamespace.com'" +
"
xmlns:d1p1='http://somenamespace.com'>" +
"<address" +
@@ -525,12 +522,8 @@
}
[Test]
- [Category ("NotWorking")]
public void WriteStartElement_XmlPrefix ()
{
- // uncomment the next code block once bug #77094 has
been fixed.
-
- /*
xtw.WriteStartElement ("xml", "something",
"http://www.w3.org/XML/1998/namespace");
Assert.AreEqual ("<xml:something", StringWriterText,
"#1");
@@ -548,7 +541,6 @@
sw.GetStringBuilder ().Length = 0;
CreateXmlTextWriter ();
- */
}
[Test]
@@ -559,7 +551,6 @@
}
[Test]
- [Category ("NotWorking")] // bug #77094
[ExpectedException (typeof (ArgumentException))]
public void WriteStartElement_XmlPrefix_Invalid2 ()
{
@@ -1536,7 +1527,6 @@
}
[Test]
- [Category ("NotWorking")] // on mono, an XmlException is thrown
instead
[ExpectedException (typeof (ArgumentException))]
public void WriteNmToken_InvalidChars ()
{
Modified: tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
2006-01-13 03:47:20 UTC (rev 55476)
@@ -1,3 +1,17 @@
+2006-01-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlSchemaTypeTests.cs : new file. Test for TypeCode.
+ * XmlSchemaSetTests.cs : added more tests for Add() and marked one as
+ NotWorking (we need info on how consistent this method is).
+
+2006-01-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlSchemaDatatypeTests.cs : oops sys.col.generic is NET_2_0.
+
+2006-01-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlSchemaDatatypeTests.cs : added test for 2.0 IsDerivedFrom().
+
2006-01-06 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlSchemaSetTests.cs : added AddRollbackIsCompiled(); Add() changes
Modified:
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
===================================================================
---
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -11,8 +11,16 @@
using System.IO;
using System.Xml;
using System.Xml.Schema;
+#if NET_2_0
+using System.Collections.Generic;
+#endif
using NUnit.Framework;
+using QName = System.Xml.XmlQualifiedName;
+using SimpleType = System.Xml.Schema.XmlSchemaSimpleType;
+using SimpleRest = System.Xml.Schema.XmlSchemaSimpleTypeRestriction;
+using AssertType = NUnit.Framework.Assert;
+
namespace MonoTests.System.Xml
{
[TestFixture]
@@ -39,6 +47,7 @@
}
[Test]
+ [Category ("NotWorking")] // ContentTypeParticle impl.
difference.
public void TestAnyType ()
{
XmlSchema schema = GetSchema
("Test/XmlFiles/xsd/datatypesTest.xsd");
@@ -71,5 +80,80 @@
// AssertDatatype (schema, 6, XmlTokenizedType.NMTOKEN,
typeof (string []), "f o o", new string [] {"f", "o", "o"});
}
+#if NET_2_0
+ string [] allTypes = new string [] {
+ "string", "boolean", "float", "double", "decimal",
+ "duration", "dateTime", "time", "date", "gYearMonth",
+ "gYear", "gMonthDay", "gDay", "gMonth", "hexBinary",
+ "base64Binary", "anyURI", "QName", "NOTATION",
+ "normalizedString", "token", "language", "IDREFS",
+ "ENTITIES", "NMTOKEN", "NMTOKENS", "Name", "NCName",
+ "ID", "IDREF", "ENTITY", "integer",
+ "nonPositiveInteger", "negativeInteger", "long",
+ "int", "short", "byte", "nonNegativeInteger",
+ "unsignedLong", "unsignedInt", "unsignedShort",
+ "unsignedByte", "positiveInteger"
+ };
+
+ XmlSchemaSet allWrappers;
+
+ void SetupSimpleTypeWrappers ()
+ {
+ XmlSchema schema = new XmlSchema ();
+ List<QName> qnames = new List<QName> ();
+ foreach (string name in allTypes) {
+ SimpleType st = new SimpleType ();
+ st.Name = "x-" + name;
+ SimpleRest r = new SimpleRest ();
+ st.Content = r;
+ QName qname = new QName (name,
XmlSchema.Namespace);
+ r.BaseTypeName = qname;
+ qnames.Add (qname);
+ schema.Items.Add (st);
+ }
+ XmlSchemaSet sset = new XmlSchemaSet ();
+ sset.Add (schema);
+ sset.Compile ();
+ allWrappers = sset;
+ }
+
+ XmlSchemaDatatype GetDatatype (string name)
+ {
+ return (allWrappers.GlobalTypes [new QName ("x-" + name,
+ String.Empty)] as SimpleType).Datatype;
+ }
+
+ string [] GetDerived (string target)
+ {
+ XmlSchemaDatatype strType = GetDatatype (target);
+ List<string> results = new List<string> ();
+ foreach (string name in allTypes) {
+ if (name == target)
+ continue;
+ XmlSchemaDatatype deriv = GetDatatype (name);
+ if (deriv.IsDerivedFrom (strType))
+ results.Add (name);
+ else Console.Error.WriteLine (deriv.GetType ()
+ " is not derived from " + strType.GetType ());
+ }
+ return results.ToArray ();
+ }
+
+ [Test]
+ public void IsDerivedFrom ()
+ {
+ SetupSimpleTypeWrappers ();
+
+ // Funky, but XmlSchemaDatatype.IsDerivedFrom() is
+ // documented to always return false, but actually
+ // matches the same type - which could be guessed that
+ // this method is used only to detect user-defined
+ // simpleType derivation.
+ foreach (string b in allTypes)
+ foreach (string d in allTypes)
+ AssertType.AreEqual (b == d,
GetDatatype (d).IsDerivedFrom (GetDatatype (b)), b);
+
+ AssertType.IsFalse (GetDatatype
("string").IsDerivedFrom (null), "null arg");
+ }
+#endif
}
}
Modified:
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
===================================================================
---
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -56,9 +56,22 @@
}
[Test]
- [Ignore ("This behavior might be changed, since Add(XmlSchema)
does not throw any exceptions, while this does.")]
+ public void AddSchemaThenReader ()
+ {
+ XmlSchemaSet ss = new XmlSchemaSet ();
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema' />");
+ XmlSchema xs = new XmlSchema ();
+ xs.TargetNamespace = "ab";
+ ss.Add (xs);
+ ss.Add ("ab", new XmlNodeReader (doc));
+ }
+
+ [Test]
+ [Category ("NotWorking")] // How can we differentiate this
+ // case and the testcase above?
[ExpectedException (typeof (ArgumentException))]
- public void AddTwice ()
+ public void AddReaderTwice ()
{
XmlSchemaSet ss = new XmlSchemaSet ();
XmlDocument doc = new XmlDocument ();
@@ -68,6 +81,16 @@
}
[Test]
+ public void AddSchemaTwice ()
+ {
+ XmlSchemaSet ss = new XmlSchemaSet ();
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:ab' />");
+ ss.Add (XmlSchema.Read (new XmlNodeReader (doc), null));
+ ss.Add (XmlSchema.Read (new XmlNodeReader (doc), null));
+ }
+
+ [Test]
public void CompilationSettings ()
{
Assert.IsNotNull (new XmlSchemaSet
().CompilationSettings);
Added:
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
===================================================================
---
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
2006-01-13 03:22:19 UTC (rev 55475)
+++
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
2006-01-13 03:47:20 UTC (rev 55476)
@@ -0,0 +1,101 @@
+//
+// System.Xml.XmlSchemaSetTests.cs
+//
+// Author:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// (C) 2004 Novell Inc.
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Xml;
+using System.Xml.Schema;
+using NUnit.Framework;
+
+using QName = System.Xml.XmlQualifiedName;
+using SimpleType = System.Xml.Schema.XmlSchemaSimpleType;
+using SimpleRest = System.Xml.Schema.XmlSchemaSimpleTypeRestriction;
+using AssertType = NUnit.Framework.Assert;
+
+namespace MonoTests.System.Xml
+{
+ [TestFixture]
+ public class XmlSchemaTypeTests
+ {
+#if NET_2_0
+ string [] all_types = new string [] {
+ "string", "boolean", "float", "double", "decimal",
+ "duration", "dateTime", "time", "date", "gYearMonth",
+ "gYear", "gMonthDay", "gDay", "gMonth", "hexBinary",
+ "base64Binary", "anyURI", "QName", "NOTATION",
+ "normalizedString", "token", "language", "IDREFS",
+ "ENTITIES", "NMTOKEN", "NMTOKENS", "Name", "NCName",
+ "ID", "IDREF", "ENTITY", "integer",
+ "nonPositiveInteger", "negativeInteger", "long",
+ "int", "short", "byte", "nonNegativeInteger",
+ "unsignedLong", "unsignedInt", "unsignedShort",
+ "unsignedByte", "positiveInteger"
+ };
+
+ XmlTypeCode [] type_codes = new XmlTypeCode [] {
+ XmlTypeCode.String,
+ XmlTypeCode.Boolean,
+ XmlTypeCode.Float,
+ XmlTypeCode.Double,
+ XmlTypeCode.Decimal,
+ XmlTypeCode.Duration,
+ XmlTypeCode.DateTime,
+ XmlTypeCode.Time,
+ XmlTypeCode.Date,
+ XmlTypeCode.GYearMonth,
+ XmlTypeCode.GYear,
+ XmlTypeCode.GMonthDay,
+ XmlTypeCode.GDay,
+ XmlTypeCode.GMonth,
+ XmlTypeCode.HexBinary,
+ XmlTypeCode.Base64Binary,
+ XmlTypeCode.AnyUri,
+ XmlTypeCode.QName,
+ XmlTypeCode.Notation,
+ XmlTypeCode.NormalizedString,
+ XmlTypeCode.Token,
+ XmlTypeCode.Language,
+ XmlTypeCode.Idref, // IDREFS (LAMESPEC)
+ XmlTypeCode.Entity, // ENTITIES (LAMESPEC)
+ XmlTypeCode.NmToken,
+ XmlTypeCode.NmToken, // NMTOKENS (LAMESPEC)
+ XmlTypeCode.Name,
+ XmlTypeCode.NCName,
+ XmlTypeCode.Id,
+ XmlTypeCode.Idref,
+ XmlTypeCode.Entity,
+ XmlTypeCode.Integer,
+ XmlTypeCode.NonPositiveInteger,
+ XmlTypeCode.NegativeInteger,
+ XmlTypeCode.Long,
+ XmlTypeCode.Int,
+ XmlTypeCode.Short,
+ XmlTypeCode.Byte,
+ XmlTypeCode.NonNegativeInteger,
+ XmlTypeCode.UnsignedLong,
+ XmlTypeCode.UnsignedInt,
+ XmlTypeCode.UnsignedShort,
+ XmlTypeCode.UnsignedByte,
+ XmlTypeCode.PositiveInteger};
+
+ [Test]
+ public void TypeCode ()
+ {
+ for (int i = 0; i < all_types.Length; i++) {
+ string name = all_types [i];
+ QName qname = new QName (name,
XmlSchema.Namespace);
+ Assert.AreEqual (type_codes [i],
+ XmlSchemaType.GetBuiltInSimpleType
(qname).TypeCode, name);
+ }
+ }
+
+#endif
+ }
+}
Property changes on:
tags/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: tags/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
2006-01-13 03:47:20 UTC (rev 55476)
@@ -1,3 +1,7 @@
+2006-01-11 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * datatypesTest.xsd : missing required file for xsd tests.
+
2005-12-26 Atsushi Enomoto <[EMAIL PROTECTED]>
* multi-schemaLocation.xml,
Added: tags/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
===================================================================
--- tags/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
2006-01-13 03:22:19 UTC (rev 55475)
+++ tags/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
2006-01-13 03:47:20 UTC (rev 55476)
@@ -0,0 +1,11 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns="urn:bar" targetNamespace="urn:bar">
+ <xs:element name="e00">
+ <xs:complexType>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="e4" type="xs:string" />
+ <xs:element name="e1" type="xs:normalizedString" />
+ <xs:element name="e2" type="xs:token" />
+ <xs:element name="e3" type="xs:language" />
+</xs:schema>
Property changes on:
tags/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches