Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2006-01-11 16:21:19 +0300
committerAtsushi Eno <atsushieno@gmail.com>2006-01-11 16:21:19 +0300
commit68c182e20c5f648eded0c27b0b39fef28b336ac8 (patch)
treee0a8352282b19b011d9c44515a2a725ef92bdc29 /mcs/class/System.XML/Mono.Xml.Schema
parentb37f80669ce64900ac7d57edd921d05d96e3a9d7 (diff)
2006-01-11 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchemaValidatingReader.cs : removed unused constructors. Now it implements IXmlSchemaInfo. Use XmlSchemaType instead of Object to represent schema types. * 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. svn path=/trunk/mcs/; revision=55371
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.Schema')
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/ChangeLog6
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs118
2 files changed, 42 insertions, 82 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog b/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
index 5bda8228106..a7074156a40 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
@@ -1,3 +1,9 @@
+2006-01-11 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaValidatingReader.cs : removed unused constructors.
+ Now it implements IXmlSchemaInfo. Use XmlSchemaType instead of
+ Object to represent schema types.
+
2006-01-06 Atsushi Enomoto <atsushi@ximian.com>
* XsdValidatingReader.cs :
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs b/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
index 42d2c23cca5..d887625f9ad 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
+++ b/mcs/class/System.XML/Mono.Xml.Schema/XmlSchemaValidatingReader.cs
@@ -76,7 +76,8 @@ using ValException = System.Xml.Schema.XmlSchemaValidationException;
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 @@ namespace Mono.Xml.Schema
IXmlLineInfo readerLineInfo;
ValidationType validationType;
IXmlNamespaceResolver nsResolver;
-// IHasXmlSchemaInfo sourceReaderSchemaInfo;
int startDepth;
StringBuilder tmpBuilder = new StringBuilder ();
@@ -100,48 +100,14 @@ namespace Mono.Xml.Schema
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 @@ namespace Mono.Xml.Schema
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 @@ namespace Mono.Xml.Schema
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 @@ namespace Mono.Xml.Schema
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 @@ namespace Mono.Xml.Schema
}
public override IXmlSchemaInfo SchemaInfo {
- get { return xsinfo; }
+ get { return this; }
}
public override string Value {
@@ -855,6 +785,30 @@ namespace Mono.Xml.Schema
}
#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
}
}