本文整理汇总了C#中System.Xml.XmlDocument.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDocument.GetType方法的具体用法?C# XmlDocument.GetType怎么用?C# XmlDocument.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDocument
的用法示例。
在下文中一共展示了XmlDocument.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnsupportedOutput
public void UnsupportedOutput ()
{
XmlDocument doc = new XmlDocument();
object o = transform.GetOutput (doc.GetType ());
}
示例2: bestEffortAdopt
/*
****************************************************************************
* bestEffortAdopt()
****************************************************************************
*/
/**
* Attempts to adopt the node into the document
*/
public static void bestEffortAdopt(XmlDocument oDoc, Node oNode)
{
// do nothing if there is nothing to do
if (
(oDoc == null) || (oNode == null) ||
(oNode.getOwnerDocument() == oDoc))
{
return;
}
// if we are using DOM3, use the adoptNode API
if (hasDOM3Support())
{
// oDoc.adoptNode(oNode);
try {
oDoc.GetType().getMethod("adoptNode", new Class[] { oNode.GetType() })
.invoke(oDoc, new Object[] { oNode });
}
catch (IllegalArgumentException e) { }
catch (SecurityException e) { }
catch (IllegalAccessException e) { }
catch (InvocationTargetException e) { }
catch (NoSuchMethodException e) { }
return;
}
// if it is an XmlDocument, steal its adoption
if (isXercesDocument(oDoc))
{
((XmlDocument) oDoc).adoptNode(oNode);
return;
}
// otherwise just import and live with the copying
oDoc.importNode(oNode, true);
}
示例3: ExceptionVerifier
public ExceptionVerifier(string assemblyName, ExceptionVerificationFlags flags, ITestOutputHelper output)
{
_output = output;
if (assemblyName == null)
throw new VerifyException("Assembly name cannot be null");
_verificationFlags = flags;
try
{
switch (assemblyName.ToUpper())
{
case "SYSTEM.XML":
{
var dom = new XmlDocument();
_asm = dom.GetType().GetTypeInfo().Assembly;
}
break;
//case "SYSTEM.DATA":
//{
// var ds = new DataSet();
// asm = ds.GetType().Assembly;
//}
// break;
default:
throw new FileLoadException("Cannot load assembly from " + GetRuntimeInstallDir() + assemblyName + ".dll");
//asm = Assembly.LoadFrom(GetRuntimeInstallDir() + assemblyName + ".dll");
//break;
}
if (_asm == null)
throw new VerifyException("Can not load assembly " + assemblyName);
// let's determine if this is a loc run, if it is then we need to load satellite assembly
_locAsm = null;
if (!CultureInfo.CurrentCulture.Equals(new CultureInfo("en-US")) && !CultureInfo.CurrentCulture.Equals(new CultureInfo("en")))
{
try
{
throw new NotImplementedException("Cannot Load Satellite assembly");
// load satellite assembly
//locAsm = asm.GetSatelliteAssembly(new CultureInfo(CultureInfo.CurrentCulture.Parent.IetfLanguageTag));
}
catch (FileNotFoundException e1)
{
_output.WriteLine(e1.ToString());
}
catch (FileLoadException e2)
{
_output.WriteLine(e2.ToString());
}
}
}
catch (Exception e)
{
_output.WriteLine("Exception: " + e.Message);
_output.WriteLine("Stack: " + e.StackTrace);
throw new VerifyException("Error while loading assembly");
}
string[] resArray;
Stream resStream = null;
var bFound = false;
// Check that assembly manifest has resources
if (null != _locAsm)
resArray = _locAsm.GetManifestResourceNames();
else
resArray = _asm.GetManifestResourceNames();
foreach (var s in resArray)
{
if (s.EndsWith(".resources"))
{
resStream = null != _locAsm ? _locAsm.GetManifestResourceStream(s) : _asm.GetManifestResourceStream(s);
bFound = true;
if (bFound && resStream != null)
{
// Populate hashtable from resources
var resReader = new ResourceReader(resStream);
if (_resources == null)
{
_resources = new Hashtable();
}
var ide = resReader.GetEnumerator();
while (ide.MoveNext())
{
if (!_resources.ContainsKey(ide.Key.ToString()))
_resources.Add(ide.Key.ToString(), ide.Value.ToString());
}
resReader.Dispose();
}
//break;
}
}
if (!bFound || resStream == null)
throw new VerifyException("GetManifestResourceStream() failed");
}
示例4: isXercesDocument
/*
****************************************************************************
* isXercesDocument()
****************************************************************************
*/
/**
* Returns true if specified XmlDocument is backed by Xerces
*/
public static bool isXercesDocument(XmlDocument oDoc)
{
return oDoc.GetType().Name.startsWith("org.apache.xerces.dom");
}