本文整理汇总了C#中XDoc.Start方法的典型用法代码示例。如果您正苦于以下问题:C# XDoc.Start方法的具体用法?C# XDoc.Start怎么用?C# XDoc.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDoc
的用法示例。
在下文中一共展示了XDoc.Start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFeatureOverview
private static XDoc GetFeatureOverview(XDoc feature)
{
// generate a document containing the overview information for a feature
XDoc overviewDoc = new XDoc("html");
overviewDoc.Start("h2").Value("Overview").End();
overviewDoc.Add(GetWarning());
overviewDoc.Start("p").Start("strong").Value(feature["access"].Contents + ". ").End().Value(feature["description"].Contents).End();
XDoc uriParams = new XDoc("uriParams");
XDoc queryParams = new XDoc("queryParams");
foreach(XDoc param in feature["param"]) {
string paramName = param["name"].Contents;
if(paramName.StartsWith("{")) {
if(feature["pattern"].Contents.Contains(paramName)) {
param["name"].ReplaceValue(paramName.Trim(new char[] { '{', '}' }));
uriParams.Add(param);
}
} else {
queryParams.Add(param);
}
}
overviewDoc.Start("h5").Value("Uri Parameters").End();
overviewDoc.Add(GetTable(new string[] { "Name", "Type", "Description" }, uriParams["param"]));
overviewDoc.Start("h5").Value("Query Parameters").End();
overviewDoc.Add(GetTable(new string[] { "Name", "Type", "Description" }, queryParams["param"]));
overviewDoc.Start("h5").Value("Return Codes").End();
XDoc statusesDoc = new XDoc("statuses");
foreach(XDoc statusDoc in feature["status"]) {
DreamStatus status = (DreamStatus)statusDoc["@value"].AsInt;
statusesDoc.Start("status").Elem("name", status.ToString()).Elem("value", (int)status).Elem("description", statusDoc.Contents).End();
}
overviewDoc.Add(GetTable(new string[] { "Name", "Value", "Description" }, statusesDoc["status"]));
return overviewDoc;
}
示例2: GetArchive
public Yield GetArchive(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.ADMIN);
XDoc ret = new XDoc("archive");
ret.Start("pages.archive").Attr("href", DekiContext.Current.ApiUri.At("archive", "pages")).End();
ret.Start("files.archive").Attr("href", DekiContext.Current.ApiUri.At("archive", "files")).End();
response.Return(DreamMessage.Ok(ret));
yield break;
}
示例3: EnsureElement
private static XDoc EnsureElement(XDoc doc, string parentKey, string key, string def) {
XDoc parent = doc[parentKey];
if (parent.IsEmpty) {
doc.Start(parentKey);
if (key == null)
doc.Value(def);
doc.End();
parent = doc[parentKey];
}
if (key == null)
return parent;
XDoc child = parent[key];
if (child.IsEmpty) {
if (def == null) {
child = null;
} else {
parent.Start(key);
parent.Value(def);
parent.End();
child = parent[key];
}
} else if (def == null && child.Contents == "") {
child.Remove();
child = null;
}
return child;
}
示例4: GetSearchDescription
public Yield GetSearchDescription(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
XDoc description = new XDoc("OpenSearchDescription", "http://a9.com/-/spec/opensearch/1.1/");
description.Elem("ShortName", string.Format(DekiResources.OPENSEARCH_SHORTNAME, DekiContext.Current.Instance.SiteName))
.Elem("Description", DekiResources.OPENSEARCH_DESCRIPTION)
.Start("Query")
.Attr("role", "example")
.Attr("searchTerms", "Wiki")
.End();
// HACK HACK HACK: we can't use XUri because it encodes the "{}" characters
string uri = DekiContext.Current.ApiUri.At("site", "opensearch").ToString();
uri += "?q={searchTerms}&offset={startIndex}&limit={count?}&";
description.Start("Url")
.Attr("type", "text/html")
.Attr("indexOffset", 0)
.Attr("template", DekiContext.Current.UiUri.At("Special:Search").ToString() + "?search={searchTerms}&offset=0&limit={count?}&format=html")
.End()
.Start("Url")
.Attr("type", "application/atom+xml")
.Attr("indexOffset", 0)
.Attr("template", uri + "format=atom")
.End()
.Start("Url")
.Attr("type", "application/rss+xml")
.Attr("indexOffset", 0)
.Attr("template", uri + "format=rss")
.End()
.Start("Url")
.Attr("type", "application/x-suggestions+json")
.Attr("template", DekiContext.Current.ApiUri.At("site", "opensearch", "suggestions").ToString() + "?q={searchTerms}")
.End();
response.Return(DreamMessage.Ok(description));
yield break;
}
示例5: XmlRpcLiteralRecurse
//--- Class Methods ---
private static void XmlRpcLiteralRecurse(XDoc xdoc, DekiScriptLiteral value, bool isArgumentList) {
if(!isArgumentList) {
xdoc.Start("value");
}
switch(value.ScriptType) {
case DekiScriptType.BOOL:
xdoc.Elem("boolean", ((DekiScriptBool)value).Value ? "1" : "0");
break;
case DekiScriptType.NUM:
xdoc.Elem("double", ((DekiScriptNumber)value).Value);
break;
case DekiScriptType.STR:
xdoc.Elem("string", ((DekiScriptString)value).Value); // in order to work with php, this may need to be encoded
break;
case DekiScriptType.NIL:
xdoc.Elem("nil");
break;
case DekiScriptType.URI:
xdoc.Start("string").Attr("type", "uri").End();
break;
case DekiScriptType.XML:
xdoc.Start("string").Attr("type", "xml").Value(value.NativeValue.ToString()).End();
break;
case DekiScriptType.LIST:
xdoc.Start(isArgumentList ? "params" : "array");
if(!isArgumentList)
xdoc.Start("data");
foreach(DekiScriptLiteral entry in ((DekiScriptList)value).Value) {
if(isArgumentList) {
xdoc.Start("param");
XmlRpcLiteralRecurse(xdoc, entry, false);
xdoc.End();
} else {
XmlRpcLiteralRecurse(xdoc, entry, false);
}
}
if(!isArgumentList)
xdoc.End();
xdoc.End();
break;
case DekiScriptType.MAP:
xdoc.Start("struct");
foreach(KeyValuePair<string, DekiScriptLiteral> entry in ((DekiScriptMap)value).Value) {
xdoc.Start("member");
xdoc.Elem("name", entry.Key);
XmlRpcLiteralRecurse(xdoc, entry.Value, false);
xdoc.End();
}
xdoc.End();
break;
default:
throw new ShouldNeverHappenException("unkwown type");
}
if(!isArgumentList)
xdoc.End();
return;
}
示例6: ToDocument
public XDoc ToDocument() {
var doc = new XDoc("updateRecord")
.Attr("wikiid", WikiId)
.Attr("userid", UserId);
foreach(var kvp in _pages) {
doc.Start("page").Attr("id", kvp.Key).Attr("modified", kvp.Value).End();
}
return doc;
}
示例7: Link
public XDoc Link(
[DekiExtParam("bug id")] int id
) {
IssueData bug = _service.mc_issue_get(_username, _password, id.ToString());
XDoc result = new XDoc("html");
result.Start("body");
BuildBugLink(bug, result);
result.End();
return result;
}
示例8: GetHostInstances
internal DreamMessage GetHostInstances(DreamContext context, DreamMessage request) {
var response = new XDoc("tenants");
foreach(var status in Instancemanager.InstanceStatuses) {
response.Start("tenant")
.Attr("wikiid", status.Key)
.Attr("status", status.Value)
.End();
}
return DreamMessage.Ok(response);
}
示例9: Link
public XDoc Link(
[DekiExtParam("bug id")] int id
) {
object[] ticket = _trac.TicketGet(id);
XDoc result = new XDoc("html");
result.Start("body");
BuildBugLink((XmlRpcStruct) ticket[3], result, id);
result.End();
return result;
}
示例10: LogSpaceConversion
public void LogSpaceConversion(XDoc spaceManifest, string space, string confUrl, string mtPath) {
string xpath = string.Format("space[@space='{0}']", space);
XDoc spaceXml = spaceManifest[xpath];
if(spaceXml.IsEmpty) {
spaceManifest.Start("url");
spaceManifest.Attr("space", space);
spaceManifest.Attr("c.path", Utils.GetUrlLocalUri(_confBaseUrl, confUrl, false, false));
spaceManifest.Attr("mt.path", mtPath);
spaceManifest.End();
}
}
示例11: LogUserConversion
public void LogUserConversion(XDoc spaceManifest, string confUserName, string mtUserId, string mtUserName, string confUserUrl) {
string xpath = string.Format("user[@c.username='{0}']", confUserName);
XDoc userXml = spaceManifest[xpath];
if(userXml.IsEmpty) {
spaceManifest.Start("user");
spaceManifest.Attr("c.username", confUserName);
spaceManifest.Attr("mt.userid", mtUserId);
spaceManifest.Attr("mt.username", mtUserName);
spaceManifest.Attr("c.path", Utils.GetUrlLocalUri(_confBaseUrl, confUserUrl, false, true));
spaceManifest.Attr("mt.path", Utils.GetDekiUserPageByUserName(mtUserName));
spaceManifest.End();
}
}
示例12: LogCommentConversion
public void LogCommentConversion(XDoc spaceManifest, string space, RemoteComment comment, string mtPath) {
string xpath = string.Format("comment[@c.commentid='{0}']", comment.id);
XDoc commentXml = spaceManifest[xpath];
if(commentXml.IsEmpty) {
spaceManifest.Start("comment");
spaceManifest.Attr("c.space", space);
spaceManifest.Attr("c.commentid", comment.id);
spaceManifest.Attr("c.pageid", comment.pageId);
spaceManifest.Attr("c.path", Utils.GetUrlLocalUri(_confBaseUrl, comment.url, true, false));
spaceManifest.Attr("mt.path", mtPath);
spaceManifest.End();
}
}
示例13: LogFileConversion
public void LogFileConversion(XDoc spaceManifest, RemoteAttachment fileInfo, string contentUrl) {
string xpath = string.Format("file[@c.fileid='{0}']", fileInfo.id);
XDoc fileXml = spaceManifest[xpath];
if(fileXml.IsEmpty) {
spaceManifest.Start("file");
spaceManifest.Attr("c.fileid", fileInfo.id);
spaceManifest.Attr("c.pageid", fileInfo.pageId);
spaceManifest.Attr("c.filename", fileInfo.fileName);
spaceManifest.Attr("c.filesize", fileInfo.fileSize);
spaceManifest.Attr("c.mimetype", fileInfo.contentType);
spaceManifest.Attr("c.path", Utils.GetUrlLocalUri(_confBaseUrl, fileInfo.url, false, true));
spaceManifest.Attr("mt.path", Utils.GetApiUrl(Utils.GetUrlLocalUri(_confBaseUrl, contentUrl, true, true)));
spaceManifest.End();
}
}
示例14: LogPageConversion
public void LogPageConversion(XDoc spaceManifest, ACConverterPageInfo pageInfo) {
string xpath = string.Format("page[@c.pageid='{0}']", pageInfo.ConfluencePage.id);
XDoc pageXml = spaceManifest[xpath];
if(pageXml.IsEmpty) {
spaceManifest.Start("page");
spaceManifest.Attr("c.space", pageInfo.ConfluencePage.space);
spaceManifest.Attr("c.pageid", pageInfo.ConfluencePage.id);
spaceManifest.Attr("c.parentpageid", pageInfo.ConfluencePage.parentId);
spaceManifest.Attr("c.path", Utils.GetUrlLocalUri(_confBaseUrl, pageInfo.ConfluencePage.url, true, false));
spaceManifest.Attr("c.tinyurl", pageInfo.TinyUrl);
spaceManifest.Attr("mt.pageid", pageInfo.DekiPageId);
spaceManifest.Attr("mt.path", pageInfo.DekiPageUrl);
spaceManifest.Attr("title", pageInfo.PageTitle);
spaceManifest.End();
}
}
示例15: GetFeatureAdditionalInfo
private static XDoc GetFeatureAdditionalInfo(XDoc feature)
{
// generate a document containing the additional information for a feature
XDoc additionalInfoDoc = new XDoc("html");
additionalInfoDoc.Start("h2").Value("Message Format").End();
additionalInfoDoc.Start("p").Start("em").Value("(placeholder for message format)").End().End();
additionalInfoDoc.Start("h2").Value("Implementation Notes").End();
additionalInfoDoc.Start("p").Start("em").Value("(placeholder for implementation notes)").End().End();
additionalInfoDoc.Start("h2").Value("Code Samples").End();
additionalInfoDoc.Start("p").Start("em").Value("(placeholder for code samples)").End().End();
return additionalInfoDoc;
}