本文整理汇总了C#中System.Xml.XmlDocument.CreateDocumentType方法的典型用法代码示例。如果您正苦于以下问题:C# System.Xml.XmlDocument.CreateDocumentType方法的具体用法?C# System.Xml.XmlDocument.CreateDocumentType怎么用?C# System.Xml.XmlDocument.CreateDocumentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDocument
的用法示例。
在下文中一共展示了System.Xml.XmlDocument.CreateDocumentType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePlist
private void CreatePlist()
{
var doc = new System.Xml.XmlDocument();
// don't resolve any URLs, or if there is no internet, the process will pause for some time
doc.XmlResolver = null;
{
var type = doc.CreateDocumentType("plist", "-//Apple Computer//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
doc.AppendChild(type);
}
var plistEl = doc.CreateElement("plist");
{
var versionAttr = doc.CreateAttribute("version");
versionAttr.Value = "1.0";
plistEl.Attributes.Append(versionAttr);
}
var dictEl = doc.CreateElement("dict");
plistEl.AppendChild(dictEl);
doc.AppendChild(plistEl);
#if true
// TODO: this seems to be the only way to get the target settings working
CreateKeyValuePair(doc, dictEl, "BuildLocationStyle", "UseTargetSettings");
#else
// build and intermediate file locations
CreateKeyValuePair(doc, dictEl, "BuildLocationStyle", "CustomLocation");
CreateKeyValuePair(doc, dictEl, "CustomBuildIntermediatesPath", "XcodeIntermediates"); // where xxx.build folders are stored
CreateKeyValuePair(doc, dictEl, "CustomBuildLocationType", "RelativeToWorkspace");
CreateKeyValuePair(doc, dictEl, "CustomBuildProductsPath", "."); // has to be the workspace folder, in order to write files to expected locations
// derived data
CreateKeyValuePair(doc, dictEl, "DerivedDataCustomLocation", "XcodeDerivedData");
CreateKeyValuePair(doc, dictEl, "DerivedDataLocationStyle", "WorkspaceRelativePath");
#endif
this.Document = doc;
}
示例2: svgconcat
bool svgconcat(List<string> files, string output, uint delay, uint loop) {
if (controller_ != null) controller_.appendOutput("TeX2img: Making animation svg...");
try {
var outxml = new System.Xml.XmlDocument();
outxml.XmlResolver = null;
outxml.AppendChild(outxml.CreateXmlDeclaration("1.0", "utf-8", "no"));
outxml.AppendChild(outxml.CreateDocumentType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", null));
var svg = outxml.CreateElement("svg", "http://www.w3.org/2000/svg");
var attr = outxml.CreateAttribute("xmlns:xlink");
attr.Value = "http://www.w3.org/1999/xlink";
svg.Attributes.Append(attr);
attr = outxml.CreateAttribute("version");
attr.Value = "1.1";
svg.Attributes.Append(attr);
outxml.AppendChild(svg);
var defs = outxml.CreateElement("defs", "http://www.w3.org/2000/svg");
svg.AppendChild(defs);
var idreg = new System.Text.RegularExpressions.Regex(@"(?<!\&)#");
foreach (var f in files) {
var id = Path.GetFileNameWithoutExtension(f);
var xml = new System.Xml.XmlDocument();
xml.XmlResolver = null;
xml.Load(Path.Combine(workingDir, f));
foreach (System.Xml.XmlNode tag in xml.GetElementsByTagName("*")) {
foreach (System.Xml.XmlAttribute a in tag.Attributes) {
if (a.Name.ToLower() == "id") a.Value = id + "-" + a.Value;
else a.Value = idreg.Replace(a.Value, "#" + id + "-");
}
}
foreach (System.Xml.XmlNode tag in xml.GetElementsByTagName("svg")) {
var idattr = xml.CreateAttribute("id");
idattr.Value = id;
tag.Attributes.Append(idattr);
}
foreach (System.Xml.XmlNode n in xml.ChildNodes) {
if (n.NodeType != System.Xml.XmlNodeType.DocumentType && n.NodeType != System.Xml.XmlNodeType.XmlDeclaration) {
defs.AppendChild(outxml.ImportNode(n, true));
}
}
}
var use = outxml.CreateElement("use", "http://www.w3.org/2000/svg");
svg.AppendChild(use);
var animate = outxml.CreateElement("animate", "http://www.w3.org/2000/svg");
use.AppendChild(animate);
attr = outxml.CreateAttribute("attributeName");
attr.Value = "xlink:href"; animate.Attributes.Append(attr);
attr = outxml.CreateAttribute("begin");
attr.Value = "0s"; animate.Attributes.Append(attr);
attr = outxml.CreateAttribute("dur");
attr.Value = ((decimal)(delay * files.Count) / 100).ToString() + "s";
animate.Attributes.Append(attr);
attr = outxml.CreateAttribute("repeatCount");
attr.Value = loop > 0 ? loop.ToString() : "indefinite";
animate.Attributes.Append(attr);
attr = outxml.CreateAttribute("values");
attr.Value = String.Join(";", files.Select(d => "#" + Path.GetFileNameWithoutExtension(d)).ToArray());
animate.Attributes.Append(attr);
outxml.Save(Path.Combine(workingDir, output));
if (controller_ != null) controller_.appendOutput(" done\n");
return true;
}
catch (Exception) { return false; }
}
示例3: CreateManagementPlist
private void CreateManagementPlist()
{
var doc = new System.Xml.XmlDocument();
// don't resolve any URLs, or if there is no internet, the process will pause for some time
doc.XmlResolver = null;
{
var type = doc.CreateDocumentType("plist", "-//Apple Computer//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
doc.AppendChild(type);
}
var plistEl = doc.CreateElement("plist");
plistEl.SetAttribute("version", "1.0");
var dictEl = doc.CreateElement("dict");
plistEl.AppendChild(dictEl);
doc.AppendChild(plistEl);
{
var key = doc.CreateElement("key");
key.InnerText = "SchemeUserState";
dictEl.AppendChild(key);
var valueDict = doc.CreateElement("dict");
dictEl.AppendChild(valueDict);
foreach (var scheme in this.SchemeDocuments)
{
var schemeKey = doc.CreateElement("key");
schemeKey.InnerText = System.IO.Path.GetFileName(scheme.Key);
valueDict.AppendChild(schemeKey);
}
}
this.ManagementDocument = doc;
}