날짜 수정 된 항목을 포함하여 문서 시스템의 XML 파일에 대한 정렬 정렬을 시도합니다.Xpath 표현식 Addsort 메서드
기본적으로 나는 모든 문서 목록의 XML을 표시하는 gridview가 있고 표시하기 직전에 데이터에 addsort를 실행하고 있습니다.
각 파일에는 true 또는 false 및 게시 날짜가있는 완전한 문서이므로 수정이 필요하지 않습니다. 문서가 수정되면 태그는 true로 변경되고 완료되면 태그에 게시 날짜가 있습니다.
고객이 필요로하는 올바른 순서는 수정 된 날짜가있는 수정 된 날짜 -> 수정 된 태그가 거짓 인 날짜입니다.
현재 나는 제목을 기준으로 정렬이 :
StringReader str = new StringReader(PLCDocsXML.InnerXml);
XPathDocument doc = new XPathDocument(str);
XPathNavigator navigator2 = PLCDocsXML.CreateNavigator();
XPathExpression subselectExpression = navigator2.Compile(XpathExpr);
if (asc)
{
subselectExpression.AddSort("title", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Text);
}
XML은 다음과 같습니다
이<result>
<document>
<title>Title</title>
<otherstuff />
<modified>[true/false]<modified> #those with true first before false
<publishdate /> #if not got a publish date
<publishdate>2009-10-16</publishDate>
</document>
</result>
그래서 내가 필요로하는 순서는 다음과 같습니다 어떤 도움
<result>
<document>
<title>Title1</title>
<otherstuff />
<modified>true<modified>
<publishdate />
</document>
<document>
<title>Title4</title>
<otherstuff />
<modified>true<modified>
<publishdate>2010-11-27</publishDate>
</document>
<document>
<title>Title2</title>
<otherstuff />
<modified>true<modified>
<publishdate>2009-10-16</publishDate>
</document>
<document>
<title>Title3</title>
<otherstuff />
<modified>false<modified>
<publishdate />
</document>
</result>
감사합니다 너는 줄 수있어