Click here to Skip to main content
15,917,588 members
Home / Discussions / C#
   

C#

 
AnswerRe: .NET Registry Creator Pin
Mycroft Holmes21-Jan-15 20:47
professionalMycroft Holmes21-Jan-15 20:47 
AnswerRe: .NET Registry Creator Pin
Bernhard Hiller22-Jan-15 0:58
Bernhard Hiller22-Jan-15 0:58 
QuestionCoding help Pin
Member 1139217221-Jan-15 7:04
Member 1139217221-Jan-15 7:04 
AnswerRe: Coding help Pin
Wendelius21-Jan-15 7:19
mentorWendelius21-Jan-15 7:19 
GeneralRe: Coding help Pin
Member 1139217221-Jan-15 7:43
Member 1139217221-Jan-15 7:43 
GeneralRe: Coding help Pin
Pete O'Hanlon21-Jan-15 9:06
mvePete O'Hanlon21-Jan-15 9:06 
QuestionDeserialize Parts of an XML Pin
Antonio Cambule20-Jan-15 22:32
Antonio Cambule20-Jan-15 22:32 
AnswerRe: Deserialize Parts of an XML Pin
Daniel Pfeffer20-Jan-15 22:55
professionalDaniel Pfeffer20-Jan-15 22:55 
When you have variable formats, I suspect that the best way is to implement your own parser, using the low-level functions in System.Xml:

1. When detecting a new tag, call a constructor for the class representing the tag, passing the XML stream to the constructor.
2. Using the low-level XML APIs, the constructor should read the entire tag, placing the XML stream's cursor at the end of the tag.
3. Repeat until all the stream has been read.

Note that a specific class constructor may do nothing but advance the cursor to the end of the tag (the equivalent of ignoring the data). However, to my knowledge there is no way of doing so without actually reading (and discarding) the data from the XML stream.

In your second example:
a. <response> - call the response constructor
a.1 <method> - call the method constructor (note that this may do nothing other than advance the cursor)
a.2 <answer> - call the answer constructor, passing the XML stream and a pointer to the response instance
a.2.1 <result> - call the result constructor, passing the XML stream and a pointer to the response instance
a.2.2 <result> - call the result constructor as above
a.2.3 <result> - call the result constructor as above

You will obviously have to define classes that match each tag. With a bit of thought, it should be possible to design classes that insert the desired data (and nothing else) into the response instance.

I have used this approach with success on multiple projects.
GeneralRe: Deserialize Parts of an XML Pin
Antonio Cambule20-Jan-15 23:13
Antonio Cambule20-Jan-15 23:13 
GeneralRe: Deserialize Parts of an XML Pin
Daniel Pfeffer21-Jan-15 0:40
professionalDaniel Pfeffer21-Jan-15 0:40 
GeneralRe: Deserialize Parts of an XML Pin
Antonio Cambule21-Jan-15 0:56
Antonio Cambule21-Jan-15 0:56 
GeneralRe: Deserialize Parts of an XML Pin
Daniel Pfeffer21-Jan-15 2:51
professionalDaniel Pfeffer21-Jan-15 2:51 
AnswerRe: Deserialize Parts of an XML Pin
Gerry Schmitz21-Jan-15 13:00
mveGerry Schmitz21-Jan-15 13:00 
QuestionIE 11 Registry Entries Pin
namerg20-Jan-15 11:43
namerg20-Jan-15 11:43 
AnswerRe: IE 11 Registry Entries Pin
Pete O'Hanlon20-Jan-15 11:50
mvePete O'Hanlon20-Jan-15 11:50 
GeneralRe: IE 11 Registry Entries Pin
namerg20-Jan-15 11:57
namerg20-Jan-15 11:57 
GeneralRe: IE 11 Registry Entries Pin
Pete O'Hanlon20-Jan-15 12:14
mvePete O'Hanlon20-Jan-15 12:14 
GeneralRe: IE 11 Registry Entries Pin
namerg20-Jan-15 14:13
namerg20-Jan-15 14:13 
QuestionHex to UUEncode in C# Pin
NJdotnetdev20-Jan-15 2:04
NJdotnetdev20-Jan-15 2:04 
AnswerRe: Hex to UUEncode in C# Pin
OriginalGriff20-Jan-15 2:50
mveOriginalGriff20-Jan-15 2:50 
GeneralRe: Hex to UUEncode in C# Pin
NJdotnetdev20-Jan-15 3:24
NJdotnetdev20-Jan-15 3:24 
GeneralRe: Hex to UUEncode in C# Pin
OriginalGriff20-Jan-15 3:35
mveOriginalGriff20-Jan-15 3:35 
GeneralRe: Hex to UUEncode in C# Pin
NJdotnetdev20-Jan-15 3:43
NJdotnetdev20-Jan-15 3:43 
GeneralRe: Hex to UUEncode in C# Pin
OriginalGriff20-Jan-15 4:01
mveOriginalGriff20-Jan-15 4:01 
GeneralRe: Hex to UUEncode in C# Pin
NJdotnetdev20-Jan-15 4:42
NJdotnetdev20-Jan-15 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.