Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
Accessibility/IAccessible.cs
Accessibility/IAccessibleHandler.cs
Assembly/AssemblyInfo.cs
../../build/common/Consts.cs

View File

@@ -0,0 +1,56 @@
//
// IAccessible.cs: Interface for accessible elements
//
// What a horrible interface.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace Accessibility {
public interface IAccessible {
void accDoDefaultAction (object childID);
object accHitTest (int xLeft, int yTop);
void accLocation (out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, object childID);
object accNavigate(int navDir, object childID);
void accSelect(int flagsSelect, object childID);
object get_accChild(object childID);
string get_accDefaultAction(object childID);
string get_accDescription(object childID);
string get_accHelp(object childID);
int get_accHelpTopic(out string pszHelpFile,object childID);
string get_accKeyboardShortcut(object childID);
string get_accName(object childID);
object get_accRole(object childID);
object get_accState(object childID);
string get_accValue(object childID);
void set_accName(object childID, string newName);
void set_accValue(object childID, string newValue);
int accChildCount { get; }
object accFocus { get; }
object accParent { get;}
object accSelection { get; }
}
}

View File

@@ -0,0 +1,24 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
interface IAccessibleHandler {
// Opaque for now.
}

View File

@@ -0,0 +1,68 @@
//
// AssemblyInfo.cs
//
// Author:
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Ximian, Inc. http://www.ximian.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Resources;
using System.Security;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about the system assembly
[assembly: AssemblyTitle ("Accessibility.dll")]
[assembly: AssemblyDescription ("Accessibility.dll")]
[assembly: AssemblyDefaultAlias ("Accessibility.dll")]
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: SatelliteContractVersion (Consts.FxVersion)]
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
[assembly: CLSCompliant (true)]
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: ComVisible (true)]
[assembly: Guid ("1ea4dbf0-3c3b-11cf-810c-00aa00389b71")]
[assembly: AllowPartiallyTrustedCallers]
#if !TARGET_JVM
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../msfinal.pub")]
#endif
[assembly: ImportedFromTypeLib ("Accessibility")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: TypeLibVersion (1, 1)]
[assembly: RuntimeCompatibility (WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]

View File

@@ -0,0 +1,8 @@
2008-04-15 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* AssemblyInfo.cs: Added missing attributes
2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* AssemblyInfo.cs: Added
* ChangeLog: Added

View File

@@ -0,0 +1,8 @@
2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* Accessibility.dll.sources:
* list.unix: AssemblyInfo.cs added
2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
* updated .build file to correctly build with Nant

View File

@@ -0,0 +1,9 @@
thisdir = class/Accessibility
SUBDIRS =
include ../../build/rules.make
LIBRARY = Accessibility.dll
LIB_MCS_FLAGS = /r:$(corlib)
NO_TEST = yes
include ../../build/library.make

824
mcs/class/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
//
// AssemblyInfo.cs
//
// Author:
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Ximian, Inc. http://www.ximian.com
// (C) 2004 Novell (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion (Consts.FxVersion)]
//[assembly: AssemblyTitle ("")]
[assembly: AssemblyDescription ("Commons.Xml.Relaxng.dll")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyFileVersion ("0.0.0.1")]
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../mono.pub")]

View File

@@ -0,0 +1,9 @@
2005-02-06 Atsushi Enomoto <atsushi@ximian.com>
* AssemblyInfo.cs : minimum information.
2004-04-30 Sebastien Pouliot <sebastien@ximian.com>
* AssemblyInfo.cs: Added
* ChangeLog: Added
* Locale.cs: Added

View File

@@ -0,0 +1,112 @@
2009-01-20 Atsushi Enomoto <atsushi@ximian.com>
* Commons.Xml.Relaxng_test.dll.sources : forgot to add
RelaxngDatatypeProviderTests.cs.
2008-11-11 Atsushi Enomoto <atsushi@ximian.com>
* Makefile: what a messy EXTRA_DISTFILES.
2007-04-18 Atsushi Enomoto <atsushi@ximian.com>
* Makefile (EXTRA_DISTFILES) :
added schemas-xmlsoap-or-ws-2005-05-identity.rnc
2006-06-15 Raja R Harinath <rharinath@novell.com>
* Makefile (EXTRA_DISTFILES): Add Test/XmlFiles/nvdl.rng.
2006-04-11 Atsushi Enomoto <atsushi@ximian.com>
* Commons.Xml.Relaxng_test.dll.sources :
added NvdlValidatingReaderTests.cs.
* README: some updates.
2005-12-28 Atsushi Enomoto <atsushi@ximian.com>
* README : updated the status.
2005-03-28 Atsushi Enomoto <atsushi@ximian.com>
* Commons.Xml.Relaxnf.dll.sources : added XmlChar.cs
2005-03-07 Atsushi Enomoto <atsushi@ximian.com>
* README :
more description.
2005-03-06 Atsushi Enomoto <atsushi@ximian.com>
* Commons.Xml.Relaxng.dll.sources : added NvdlFilteredXmlReader.
2005-03-01 Atsushi Enomoto <atsushi@ximian.com>
* Commons.Xml.Relaxng.dll.sources : added NVDL support files.
* README : added halfbaked description.
2005-01-26 Atsushi Enomoto <atsushi@ximian.com>
* Commons.Xml.Relaxng.dll.sources :
added RncWriter.cs and RelaxngInference.cs.
2004-12-06 Raja R Harinath <rharinath@novell.com>
* Makefile (RESOURCE_FILES): List only filenames.
(LIB_MCS_FLAGS): Strip off directory of resource files to get
resource names.
(EXTRA_DISTFILES): Add $(RESOURCE_FILES).
(BUILT_SOURCES): Add Common.Xml.Relaxng.Rnc/RncParser.cs.
($(the_lib)): Depend on resource files too.
* Common.Xml.Relaxng.dll.sources: Remove RncParser.cs.
2004-12-06 Atsushi Enomoto <atsushi@ximian.com>
* Makefile : added relaxng.rng as a resource.
2004-11-25 Raja R Harinath <rharinath@novell.com>
* Makefile (Commons.Xml.Relaxng.Rnc/RncParser.cs): Depend on jay/skeleton.cs.
2004-11-04 Raja R Harinath <rharinath@novell.com>
* Makefile (EXTRA_DISTFILES): Fix for 'make dist'.
2004-03-18 Atsushi Enomoto <atsushi@ximian.com>
* Makefile : It was incorrect fix, and more fix on command line.
2004-03-18 Atsushi Enomoto <atsushi@ximian.com>
* Makefile : path to jay should be supplied.
2004-03-17 Atsushi Enomoto <atsushi@ximian.com>
* Commons.Xml.Relaxng.dll.sources : Added RncParser.cs and RncTokenizer.cs.
* Commons.Xml.Relaxng_test.dll.sources : Added RncTests.cs.
* Makefile : Added RncParser.jay build support.
* README : updated.
2004-03-01 Atsushi Enomoto <atsushi@ximian.com>
* README : added usage descriptions.
2004-02-28 Atsushi Enomoto <atsushi@ximian.com>
* Commons.Xml.Relaxng_test.dll.sources : Added XsdDatatypeTests.cs
2004-02-25 Atsushi Enomoto <atsushi@ximian.com>
* Added README.
* Commons.Xml.Relaxng.dll.sources : added many new files.
2003-04-30 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* list.unix,
list: fixed incorrect reference to Util.cs (Misc.cs).
2003-04-29 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* Started.
* added ChangeLog, list, list.unix, makefile.gnu and
Commons.Xml.Relaxng.build.

View File

@@ -0,0 +1,204 @@
2007-12-27 Atsushi Enomoto <atsushi@ximian.com>
* NvdlRelaxngSupport.cs : pass baseUri to RncParser.
2006-04-19 Atsushi Enomoto <atsushi@ximian.com>
* NvdlFilteredXmlReader.cs :
Made placeholder element as "empty" i.e. IsEmptyElement = true.
As long as it is at placeholder state, it keeps being placeholder
empty element until DetachPlaceholder() is explicitly called. It
makes this reader simpler.
* NvdlValidator.cs : (NvdlResultInterp) for AttachPlaceHolder it does
not have to do anything other than AttachPlaceholder().
(NvdlValidateInterp) Now that placeholder becomes an empty element
it does not have to validate content anymore at DetachPlaceholder().
2006-04-19 Atsushi Enomoto <atsushi@ximian.com>
* NvdlReader.cs, NvdlFilteredXmlReader.cs :
placeHolder -> placeholder. Also reject unrecognized NVDL elements
in NvdlReader.
2006-04-19 Atsushi Enomoto <atsushi@ximian.com>
* NvdlException.cs : provide BaseURI in such case that argument
IXmlLineInfo is XmlReader.
* NvdlValidator.cs : NvdlDispatcher was incorrectly replacing
current section when an empty element appears (it kept such empty
element section).
2006-04-19 Atsushi Enomoto <atsushi@ximian.com>
* NvdlRelaxngSupport.cs : It seems that the validating grammar for
planAtt should always contain a definition for virtualElement i.e.
it is not something that NVDL validator should provide
automatically. (It makes sense since RELAX NG does not support
attribute-only grammar definition.)
* NvdlFilteredXmlReader.cs : for validating attributes, filter xmlns
attributes out.
2006-04-18 Atsushi Enomoto <atsushi@ximian.com>
* NvdlSimplified.cs, NvdlValidator.cs :
Support for revised "trigger" in FDIS was not enough. The validator
must not trigger such element that has a parent which could be
triggered (the parent does not have to be actually triggered).
Thus, introduced a new class SimpleTrigger which holds own qname
array.
2006-04-18 Atsushi Enomoto <atsushi@ximian.com>
* NvdlSimplified.cs : according to the section 6.4.10 overriden rules
should be filtered out, and rules with cancelNestedAction should be
removed *after* filtering overriden rules out.
2006-04-18 Atsushi Enomoto <atsushi@ximian.com>
* NvdlSimplified.cs, NvdlValidator.cs :
fixed several context path related bugs.
- Path steps must be trimmed.
- MatchPath() always returned false.
- nested mode in context is always ignored.
2006-04-11 Atsushi Enomoto <atsushi@ximian.com>
* NvdlRelaxngSupport.cs : without ReportDetails RELAX NG support
supplied too little information on validation error.
2006-04-11 Atsushi Enomoto <atsushi@ximian.com>
* NvdlFilteredXmlReader.cs : quick fix for r58557; it caused a big
NVDL validation breakage (nvdl.nvdl does not validate).
Removed unused and insignificant code.
* NvdlCompileContext.cs : removed unused field.
2006-04-03 Atsushi Enomoto <atsushi@ximian.com>
due to the request by Brian Rasumussen to report NVDL error details:
* NvdlFilteredXmlReader.cs : make it as IXmlLineInfo.
* NvdlValidationGenerator.cs :
(NvdlValidationProvider) made validate, schemaType and config as
publicly accessible.
(NvdlValidatorGenerator) added new HandleError() method that can
override error handling.
* NvdlValidator.cs : use it.
* NvdlException.cs : added new type NvdlInstanceValidationException
that is used to "wrap" actual validation errors to provide
NVDL script location information.
* NvdlRelaxngSupport.cs, NvdlXsdSupport.cs :
use those new HandleError() and NvdlInstanceValidationException.
2006-03-23 Atsushi Enomoto <atsushi@ximian.com>
* NvdlXsdSupport.cs : seems like "XmlReaderSettings.ValidationType =
ValidationType.Auto" does not automatically start xsd validation,
so set the property explicitly as ValidationType.Schema.
2006-03-03 Atsushi Enomoto <atsushi@ximian.com>
* NvdlXsdSupport.cs : oops, XmlSchemaValidationFlags.
2006-03-03 Atsushi Enomoto <atsushi@ximian.com>
* NvdlXsdSupport.cs : in NET_2_0 mode, use XmlReader.Create()
with validation support. Now MS.NET users can validate NVDL
that uses XSD.
2006-03-03 Atsushi Enomoto <atsushi@ximian.com>
* NvdlSimplified.cs : (SimpleRules) huh, I made silly change to
access null field.
2005-12-23 Atsushi Enomoto <atsushi@ximian.com>
* NvdlFilteredXmlReader.cs, NvdlReader.cs, NvdlStructures.cs,
NvdlSimplified.cs, NvdlValidator.cs:
Reflected the latest changes in NVDL Final Draft:
http://www.jtc1sc34.org/repository/0694.pdf
- wildcard -> wildCard
- renamed from "PlaceHolder" to "Placeholder"
- trigger/@name of NCName -> trigger/@nameList of list of NCName
2005-09-30 Atsushi Enomoto <atsushi@ximian.com>
* NvdlConfig.cs : changed mime type due to the suggestion from Makoto
Murata.
2005-09-30 Atsushi Enomoto <atsushi@ximian.com>
* NvdlXsdSupport.cs : related fix to r51030; XmlSchema.Read() now does
not consume EndElement.
2005-09-25 Atsushi Enomoto <atsushi@ximian.com>
* NvdlValidationProvider.cs : GetSchemaXmlStream() should take NVDL
script's base URI into account to compute the actual schema URI.
* NvdlRelaxngSupport.cs : ditto.
2005-09-11 Atsushi Enomoto <atsushi@ximian.com>
* NvdlCompileContext.cs : make this internal.
* NvdlStructures.cs : surpress default constructor.
Make debug stuff internal.
2005-04-11 Atsushi Enomoto <atsushi@ximian.com>
* NvdlRelaxngSupport.cs : added PlanAtt validation support.
2005-04-06 Atsushi Enomoto <atsushi@ximian.com>
* NvdlValidator.cs : fixed warning.
2005-03-07 Atsushi Enomoto <atsushi@ximian.com>
* NvdlFilteredXmlReader.cs, NvdlStructures.cs, NvdlSimplified.cs :
"PlaceHolderNamespace" is not proper name (for "virtualElement").
2005-03-07 Atsushi Enomoto <atsushi@ximian.com>
* NvdlBuiltInValidationProvider.cs :
When it is "allow", it should not always return false.
* NvdlFilteredXmlReader.cs :
Added support for PlanAtt validation.
* NvdlConfig.cs :
Removed unused code.
* NvdlSimplified.cs :
Attribute default rule is "attach", not "allow". Removed unused
code. Added attribute validation support.
* NvdlValidationProvider.cs :
Extended MIME type check to "*/*-xml" (not only text/xml).
Added CreateAttributeValidator() method for "schema rewriting for
attribute sections" support (FCD spec 8.7.3).
2005-03-06 Atsushi Enomoto <atsushi@ximian.com>
* NvdlFilteredXmlReader.cs : code refactory.
* NvdlCompileContext.cs, NvdlConfig.cs, NvdlSimplified.cs,
NvdlValidatingReader.cs : Simplified objects are now all internal.
* NvdlValidator.cs : don't output debug.
2005-03-06 Atsushi Enomoto <atsushi@ximian.com>
* NvdlFilteredXmlReader.cs : New file. Supports createPlaceHolder()
and attBubble[I].
* NvdlValidator.cs : support for attachPlaceHolder.
* NvdlSimplified.cs,
NvdlStructures.cs,
NvdlBuiltInValidationProvider.cs : renamed namespace const.
* NvdlValidationProvider.cs : removed extraneous debug.
2005-03-01 Atsushi Enomoto <atsushi@ximian.com>
* NvdlStructures.cs,
NvdlSimplified.cs,
NvdlReader.cs,
NvdlValidatingReader.cs,
NvdlConfig.cs,
NvdlValidationProvider.cs,
NvdlBuiltInValidationProvider.cs,
NvdlRelaxngSupport.cs,
NvdlXsdSupport.cs,
NvdlException.cs,
NvdlValidator.cs,
NvdlCompileContext.cs : initial checkin.

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Xml;
using Commons.Xml;
namespace Commons.Xml.Nvdl
{
public class NvdlBuiltInValidationProvider : NvdlValidationProvider
{
public NvdlBuiltInValidationProvider ()
{
}
public override NvdlValidatorGenerator CreateGenerator (
XmlReader reader, NvdlConfig config)
{
reader.MoveToContent ();
if (reader.NodeType != XmlNodeType.Element ||
reader.NamespaceURI != Nvdl.BuiltInValidationNamespace)
return null;
return new NvdlBuiltInValidatorGenerator (reader.LocalName == "allow");
}
}
internal class NvdlBuiltInValidatorGenerator : NvdlValidatorGenerator
{
bool allow;
public NvdlBuiltInValidatorGenerator (bool allow)
{
this.allow = allow;
}
public override XmlReader CreateValidator (XmlReader reader, XmlResolver resolver)
{
return new NvdlBuiltInValidationReader (reader, allow);
}
public override bool AddOption (string name, string arg)
{
return false;
}
}
internal class NvdlBuiltInValidationReader : XmlDefaultReader
{
bool allow;
public NvdlBuiltInValidationReader (XmlReader reader, bool allow)
: base (reader)
{
this.allow = allow;
}
public override bool Read ()
{
if (!Reader.Read ())
return false;
if (!allow)
throw new NvdlValidationException (String.Format ("The NVDL script does not allow an element whose namespace is '{0}'", Reader.NamespaceURI), Reader as IXmlLineInfo);
return true;
}
}
}

View File

@@ -0,0 +1,112 @@
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Xml;
using Commons.Xml;
namespace Commons.Xml.Nvdl
{
internal class NvdlCompileContext
{
NvdlRules rules;
NvdlConfig config;
XmlResolver resolver;
Hashtable compiledModes = new Hashtable ();
Hashtable modeContexts = new Hashtable ();
Hashtable cancelledRules = new Hashtable ();
Hashtable ruleContexts = new Hashtable ();
public NvdlCompileContext (NvdlRules rules, NvdlConfig config, XmlResolver resolver)
{
this.rules = rules;
this.config = config;
this.resolver = resolver;
}
public NvdlRules Rules {
get { return rules; }
}
public NvdlConfig Config {
get { return config; }
}
internal XmlResolver XmlResolver {
get { return resolver; }
}
internal void AddCompiledMode (string name, SimpleMode m)
{
compiledModes.Add (m.Name, m);
}
internal void AddCompiledMode (NvdlModeUsage u, SimpleMode m)
{
compiledModes.Add (u, m);
}
internal void AddCompiledMode (NvdlContext c, SimpleMode m)
{
compiledModes.Add (c, m);
}
internal SimpleMode GetCompiledMode (string name)
{
return compiledModes [name] as SimpleMode;
}
internal SimpleMode GetCompiledMode (NvdlModeUsage u)
{
return compiledModes [u] as SimpleMode;
}
internal SimpleMode GetCompiledMode (NvdlContext c)
{
return compiledModes [c] as SimpleMode;
}
internal ICollection GetCompiledModes ()
{
return compiledModes.Values;
}
internal NvdlModeCompileContext GetModeContext (SimpleMode m)
{
return modeContexts [m] as NvdlModeCompileContext;
}
internal void AddModeContext (SimpleMode m,
NvdlModeCompileContext mctx)
{
modeContexts.Add (m, mctx);
}
internal NvdlRule GetRuleContext (SimpleRule r)
{
return ruleContexts [r] as NvdlRule;
}
internal void AddRuleContext (SimpleRule r, NvdlRule rctx)
{
ruleContexts.Add (r, rctx);
}
public Hashtable CancelledRules {
get { return cancelledRules; }
}
}
internal class NvdlModeCompileContext
{
ArrayList included;
public NvdlModeCompileContext (NvdlModeBase mode)
{
included = new ArrayList ();
}
public ArrayList Included {
get { return included; }
}
}
}

View File

@@ -0,0 +1,52 @@
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Xml;
using Commons.Xml;
namespace Commons.Xml.Nvdl
{
public class NvdlConfig
{
XmlResolver resolver = new XmlUrlResolver ();
ArrayList providers = new ArrayList ();
public NvdlConfig ()
{
providers.Add (new NvdlBuiltInValidationProvider ());
}
public void AddProvider (NvdlValidationProvider provider)
{
providers.Add (provider);
}
internal XmlResolver XmlResolverInternal {
get { return resolver; }
}
public XmlResolver XmlResolver {
set { resolver = value; }
}
public NvdlValidatorGenerator GetGenerator (NvdlValidate validate, string inheritSchemaType)
{
this.resolver = this.XmlResolverInternal;
string schemaType = validate.SchemaType;
if (schemaType == null)
schemaType = inheritSchemaType;
if (schemaType == null)
schemaType = "application/xml";
foreach (NvdlValidationProvider p in providers) {
NvdlValidatorGenerator g =
p.CreateGenerator (validate, schemaType, this);
if (g != null)
return g;
}
throw new NvdlCompileException (String.Format ("Either schema type '{0}' or the target schema document is not supported in this configuration. Add custom provider that supports this schema type.", schemaType), validate);
}
}
}

View File

@@ -0,0 +1,92 @@
using System;
using System.Xml;
namespace Commons.Xml.Nvdl
{
public class NvdlException : Exception
{
public NvdlException (string message)
: base (message)
{
}
public NvdlException (string message, Exception inner)
: base (message ,inner)
{
}
internal static string FormatMessage (string message,
IXmlLineInfo lineInfo)
{
NvdlElementBase source = lineInfo as NvdlElementBase;
XmlReader reader = lineInfo as XmlReader;
if (source != null && source.HasLineInfo ())
return String.Format ("{0}. {1} ({2},{3})",
message, source.SourceUri,
source.LineNumber, source.LinePosition);
else if (lineInfo != null && lineInfo.HasLineInfo ())
return String.Format ("{0}. {3}({1},{2})",
message,
lineInfo.LineNumber,
lineInfo.LinePosition,
reader != null ? reader.BaseURI + ' ' : String.Empty);
else
return message;
}
}
public class NvdlCompileException : NvdlException
{
public NvdlCompileException (string message,
IXmlLineInfo source)
: this (message, null, source)
{
}
public NvdlCompileException (string message, Exception inner,
IXmlLineInfo source)
: base (FormatMessage (message, source), inner)
{
}
}
public class NvdlValidationException : NvdlException
{
public NvdlValidationException (string message,
IXmlLineInfo source)
: this (message, null, source)
{
}
public NvdlValidationException (string message, Exception inner,
IXmlLineInfo source)
: base (FormatMessage (message, source), inner)
{
}
}
public class NvdlInstanceValidationException : NvdlException
{
public NvdlInstanceValidationException (string message,
NvdlValidatorGenerator generator,
string nvdlLocation)
: this (message, null, generator, nvdlLocation)
{
}
public NvdlInstanceValidationException (string message, Exception inner,
NvdlValidatorGenerator generator,
string nvdlLocation)
: base (FormatMessageWithDefinition (message, nvdlLocation), inner)
{
}
// assuming that wrapped exception message usually
// contains the actual instance location info.
static string FormatMessageWithDefinition (string message, string nvdlLocation)
{
return String.Format ("{0}. Related NVDL script: {1}", message, nvdlLocation);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,95 @@
using System;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
using System.Xml;
using Commons.Xml.Relaxng;
using Commons.Xml.Relaxng.Rnc;
namespace Commons.Xml.Nvdl
{
public class NvdlRelaxngValidatorProvider : NvdlValidationProvider
{
public const string RncMimeType = "application/vnd.oasis-open.relax-ng.rnc";
public override NvdlValidatorGenerator CreateGenerator (
NvdlValidate validate, string schemaType, NvdlConfig config)
{
if (schemaType == RncMimeType)
return CreateRncGenerator (validate, config);
return base.CreateGenerator (validate, schemaType, config);
}
private NvdlValidatorGenerator CreateRncGenerator (NvdlValidate validate, NvdlConfig config)
{
XmlResolver resolver = config.XmlResolverInternal;
string schemaUri = GetSchemaUri (validate);
if (schemaUri == null)
return null;
Uri baseUri = resolver.ResolveUri (null, validate.SourceUri);
Uri absUri = resolver.ResolveUri (baseUri, schemaUri);
RelaxngPattern p = RncParser.ParseRnc (
new StreamReader ((Stream) resolver.GetEntity (
absUri,
null,
typeof (Stream))), null, absUri.ToString ());
return new NvdlRelaxngValidatorGenerator (p, config);
}
public override NvdlValidatorGenerator CreateGenerator (
XmlReader reader, NvdlConfig config)
{
if (reader.NamespaceURI != RelaxngGrammar.NamespaceURI)
return null;
return new NvdlRelaxngValidatorGenerator (RelaxngPattern.Read (reader), config);
}
}
internal class NvdlRelaxngValidatorGenerator : NvdlValidatorGenerator
{
RelaxngPattern pattern;
public NvdlRelaxngValidatorGenerator (RelaxngPattern p,
NvdlConfig config)
{
// FIXME: use XmlResolver
pattern = p;
}
public override XmlReader CreateValidator (XmlReader reader,
XmlResolver resolver)
{
// XmlResolver is never used.
RelaxngValidatingReader rvr =
new RelaxngValidatingReader (
reader, pattern);
rvr.ReportDetails = true;
return rvr;
}
public override XmlReader CreateAttributeValidator (
XmlReader reader,
XmlResolver resolver)
{
// XmlResolver is never used.
RelaxngValidatingReader rvr =
new RelaxngValidatingReader (
reader, pattern);
rvr.ReportDetails = true;
return rvr;
}
public override bool AddOption (string name, string arg)
{
return false;
}
public override bool HandleError (Exception ex, XmlReader reader, string nvdlLocation)
{
if (ex is RelaxngException)
throw new NvdlInstanceValidationException (String.Format ("RELAX NG validation error occured as a part of NVDL validation: " + ex.Message), ex, this, nvdlLocation);
return false;
}
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More