Author: atsushi
Date: 2006-01-14 22:46:54 -0500 (Sat, 14 Jan 2006)
New Revision: 55593
Added:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
branches/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
Modified:
branches/mono-1-1-13/mcs/class/System.XML/ChangeLog
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/ChangeLog
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlAtomicValue.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml/ChangeLog
branches/mono-1-1-13/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlWriter.cs
branches/mono-1-1-13/mcs/class/System.XML/System.Xml_test.dll.sources
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/ChangeLog
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
Log:
merged 55290, 55291, 55309, 55359, 55360, 55364, 55371, 55414, 55415,
55418, 55487, 55493 and 55523 from trunk.
Modified: branches/mono-1-1-13/mcs/class/System.XML/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/ChangeLog 2006-01-15 03:44:38 UTC
(rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/ChangeLog 2006-01-15 03:46:54 UTC
(rev 55593)
@@ -1,3 +1,17 @@
+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.
+
+2006-01-07 Gert Driesen <[EMAIL PROTECTED]>
+
+ * System.Xml_test.dll.sources: Added SoapSchemaExporterTests.cs,
+ SoapReflectionImporterTests.cs, XmlSchemaImporterTests.cs.
+
2005-12-28 Gert Driesen <[EMAIL PROTECTED]>
* System.Xml_test.dll.sources: Added XmlSchemaExporterTests.cs.
Modified: branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
2006-01-15 03:46:54 UTC (rev 55593)
@@ -1,3 +1,14 @@
+2006-01-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XsdValidatingReader.cs : whitespace nodes should be allowed inside
+ empty or element-only content types. Fixed bug #77241.
+
+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:
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -1603,7 +1603,8 @@
switch (ct.ContentType) {
case XmlSchemaContentType.ElementOnly:
case XmlSchemaContentType.Empty:
- HandleError ("Not allowed
character content was found.");
+ if (reader.NodeType !=
XmlNodeType.Whitespace)
+ HandleError ("Not
allowed character content was found.");
break;
}
}
Modified: branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
2006-01-15 03:46:54 UTC (rev 55593)
@@ -1,3 +1,10 @@
+2006-01-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * GenericOutputter.cs : When writing string, use WriteWhitespace()
+ instead of WhiteString() when its state is not Content. This fixes
+ BVTs_bvt066 case (broken after implementing strict state check in
+ XmlTextWriter).
+
2005-12-24 Gert Driesen <[EMAIL PROTECTED]>
* XslOutput.cs: Do not report error for unknown value for "standalone"
Modified:
branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -333,6 +333,14 @@
CheckState ();
if (_insideCData)
Emitter.WriteCDataSection (text);
+ // This weird check is required to reject Doctype
+ // after non-whitespace nodes but also to allow
+ // Doctype after whitespace nodes. It especially
+ // happens when there is an xsl:text before the
+ // document element (e.g. BVTs_bvt066 testcase).
+ else if (_state != WriteState.Content &&
+ text.Length > 0 && XmlChar.IsWhitespace (text))
+ Emitter.WriteWhitespace (text);
else
Emitter.WriteString (text);
}
Modified: branches/mono-1-1-13/mcs/class/System.XML/System.Xml/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/System.Xml/ChangeLog
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/System.Xml/ChangeLog
2006-01-15 03:46:54 UTC (rev 55593)
@@ -1,3 +1,35 @@
+2006-01-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlTextWriter.cs : Fixed bug #77082.
+ When the state was Start, after WriteProcessingInstruction() and
+ WriteWhitespace() change it to Prolog.
+ After WriteDocType() set state to WriteState.Element.
+
+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: branches/mono-1-1-13/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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: branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -518,7 +518,11 @@
if (name == null || name.Trim
(XmlChar.WhitespaceChars).Length == 0)
throw ArgumentError ("Invalid DOCTYPE name",
"name");
- if (ws == WriteState.Prolog && formatting ==
Formatting.Indented)
+ CheckState ();
+ if (ws != WriteState.Start && ws != WriteState.Prolog)
+ throw new InvalidOperationException
(String.Format ("Doctype is not allowed at '{0}' state.", ws));
+
+ if (documentStarted && formatting ==
Formatting.Indented)
w.WriteLine ();
w.Write ("<!DOCTYPE ");
@@ -546,6 +550,8 @@
}
w.Write('>');
+
+ ws = WriteState.Element;
}
public override void WriteEndAttribute ()
@@ -701,7 +707,7 @@
if ((text.IndexOf("?>") > 0))
throw ArgumentError ("Processing instruction
cannot contain \"?>\" as its value.");
- CheckState ();
+ CheckOutputState ();
CloseStartElement ();
WriteIndent ();
@@ -710,6 +716,9 @@
w.Write (' ');
w.Write (text);
w.Write ("?>");
+
+ if (ws == WriteState.Start)
+ ws = WriteState.Prolog;
}
public override void WriteQualifiedName (string localName,
string ns)
@@ -752,8 +761,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 +806,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 +861,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 +932,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;
@@ -1135,13 +1159,13 @@
w.Write (';');
}
- public override void WriteWhitespace (string ws)
+ public override void WriteWhitespace (string value)
{
- if (ws == null || ws.Length == 0) {
+ if (value == null || value.Length == 0) {
throw ArgumentError ("Only white space
characters should be used.");
}
- if (!XmlChar.IsWhitespace (ws))
+ if (!XmlChar.IsWhitespace (value))
throw ArgumentError ("Invalid Whitespace");
CheckState ();
@@ -1151,7 +1175,10 @@
CloseStartElement ();
}
- w.Write (ws);
+ w.Write (value);
+
+ if (ws == WriteState.Start)
+ ws = WriteState.Prolog;
}
private Exception ArgumentError (string message)
Modified: branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlWriter.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlWriter.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/System.Xml/XmlWriter.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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: branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/ChangeLog
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/ChangeLog
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlAtomicValue.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlAtomicValue.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlAtomicValue.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/System.Xml.Schema/XmlSchemaValidator.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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: branches/mono-1-1-13/mcs/class/System.XML/System.Xml_test.dll.sources
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/System.Xml_test.dll.sources
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/System.Xml_test.dll.sources
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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: branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/ChangeLog
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/ChangeLog
2006-01-15 03:46:54 UTC (rev 55593)
@@ -1,3 +1,25 @@
+2006-01-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XsdValidatingReaderTests.cs : test from bug #77241.
+
+2006-01-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlTextWriterTests.cs : added some tests for XMLdecl state check.
+
+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:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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 ()
{
@@ -2106,6 +2096,51 @@
NUnit.Framework.Assert.AreEqual (referent, ms.ToArray
());
}
+ [Test] // see also bug #77082
+ public void WriteDocTypeIndent ()
+ {
+ string expected = String.Format (@"<?xml
version='1.0'?>{0}<!DOCTYPE root PUBLIC '' 'urn:foo'[]>{0}<root />",
Environment.NewLine);
+ xtw.Formatting = Formatting.Indented;
+ xtw.WriteProcessingInstruction ("xml", "version='1.0'");
+ xtw.WriteDocType ("root", "", "urn:foo", "");
+ xtw.WriteStartElement ("root");
+ xtw.WriteEndElement ();
+ xtw.Close ();
+ Assert.AreEqual (expected, StringWriterText);
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void WriteDocTypeTwice ()
+ {
+ xtw.WriteDocType ("root", "", "urn:foo", "");
+ xtw.WriteDocType ("root", "", "urn:foo", "");
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void XmlDeclAfterDocType ()
+ {
+ xtw.WriteDocType ("root", "", "urn:foo", "");
+ xtw.WriteStartDocument ();
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void XmlDeclAfterWhitespace ()
+ {
+ xtw.WriteWhitespace (" ");
+ xtw.WriteStartDocument ();
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void XmlDeclAfterPI ()
+ {
+ xtw.WriteProcessingInstruction ("pi", "");
+ xtw.WriteStartDocument ();
+ }
+
#if NET_2_0
[Test]
[ExpectedException (typeof (InvalidOperationException))]
Modified:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -5,8 +5,10 @@
// Atsushi Enomoto <[EMAIL PROTECTED]>
//
// (C)2003 Atsushi Enomoto
+// (C)2005-2006 Novell, Inc.
//
using System;
+using System.IO;
using System.Xml;
using System.Xml.Schema;
using NUnit.Framework;
@@ -289,5 +291,33 @@
AssertEquals (" ", vr.ReadTypedValue ());
AssertEquals (XmlNodeType.EndElement, vr.NodeType);
}
+
+ [Test] // bug #77241
+ public void EmptyContentAllowWhitespace ()
+ {
+ string doc = @"
+<root>
+ <!-- some comment -->
+ <child/>
+</root>
+";
+ string schema = @"
+<xsd:schema xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
+ <xsd:element name=""root"">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name=""child"" type=""xsd:string"" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
+";
+ XmlValidatingReader reader = new XmlValidatingReader (
+ new XmlTextReader (new StringReader (doc)));
+ reader.Schemas.Add (null,
+ new XmlTextReader (new StringReader (schema)));
+ while (reader.Read ())
+ ;
+ }
}
}
Modified:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTypeTests.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
2006-01-15 03:44:38 UTC (rev 55592)
+++ branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
2006-01-15 03:46:54 UTC (rev 55593)
@@ -1,3 +1,11 @@
+2006-01-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XslTransformTests.cs : added DocTypeAfterText().
+
+2006-01-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XslTransformTests.cs : Output_Indent_Xml_DocType() is working now.
+
2005-12-27 Gert Driesen <[EMAIL PROTECTED]>
* XslTransformTests.cs: Extended html indentation test (and marked
Modified:
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
2006-01-15 03:46:54 UTC (rev 55593)
@@ -963,7 +963,6 @@
}
[Test]
- [Category ("NotWorking")] // bug #77082: mono does not output
newline after xml declaration
public void Output_Indent_Xml_DocType ()
{
XsltArgumentList xsltArgs = new XsltArgumentList ();
@@ -1849,5 +1848,31 @@
" <body>44.442,70</body>{0}" +
"</html>", Environment.NewLine), sw.ToString
());
}
+
+ [Test]
+ [Category ("NotDotNet")]
+ // MS bug: the output must be well-formed XML general entity
+ // (doctype must not appear after text nodes).
+ public void DocTypeAfterText ()
+ {
+ string xsl = @"
+<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+ <xsl:output doctype-system='system'/>
+ <xsl:template match='/'>
+ <xsl:text xml:space='preserve'> a </xsl:text>
+ <foo/>
+ </xsl:template>
+</xsl:stylesheet>";
+ XslTransform t = new XslTransform ();
+ t.Load (new XmlTextReader (xsl, XmlNodeType.Document,
null));
+ XmlDocument doc = new XmlDocument ();
+ try {
+ t.Transform (new XPathDocument (
+ new StringReader ("<root/>")),
+ null, TextWriter.Null);
+ Assert.Fail ("should fail; doctype is not
allowed after whitespace. See XSLT 1.0 section 16.1.");
+ } catch {
+ }
+ }
}
}
Added:
branches/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
===================================================================
---
branches/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
2006-01-15 03:44:38 UTC (rev 55592)
+++
branches/mono-1-1-13/mcs/class/System.XML/Test/XmlFiles/xsd/datatypesTest.xsd
2006-01-15 03:46:54 UTC (rev 55593)
@@ -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:
branches/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