当前位置: 首页>>代码示例>>C#>>正文


C# XDoc.Start方法代码示例

本文整理汇总了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;
 }
开发者ID:maximmass,项目名称:DReAM,代码行数:33,代码来源:Program.cs

示例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;
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:8,代码来源:DekiWiki-RecycleBin.cs

示例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;
 }
开发者ID:heran,项目名称:DekiWiki,代码行数:27,代码来源:DekiBizCard.cs

示例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;
        }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:35,代码来源:DekiWiki-Search.cs

示例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;
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:58,代码来源:DekiScriptXmlRpcInvocationTarget.cs

示例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;
 }
开发者ID:heran,项目名称:DekiWiki,代码行数:9,代码来源:NotificationUpdateRecord.cs

示例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;
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:10,代码来源:MantisService.cs

示例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);
 }
开发者ID:heran,项目名称:DekiWiki,代码行数:10,代码来源:DekiWiki-Host.cs

示例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;
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:11,代码来源:TracService.cs

示例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();
     }
 }
开发者ID:heran,项目名称:DekiWiki,代码行数:12,代码来源:ACConverter.Persistence.cs

示例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();
            }
        }
开发者ID:heran,项目名称:DekiWiki,代码行数:14,代码来源:ACConverter.Persistence.cs

示例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();
            }
        }
开发者ID:heran,项目名称:DekiWiki,代码行数:14,代码来源:ACConverter.Persistence.cs

示例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();
            }
        }
开发者ID:heran,项目名称:DekiWiki,代码行数:16,代码来源:ACConverter.Persistence.cs

示例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();
            }
        }
开发者ID:heran,项目名称:DekiWiki,代码行数:17,代码来源:ACConverter.Persistence.cs

示例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;
 }
开发者ID:maximmass,项目名称:DReAM,代码行数:12,代码来源:Program.cs


注:本文中的XDoc.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。