Click here to Skip to main content
15,893,508 members
Home / Discussions / XML / XSL
   

XML / XSL

 
AnswerRe: How to extract specific data values from xml using VC++ Pin
Stefan Troschuetz24-Oct-07 2:30
Stefan Troschuetz24-Oct-07 2:30 
AnswerRe: How to extract specific data values from xml using VC++ Pin
Nathan Holt at EMOM24-Oct-07 6:35
Nathan Holt at EMOM24-Oct-07 6:35 
GeneralProblem with SelectNodes [modified] Pin
Brady Kelly23-Oct-07 5:08
Brady Kelly23-Oct-07 5:08 
GeneralRe: Problem with SelectNodes Pin
pmarfleet23-Oct-07 5:34
pmarfleet23-Oct-07 5:34 
GeneralRe: Problem with SelectNodes Pin
Brady Kelly23-Oct-07 5:37
Brady Kelly23-Oct-07 5:37 
News[ANN] Liquid XML Studio Released - A Freeware XML Development Environment Pin
Liquid Technologies22-Oct-07 22:33
Liquid Technologies22-Oct-07 22:33 
GeneralRe: [ANN] Liquid XML Studio Released - A Freeware XML Development Environment Pin
Scott Dorman23-Oct-07 3:23
professionalScott Dorman23-Oct-07 3:23 
QuestionClass for deserializing array Pin
Howard Richards22-Oct-07 4:54
Howard Richards22-Oct-07 4:54 
This is probably a "Doh!" moment...

I had stored some values in an XML file thus:

<?xml ... ?>
<Commands>
<Command ID="test">
<Field>f1</Field>
<Field>f2</Field>
<Field>f3</Field>
<Field>f4</Field>
</Command>
<Command ID="test2">
<Field>f1</Field>
<Field>f2</Field>
<Field>f3</Field>
<Field>f4</Field>
</Command>
</Commands>

I wanted to deserialize these into into a class so I could enumerate each command, and then the string array of fields. Long story short is I got lost in the Xml.Serialization namespace attributes, and gave up.

The root was easy, an [XmlRoot("Commands")] public class Commands which contained a Command array.
However I could not figure out how to get the Command array to return an array of Field[] strings.

Anything like public string Field[] would result in <Field><string>value</string></Field>

In the end I gave up and rewrote the XML by adding an intermediate class Fields
which I could prefix with [XmlArray("Fields"), XmlArrayItem("Field")]..

<?xml ... ?>
<Commands>
<Command ID="test">
<Fields>
<Field>f1</Field>
<Field>f2</Field>
<Field>f3</Field>
<Field>f4</Field>
<Fields>
</Command>
<Command ID="test2">
<Fields>
<Field>f1</Field>
<Field>f2</Field>
<Field>f3</Field>
<Field>f4</Field>
</Fields>
</Command>
</Commands>

But is there a way to achieve the original result??

'Howard
AnswerRe: Class for deserializing array Pin
George L. Jackson22-Oct-07 8:27
George L. Jackson22-Oct-07 8:27 
GeneralRe: Class for deserializing array Pin
Howard Richards22-Oct-07 9:02
Howard Richards22-Oct-07 9:02 
QuestionProblem in linking the xsl file to xml file (when I use FireFox) Pin
Rocky#19-Oct-07 0:16
Rocky#19-Oct-07 0:16 
AnswerRe: Problem in linking the xsl file to xml file (when I use FireFox) Pin
George L. Jackson19-Oct-07 4:31
George L. Jackson19-Oct-07 4:31 
GeneralRe: Problem in linking the xsl file to xml file (when I use FireFox) Pin
Rocky#21-Oct-07 19:55
Rocky#21-Oct-07 19:55 
GeneralRe: Problem in linking the xsl file to xml file (when I use FireFox) Pin
George L. Jackson22-Oct-07 0:55
George L. Jackson22-Oct-07 0:55 
GeneralRe: Problem in linking the xsl file to xml file (when I use FireFox) Pin
Rocky#22-Oct-07 1:23
Rocky#22-Oct-07 1:23 
Questionproblem in javascript Pin
Arihant rathi18-Oct-07 0:50
Arihant rathi18-Oct-07 0:50 
AnswerRe: problem in javascript Pin
Stefan Troschuetz18-Oct-07 1:19
Stefan Troschuetz18-Oct-07 1:19 
QuestionHi Help me Pin
Ragava Yadav17-Oct-07 22:18
Ragava Yadav17-Oct-07 22:18 
QuestionExtra pair of eyes Pin
mango_lier15-Oct-07 12:59
mango_lier15-Oct-07 12:59 
AnswerRe: Extra pair of eyes Pin
Stefan Troschuetz15-Oct-07 21:46
Stefan Troschuetz15-Oct-07 21:46 
GeneralRe: Extra pair of eyes Pin
mango_lier16-Oct-07 6:26
mango_lier16-Oct-07 6:26 
QuestionBuilding a transform to re-structure a XML file Pin
I_AM_A_TULLI15-Oct-07 7:41
I_AM_A_TULLI15-Oct-07 7:41 
QuestionHelp: how to get link addres in the RSS XML file in MFC/C++? Pin
fujoey13-Oct-07 15:42
fujoey13-Oct-07 15:42 
QuestionXML Problem Pin
kkb_200112-Oct-07 2:12
kkb_200112-Oct-07 2:12 
AnswerRe: XML Problem Pin
led mike12-Oct-07 5:06
led mike12-Oct-07 5:06 

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.