Forgot your password?
Sign in with
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Python questions
View Java questions
All Message Boards...
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Design and Architecture
Internet of Things
C / C++ / MFC
ATL / WTL / STL
Objective-C and Swift
Hardware & Devices
Hosting and Servers
.NET (Core and Framework)
Site Bugs / Suggestions
Spam and Abuse Watch
The Insider Newsletter
The Daily Build Newsletter
Most Valuable Professionals
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
What is 'CodeProject'?
Ask a Question
Bugs and Suggestions
Article Help Forum
Comments by Daniel Leykauf (Top 8 by date)
Also that does not solve my problem. As you can see in the sample file there are per row different childs.
But overall is there a logical structure that I want to build.
For example: in 2nd row line2 is new compared to first row and listed before line3 (from its index) because line3 is in 2nd row after line2.
Therefore the index per value has to be shifted. A sorting by name cannot be used as the element names can be have different names. Only the values from previous to current row can be used and each index has to be changed campared to previous row index.
One other simple sample per line:
1: abc, def, jkl
2: def, ghi, jkl
The result should be: "abc, def, ghi, jkl"
Please ignore the sample names; they could also be: "xyz, abc, zuv, ooh" or whatever. Therefore an alphabetical sorting cannot be used! The sorting needs to by applied by the index (considering the next and previous value) campared with the value index in the line before.
If there are values those are not existing before, they have to be added at the end.
But if one of next line contains that value already, the index has to be set the correct position.
Please have a look at the XML sample above and the expected result. A string sorting cannot be used as I need it ordered by the name index (instead the name). Thanks!
That is unfortunately not the issue and question.
The node parsing is the easiest part. I want to get the sorted child names according to their occurance per row.
Therefore a solution has to get all childs per row and has to insert new names according to their logical position. For existing names the index has to shifted in case the new index is unequal to the existing one.
Thanks once again (also for the time you spent for)!
Thanks for your reply! The reason for my question is that I want to visualize the child nodes in a grid (elements names has header, rows listed with their values below). The header names should appear in order of the child elements based on their occurances (in the parent element). But not all XML files are referenced to a xsd file (where you can get the correct position) or are mendatory and might be missing per row. Therefore I have to parse each node (in above sample the "row" element) and their childs and to build a sorted list.
Linq to query is therefore no alternate as I do not know the XML file structure nor could be the element names in an non-alphabetically order where only the position describes the correct order.
As already mentioned after the xml block, I would like to have the sorted child names as unqiue list: "line1, line2, line3, line4".
Thank you! I found a C# solution and it is working fine in C#. But in VB do I have to truncate the values otherwise do I get for the 3rd byte 4 instead of 3 ... crazy:
Dim Length as Integer = 63040
For i As Integer = 3 To 0 Step -1
b(i) = Convert.ToByte(Length Mod &H80)
Debug.Print(b(i)) Length /= &H80
Length = Math.Truncate(Length / &H80)
VB: If (CULng(val) And &HFFFF000000000000UL) = &HFFFF000000000000UL ...
C#: if (((ulong)val & 0xFFFF000000000000) == 0xFFFF000000000000) ...
Last Updated 1 Jan 1900
All Rights Reserved.