|
stormcandi wrote: Well I guess I need to find some good books that will help me out.
You might start with wikipedia[^]. There are several book references as well as others links for further reading.
led mike
|
|
|
|
|
Thanks for getting me started!
~Candi
|
|
|
|
|
Hello everyone,
I would like to know if someone has experienced this problem:
I have a xml file:
<?xml version="1.0" standalone="yes"?>
<requests>
<request>
<idRequest>123</idRequest>
<requestType>001AA</requestType>
<subRequest>
<name>Some Name</name>
<birthDate>12-12-2007</birthDate>
<isbirthDateComplete>true</isbirthDateComplete>
</subRequest>
<observations>Some Observations...</observations>
<recordType>Insert</recordType>
</resquest>
</requests>
If I read the xml:
DataSet dsTest = new DataSet();
dsTeste.ReadXml(Application.StartupPath + "\\Test.xml");
and then write it back:
dsTest.WriteXml(Application.StartupPath + "\\Test1.xml");
it gives me:
<?xml version="1.0" standalone="yes"?>
<requests>
<request>
<idRequest>123</idRequest>
<requestType>001AA</requestType>
<observations>Some Observations...</observations>
<recordType>Insert</recordType>
<subRequest>
<name>Some Name</name>
<birthDate>12-12-2007</birthDate>
<isbirthDateComplete>true</isbirthDateComplete>
</subRequest>
</resquest>
</requests>
It simply change the order of the nodes. Is there any reason for this?
Thanks in advance.
|
|
|
|
|
H@is@here wrote: Is there any reason for this?
Yes and no. I'm pretty sure default Serialization does not guarantee order of nodes because in the XML standard order is not supported. Sorting is but not original order. Again, I'm not 100% sure but pretty confident.
led mike
|
|
|
|
|
Hello and thank you for your answer.
And what is more interesting is that I have a xsd file with this xml and it still reorder the xml.
Humm!
|
|
|
|
|
because the dataset you create based on that xml will order xml contents as 2 datatable, 'request' and 'subrequest' where those datatable have hidden relation try dsTest.WriteXmlSchema(filename) to know its structure
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
Hi again,
Yes i know that.
Even if you use the XmlWriteMode.WriteSchema with the xml, edit the schema with VS to match the order, read the edited file and save it again the result is the same. It simply doesn't maintain the order.
Thanks ans best regards
|
|
|
|
|
The better question is...does it really matter? XML wasn't designed for and isn't intended to be human-readable; it was designed to provide a consistent structure for data. The fact that you have a schema doesn't define the order of elements other than to indicate what elements are valid subelements of another element. As long as the XML structure matches the structure defined in the schema everything is happy. The fact that an element is listed first or third doesn't matter.
As to the reason it is reordering, there are several possibilities. The most likely one is that the XmlSerializer doesn't guarantee order. It is going to write out the XML in the order defined by the Datatable/Dataset.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
So what I said
led mike wrote: because in the XML standard order is not supported. Sorting is but not original order.
led mike
|
|
|
|
|
Hi and thank you for your answer.
Yes, your are right, for me it doesn't matter.
It is mattering for the other system that am communicating with.
I was only trying to check if there was a reason for that or if I could do something about it.
Best regards for all.
|
|
|
|
|
so you have to write your xml output manually
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
H@is@here wrote: It is mattering for the other system that am communicating with.
Not to sound flippant, but it shouldn't matter to the other system as well. The fact that it does probably means that they aren't using an XML parser to read the XML and are doing all of the parsing by hand. This is wrong on so many different levels. They should rethink how they are doing the XML parsing and use an actual parser so they don't have that problem.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Scott Dorman wrote: Not to sound flippant
Not at all, it is a old system, and probably they are processing the xml manually.
Thanks again.
|
|
|
|
|
User can add new row to Winforms DataGridView by pressing Ctrl+down arrow.
How to initialize some new row values from current row ?
How to get last row number which was current if Ctrl+Down arrow key was
pressed ?
Andrus
|
|
|
|
|
Whenever scope goes to new row then RowEnter event fired.
Probably this event will help you.
Parwej Ahamad
R & D: REST services with WCF
|
|
|
|
|
Whenever I wana use XPExplorerBar.dll in my projects, I have this problem. When I press F5, the project returns to code editor and a window alerts me this:
A call to PInvoke function 'XPExplorerBar! XPExplorerBar NativeMethods:: LoadBitmap' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
[DllImport("User32.dll")]
public static extern IntPtr LoadBitmap(IntPtr hInstance, long lpBitmapName);
and must be changed to this :
DllImport("User32.dll")]
public static extern IntPtr LoadBitmap(IntPtr hInstance, int lpBitmapName);
But I don't know, code demo?
|
|
|
|
|
No need to post three times.
If you want to add or change something, either modify your original message (use the Edit button),
or add a new message to the same thread.
|
|
|
|
|
Whenever I wana use XPExplorerBar.dll in my projects, I have this problem. When I press F5, the project returns to code editor and a window alerts me this:
A call to PInvoke function 'XPExplorerBar! XPExplorerBar NativeMethods:: LoadBitmap' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
[DllImport("User32.dll")]
public static extern IntPtr LoadBitmap(IntPtr hInstance, long lpBitmapName);
and must be changed to this :
DllImport("User32.dll")]
public static extern IntPtr LoadBitmap(IntPtr hInstance, int lpBitmapName);
But I don't know
|
|
|
|
|
Whenever I wana use XPExplorerBar.dll in my projects, I have this problem. When I press F5, the project returns to code editor and a window alerts me this:
A call to PInvoke function 'XPExplorerBar! XPExplorerBar NativeMethods:: LoadBitmap' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
[DllImport("User32.dll")]
public static extern IntPtr LoadBitmap(IntPtr hInstance, long lpBitmapName);
and must be changed to this :
DllImport("User32.dll")]
public static extern IntPtr LoadBitmap(IntPtr hInstance, int lpBitmapName);
But I don't kwon
|
|
|
|
|
|
Actually, it works if the long is changed to an int. (C++ long == C# int).
I'm not sure why it works with this modification, since it does appear the unmanaged method takes a string, not an int.
*edit* Ah, according to MSDN,
Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. The <a id="ctl00_rs1_mainContentContainer_ctl03" onclick="javascript:Track('ctl00_rs1_mainContentContainer_ctl00|ctl00_rs1_mainContentContainer_ctl03',this);" href="http://msdn.microsoft.com/en-us/library/ms648029%28VS.85%29.aspx">MAKEINTRESOURCE</a> macro can be used to create this value. That's why passing in an int will work.
Life, family, faith: Give me a visit.
From my latest post: "We are Christian, resistance is futile. Your Jewish traits will be assimilated into the Church collective."
Judah Himango
|
|
|
|
|
Wow.
Strictly speaking, this still seems incorrect. If what gets passed is a pointer, it should take
4 or 8 bytes depending on Win32/Win64. So when not a string, then an IntPtr should be used,
don't you think?
|
|
|
|
|
Yeah, if it's taking a pointer, then yes, an IntPtr should be used rather than an int.
However, while I'm not privvy on all the unmanaged lingo, it's not clear from the documentation that it is a pointer. It seems the integer is simply an identifier of a resource, not a pointer to an integer.
modified on Friday, July 18, 2008 1:51 PM
|
|
|
|
|
This was discussed and fixed[^] in the comments to the XPExplorerBar article.
Life, family, faith: Give me a visit.
From my latest post: "We are Christian, resistance is futile. Your Jewish traits will be assimilated into the Church collective."
Judah Himango
|
|
|
|
|
Hi All,
Newbie question!!!
Is it possible to have a web interface for a c# Windows application??
Basically this is what i would want to do. I have a Windows application program which runs 24/7 and collects data from the TCP IP layer and stores it in a database. Its a windows application witha form for the administrator to do the initial configuration and monitoring.
All the data that is collected now needs to be shown on a web page, as a status report with graphs and stuff. Also the web page should be able to send data to the application , which inturn will send TCP IP data .
How do I proceed with this??
Any help will be appreciated.
Best Regards.
|
|
|
|