Skip to content

Instantly share code, notes, and snippets.

@pietroleggero
Last active March 25, 2017 00:23
Show Gist options
  • Save pietroleggero/652561d253c208cc4605c26f54e2395a to your computer and use it in GitHub Desktop.
Save pietroleggero/652561d253c208cc4605c26f54e2395a to your computer and use it in GitHub Desktop.
Snippet of code that give an idea of the parse the Knova GetDetailsFull to get the Article details
To Get the article details, you can use the knowa API
GetDetailsFull with
externalId = the article ID
sliceID = 1
sessionID = ""
public static ArticleDetail ParseArticleDetailXml(string xml)
{
string nodePath = "KC";
string type = "";
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(xml);
XmlNode node = xDoc.SelectSingleNode(nodePath);
ArticleDetail article = new ArticleDetail(node, type);
return article;
}
public class ArticleDetail
{
public string Title { get; set; }
public string Content { get; set; }
public string Id { get; set; }
public ArticleDetail() { }
public ArticleDetail(XmlNode node, string type)
{
XmlNode titleNode = node.SelectSingleNode("Content/KANISA_INDEXED/KANISA_TITLE");
XmlNode contentNode = node.SelectSingleNode("Content/KANISA_INDEXED/KANISA_AUTHORED_DOC/CA1342025090212");
XmlNode contentNode2 = node.SelectSingleNode("Content/KANISA_INDEXED/KANISA_AUTHORED_DOC/CA1342025108628");
XmlNode idNode = node.Attributes["ExternalID"];
Title = titleNode != null ? titleNode.InnerText : "";
Content = contentNode != null ? contentNode.InnerText : "";
Content += "<br>" + contentNode2 != null ? contentNode2.InnerText : "";
Id = idNode != null ? idNode.Value : "";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment