Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6250281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:23:42+00:00 2026-05-24T13:23:42+00:00

Im trying to do an add sort for an XML file for a document

  • 0

Im trying to do an add sort for an XML file for a document system, including a date modified entry.

Basically I have a gridview to display the XML of all the document list, and I’m running addsort on the data just before displaying.

Each file has a tag, with a true or false, and then a published date (these are complete documents and therefore need no modification), when a document has been modified the tag gets changed to true, once its been finished it’s given a published date on the tag.

To have the correct order for what the customer needs is those Modified->Ones with a modified date->those with a false modified tag.

Currently I have for sorting by title:

        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);
        }

The XML Looks like this:

    <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>

So the order I need is:

     <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>

Thanks for any help you can give

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:23:43+00:00Added an answer on May 24, 2026 at 1:23 pm

    I ended up fixing this myself (I couldn’t get kirills to compile, it was complaining that there was no concat method)

    The way was to use an xpath select to separate out all the different types of item and then sort each of them induvidually before iterating over them as if they were a single item, worked for me

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add some basic file-download functionality to my Rails application and have
Since GLSL doesn't have an include-file option I'm trying to add this by using
I'm trying to sort a bunch of records in an XML file. The trick
Im trying to add some short file names to a Wise installer to fix
I am trying to add some styles in some DataGrid s I have. I
I am trying to create a sort of generic xml parser, like this: Part
I have a strange problem when trying to add buttons to a QWidget during
Basically I'm trying to implement some sort of poor man's Aspect Oriented Programming in
I am trying to add a different data types (to make JTable sort integer
I'm trying to add support into showdown.js for code fencing, but I'm still sort

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.