Click here to Skip to main content
15,914,013 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralChanging the prolog of XML document Pin
Bash24-Feb-04 5:30
Bash24-Feb-04 5:30 
GeneralUpdated question: Changing the prolog of XML document Pin
Bash24-Feb-04 5:34
Bash24-Feb-04 5:34 
GeneralRe: Updated question: Changing the prolog of XML document Pin
Rebreath27-Feb-04 11:01
Rebreath27-Feb-04 11:01 
QuestionHow to pass multiple values for a param to xsl? Pin
vedbu23-Feb-04 9:59
vedbu23-Feb-04 9:59 
AnswerRe: How to pass multiple values for a param to xsl? Pin
Philip Fitzsimons24-Feb-04 3:23
Philip Fitzsimons24-Feb-04 3:23 
Generalcdata-section-elements Pin
mtone23-Feb-04 5:57
mtone23-Feb-04 5:57 
Generalreading xml schema Pin
Andy H20-Feb-04 5:56
Andy H20-Feb-04 5:56 
GeneralRe: reading xml schema Pin
ian mariano22-Feb-04 11:33
ian mariano22-Feb-04 11:33 
Learn a little about XPATH queries. The System.Xml.XmlDocument class supports a method, SelectSingleNode which you would use to get to the specific <OuterList> node. Am I correct in thinking you have some kind of identifier for your <OuterList> nodes? If you have an id attribute or something you could use SelectSingleNode to get the node with that specific id. For example, say you have your Xml doc with the <OuterList id="124">. You can get that node as follows:

//   C# -- one way to load the Xml...
XmlDocument   doc = new XmlDocument();
doc.LoadXml([doc string here]);   //   or you can use doc.Load([path to doc file]);  (See <a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemXmlXmlDocumentClassLoadTopic.asp?frame=true" target="_blank">XmlDocument.Load</a>)
XmlNode   outerListNode = doc.SelectSingleNode("descendant::OuterList[@id='124']");   //   this next line selects the node you're interested in


Once you have the node, you can further use SelectSingleNode to get another node underneath that you're interested in, such it's child <ListImage> element, e.g., XmlNode listImageNode = outerListNode.SelectSingleNode("descendant::ListItem") and grab the image attribute by listImageNode.Attributes["image"].Value -- of course, checking for nulls and errors all the while Wink | ;) -- Never forget error checking!

Alternatively, you can just iterate through the outerListNode.<a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemxmlxmlnodeclasschildnodestopic.asp?frame=true" target="_blank">ChildNodes</a> and handle it as you encounter them (in a foreach loop.) This approach, however, is overkill for your case.

Another alternative is to create a class structure using Xml Serialization and the XmlSerializer. This way you can handle the <OuterList> items as part of an object collection in your document representation class.

There are several ways to approach this using .NET. I suggest you peruse the MSDN dox, as well as articles here.

Good Luck!

Ian Mariano - http://www.ian-space.com/


"We are all wave equations in the information matrix of the universe" - me

Generalnesting XML tags Pin
Hesham Amin18-Feb-04 22:58
Hesham Amin18-Feb-04 22:58 
GeneralRe: nesting XML tags Pin
ian mariano22-Feb-04 11:42
ian mariano22-Feb-04 11:42 
GeneralRead XSD from embedded resource with VB.NET Pin
mpalmer7818-Feb-04 9:51
mpalmer7818-Feb-04 9:51 
GeneralRe: Read XSD from embedded resource with VB.NET Pin
ian mariano22-Feb-04 11:55
ian mariano22-Feb-04 11:55 
GeneralADVANCE MACRO Pin
hyperrobster18-Feb-04 2:15
hyperrobster18-Feb-04 2:15 
GeneralC# XML App heirarchy Pin
HologramStudios16-Feb-04 5:29
HologramStudios16-Feb-04 5:29 
GeneralXML in C# Pin
rasarit1713-Feb-04 8:32
rasarit1713-Feb-04 8:32 
GeneralRe: XML in C# Pin
Tom Larsen13-Feb-04 9:07
Tom Larsen13-Feb-04 9:07 
GeneralRe: XML in C# Pin
Not Active13-Feb-04 9:50
mentorNot Active13-Feb-04 9:50 
Generalschema location / nonamespaceSchema Pin
Larry102412-Feb-04 22:46
Larry102412-Feb-04 22:46 
QuestionCan u suggest me an Efficient XML parser?? Pin
P_JAYAPRAKASH12-Feb-04 19:46
P_JAYAPRAKASH12-Feb-04 19:46 
AnswerRe: Can u suggest me an Efficient XML parser?? Pin
Member 87353013-Feb-04 6:08
Member 87353013-Feb-04 6:08 
AnswerRe: Can u suggest me an Efficient XML parser?? Pin
Member 87353013-Feb-04 6:08
Member 87353013-Feb-04 6:08 
GeneralRe: Can u suggest me an Efficient XML parser?? Pin
P_JAYAPRAKASH15-Feb-04 22:09
P_JAYAPRAKASH15-Feb-04 22:09 
Generalautomatically generate xml sample files from xml schema Pin
Anonymous11-Feb-04 3:46
Anonymous11-Feb-04 3:46 
GeneralRe: automatically generate xml sample files from xml schema Pin
Not Active11-Feb-04 7:18
mentorNot Active11-Feb-04 7:18 
GeneralRe: automatically generate xml sample files from xml schema Pin
Anonymous13-Feb-04 4:38
Anonymous13-Feb-04 4:38 

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.