Click here to Skip to main content
14,838,368 members
Home / Discussions / XML / XSL
   

XML / XSL

 
QuestionTools for merging multiple xsd files Pin
cateyes9922-Sep-09 19:03
Membercateyes9922-Sep-09 19:03 
AnswerRe: Tools for merging multiple xsd files Pin
Stuart Dootson24-Sep-09 10:04
professionalStuart Dootson24-Sep-09 10:04 
GeneralRe: Tools for merging multiple xsd files Pin
cateyes9924-Sep-09 16:38
Membercateyes9924-Sep-09 16:38 
AnswerRe: Tools for merging multiple xsd files Pin
Member 248888319-Nov-09 0:30
MemberMember 248888319-Nov-09 0:30 
GeneralRe: Tools for merging multiple xsd files Pin
jepskiluv14-Jan-10 17:30
Memberjepskiluv14-Jan-10 17:30 
GeneralRe: Tools for merging multiple xsd files Pin
cateyes9919-Jan-10 15:14
Membercateyes9919-Jan-10 15:14 
QuestionUse XML code into MS Word 2007 document Pin
Jim Krueger19-Sep-09 6:28
MemberJim Krueger19-Sep-09 6:28 
QuestionReading into XML section and getting same value again Pin
Gareth H19-Sep-09 0:41
MemberGareth H19-Sep-09 0:41 
I am reading in some XML using the below code. The problem is when i attempt to get out the values for each Item, i get the same values again, ie: Debug prints out

Code = A123
Quantity = 10
---
Code = A123
Quantity = 10


using (TextReader textReader = new StringReader(xml))
using (XmlReader xmlReader = new XmlTextReader(textReader))
{
    XPathDocument xPathDocument = new XPathDocument(xmlReader);

    //Create navigator to get nodes out
    XPathNavigator xPathNavigator = xPathDocument.CreateNavigator();
    XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xPathNavigator.NameTable);
    xmlNamespaceManager.AddNamespace("ns", "OrderSchema");

    //Get the order items
    XPathExpression xPathExpressionItems = xPathNavigator.Compile("//ns:Order//ns:Items");
    xPathExpressionItems.SetContext(xmlNamespaceManager);

    XPathNodeIterator xPathNodeIteratorItems = xPathNavigator.Select(xPathExpressionItems);

    do
    {
        string code = xPathNodeIteratorItems.Current.SelectSingleNode("//ns:Code", xmlNamespaceManager).ToString();
        string quantity = xPathNodeIteratorItems.Current.SelectSingleNode("//ns:Quantity", xmlNamespaceManager).ToString();

        System.Diagnostics.Debug.WriteLine("code == " + code);
        System.Diagnostics.Debug.WriteLine("quantity == " + quantity);
        System.Diagnostics.Debug.WriteLine("----");

    }
    while (xPathNodeIteratorItems.MoveNext());
}


Heres the xml i am reading in:

<?xml version="1.0" encoding="UTF-8" ?>
<Order>
	<Items>
		<Item>
			<Code>A123</Code>
			<Quantity>10</Quantity>
		</Item>
		<Item>
			<Code>A456</Code>
			<Quantity>5</Quantity>
		</Item>
	</Items>
</Order>


Any ideas what i am doing wrong?

Regards,
Gareth.

(FKA gareth111)

AnswerRe: Reading into XML section and getting same value again Pin
Stuart Dootson19-Sep-09 22:11
professionalStuart Dootson19-Sep-09 22:11 
AnswerRe: Reading into XML section and getting same value again Pin
Lakhan Pal Garg22-Sep-09 19:08
MemberLakhan Pal Garg22-Sep-09 19:08 
QuestionXSD problem Pin
gantww18-Sep-09 10:09
Membergantww18-Sep-09 10:09 
AnswerRe: XSD problem Pin
Stuart Dootson19-Sep-09 22:04
professionalStuart Dootson19-Sep-09 22:04 
Questionsending xml document Pin
aamirzada16-Sep-09 18:31
Memberaamirzada16-Sep-09 18:31 
AnswerVoted to remove message Pin
N a v a n e e t h16-Sep-09 18:45
MemberN a v a n e e t h16-Sep-09 18:45 
AnswerRe: sending xml document Pin
Stuart Dootson16-Sep-09 21:28
professionalStuart Dootson16-Sep-09 21:28 
GeneralRe: sending xml document Pin
aamirzada25-Sep-09 18:40
Memberaamirzada25-Sep-09 18:40 
GeneralRe: sending xml document Pin
Stuart Dootson25-Sep-09 19:04
professionalStuart Dootson25-Sep-09 19:04 
QuestionXML Validation using XSD Pin
scrapper15-Sep-09 4:00
Memberscrapper15-Sep-09 4:00 
AnswerRe: XML Validation using XSD Pin
Stuart Dootson15-Sep-09 7:12
professionalStuart Dootson15-Sep-09 7:12 
GeneralRe: XML Validation using XSD Pin
scrapper16-Sep-09 3:32
Memberscrapper16-Sep-09 3:32 
GeneralRe: XML Validation using XSD Pin
Stuart Dootson16-Sep-09 3:39
professionalStuart Dootson16-Sep-09 3:39 
GeneralRe: XML Validation using XSD Pin
scrapper16-Sep-09 3:44
Memberscrapper16-Sep-09 3:44 
GeneralRe: XML Validation using XSD Pin
Stuart Dootson16-Sep-09 21:27
professionalStuart Dootson16-Sep-09 21:27 
QuestionMSXML2.serverXMLHTTP.4.0 Pin
hemrk14-Sep-09 6:11
Memberhemrk14-Sep-09 6:11 
QuestionMicrosoft VBScript runtime error '800a01a8' Object required Pin
shyamaprasad10-Sep-09 4:38
Membershyamaprasad10-Sep-09 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.