我正在使用C#创建一个XML Schema,但我发现了一个相当奇怪的标签序列,我之前从未使用过它。我希望它看起来像这样:
find /paths/to/drawable/dirs -type f -name '*-*' -print0 \
| while read -rd '' f; do
# File's path.
p="${f%/*}"
# File's base-name.
f1="${f##*/}"
# Lower-cased base-name.
f1="${f1,,}"
# Rename.
echo mv "$f" "$p/${f1//-/_}"
done
如果你能帮助我,我感激不尽,谢谢:)
答案 0 :(得分:0)
你最好的朋友是MSDN ......我在XmlSchema文档页面下面显示了一个改编的样本;基本上,链接你的SOM API调用的方式与XSD结构相同。
using System;
using System.Xml;
using System.Xml.Schema;
class XMLSchemaExamples
{
public static void Main()
{
XmlSchema schema = new XmlSchema();
var ct = new XmlSchemaComplexType {Name = "Sensor_Info"};
schema.Items.Add(ct);
var at = new XmlSchemaAttribute
{
Name = "count",
SchemaTypeName = new XmlQualifiedName("int", XmlSchema.Namespace)
};
ct.Attributes.Add(at);
var seq = new XmlSchemaSequence();
ct.Particle = seq;
var sensor = new XmlSchemaElement {Name = "Sensor", MaxOccursString = "unbounded"};
seq.Items.Add(sensor);
var sensorType = new XmlSchemaComplexType();
sensor.SchemaType = sensorType;
at = new XmlSchemaAttribute
{
Name = "id",
SchemaTypeName = new XmlQualifiedName("string", XmlSchema.Namespace)
};
sensorType.Attributes.Add(at);
// TODO add more attributes here
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.ValidationEventHandler += ValidationCallbackOne;
schemaSet.Add(schema);
schemaSet.Compile();
var nsmgr = new XmlNamespaceManager(new NameTable());
nsmgr.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
schema.Write(Console.Out, nsmgr);
}
public static void ValidationCallbackOne(object sender, ValidationEventArgs args)
{
Console.WriteLine(args.Message);
}
}