admin 管理员组文章数量: 1086019
2024年3月10日发(作者:影视后期特效)
///
///
///
///
public static void AddElement(XmlSchemaObject sourceXsd, Hashtable titles, XmlDocument sourceXml, XmlNode sourceNd, string[] values)
{
if (e() == typeof(XmlSchemaChoice))
{
XmlSchemaChoice choice = sourceXsd as XmlSchemaChoice;
decimal min = urs;
foreach (XmlSchemaObject item in )
{
if (e() == typeof(XmlSchemaElement))
{
string name = ((XmlSchemaElement)item).Name;
if (nsKey(name))
{
XmlElement element = Element(name);
// ext = (()[rowIndex, (int)titles[name]]).ng();
ext = values[(int)titles[name]];
Child(element);
}
}
else
{
AddElement (item, titles, sourceXml, sourceNd, values);
}
}
}
else if (e() == typeof(XmlSchemaElement))
{
string name = ((XmlSchemaElement)sourceXsd).Name;
if (nsKey(name))
{
XmlElement element = Element(name);
ext = values[(int)titles[name]];
Child(element);
}
}
else if (e() == typeof(XmlSchemaSequence))
{
foreach (XmlSchemaObject childItem in ((XmlSchemaSequence)sourceXsd).Items)
{
if (e() == typeof(XmlSchemaElement))
{
string name = ((XmlSchemaElement)childItem).Name;
if (nsKey(name))
{
XmlElement element = Element(name);
ext = values[(int)titles[name]];
Child(element);
}
}
else
{
AddElement(childItem, titles, sourceXml, sourceNd, values);
}
}
}
else
{
return;
}
}
/**////
/// 获得元素
///
///
///
public static
{
XmlSchemaElement element = GetTableSchema(name);
if (element == null)
if (element == null)
{
return null;
}
XmlSchemaComplexType complex = Type as XmlSchemaComplexType;
XmlSchemaSequence sequence = tTypeParticle as XmlSchemaSequence;
foreach (XmlSchemaObject obj in )
{
if (e() == typeof(XmlSchemaElement))
{
XmlSchemaElement item = (XmlSchemaElement)obj;
(item);
}
else
{
GetItem(arr, obj);
}
}
return arr;
}
public static void GetItem(
{
if (e() == typeof(XmlSchemaElement))
{
XmlSchemaElement item = (XmlSchemaElement)obj;
(item);
}
else if (e() == typeof(XmlSchemaChoice))
{
XmlSchemaChoice choice = obj as XmlSchemaChoice;
foreach (XmlSchemaObject child in )
{
if (e() == typeof(XmlSchemaElement))
{
XmlSchemaElement item = child as XmlSchemaElement;
(item);
}
else
{
GetItem(arr, child);
}
}
}
else if (e() == typeof(XmlSchemaSequence))
{
XmlSchemaSequence sequence = obj as XmlSchemaSequence;
foreach (XmlSchemaObject child in )
{
if (e() == typeof(XmlSchemaObject))
{
XmlSchemaElement item = child as XmlSchemaElement;
(item);
}
else
{
GetItem(arr, child);
}
}
}
else
{
return;
}
}
/**////
/// 根据节点名获得节点
///
///
///
public static XmlSchemaElement GetTableSchema(string name)
{
XmlSchemaSet xsSet = new XmlSchemaSet();
("/2001/XMLSchema", GetSchemaPath);
e();
XmlSchema schema=null;
foreach (XmlSchema xs in s())
{
schema = xs;
schema = xs;
}
XmlQualifiedName qf = new XmlQualifiedName(name, "/2001/XMLSchema");
if(ns(qf))
{
return (XmlSchemaElement)ts[qf];
}
return null;
}
static void XmlValidation(object sendor, ValidationEventArgs e)
{
switch (ty)
{
case :
throw ion;
case g:
throw ion;
}
}
/**////
/// 校验dom对象
///
///
///
public static string CheckDataXml(XmlDocument doc)
{
XmlSchemaSet xsd = new XmlSchemaSet();
("", GetSchemaPath);
s = xsd;
try
{
te(new ValidationEventHandler(XmlValidation));
}
catch (Exception ex)
{
return e;
}
return null;
}
}
版权声明:本文标题:根据xsd生成xml文档的c#实现(转) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1710022725a554057.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论