Click here to Skip to main content
15,908,437 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Of nodes or attributes Pin
Igor Sukhov28-Jun-06 14:11
Igor Sukhov28-Jun-06 14:11 
GeneralRe: Of nodes or attributes Pin
Malcolm Smart28-Jun-06 21:28
Malcolm Smart28-Jun-06 21:28 
Questionhow to get current date and time in XSL FO Pin
Rizwan Bashir26-Jun-06 23:23
Rizwan Bashir26-Jun-06 23:23 
AnswerRe: how to get current date and time in XSL FO Pin
Dustin Metzgar29-Jun-06 9:05
Dustin Metzgar29-Jun-06 9:05 
AnswerRe: how to get current date and time in XSL FO Pin
Dustin Metzgar29-Jun-06 9:10
Dustin Metzgar29-Jun-06 9:10 
QuestionXML Encryption [modified] Pin
Zahid Nashi26-Jun-06 6:39
Zahid Nashi26-Jun-06 6:39 
QuestionMultiple XML Tables In one File [modified] Pin
PBS_LKI26-Jun-06 3:08
PBS_LKI26-Jun-06 3:08 
QuestionUpdating attributes using XPathNavigator Pin
Malcolm Smart26-Jun-06 2:54
Malcolm Smart26-Jun-06 2:54 
Hi
I want to simply swap two attributes of different nodes over but can't seem to 'write' to the xml doc..

int swapPos1 = 8;//hard coded, but they do exist in the schema
int swapPos2 = 9;

System.Xml.XPath.XPathDocument xml = new System.Xml.XPath.XPathDocument("myxml.xml");

        System.Xml.XPath.XPathNavigator xmlNav = xml.CreateNavigator();

        System.Xml.XPath.XPathExpression expr = xmlNav.Compile("/Tabs/Tab");

        expr.AddSort("@position", System.Xml.XPath.XmlSortOrder.Ascending, System.Xml.XPath.XmlCaseOrder.None, "", System.Xml.XPath.XmlDataType.Text);

        System.Xml.XPath.XPathNodeIterator iterator = xmlNav.Select(expr);

        while (iterator.MoveNext())
        {
            int pos = int.Parse( iterator.Current.GetAttribute("position", "").ToString() );
            if (pos == swapPos1)
            {
                iterator.Current.MoveToAttribute("position" , "");
                iterator.Current.SetTypedValue( swapPos2.ToString() );
                continue;
            }

            if (pos == swapPos2)
            {
                iterator.Current.MoveToAttribute("position", "");
                iterator.Current.SetTypedValue ( swapPos1.ToString());
                continue;
            }
        }


The SetTypeVAlue throws - not supported' exception. Basically, I want to swap the position attribute of two nodes.

Any help much appreciated. Not just new to XML, but to C# as well!


Regards

Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
AnswerRe: Updating attributes using XPathNavigator Pin
Malcolm Smart26-Jun-06 22:33
Malcolm Smart26-Jun-06 22:33 
GeneralRe: Updating attributes using XPathNavigator Pin
Igor Sukhov27-Jun-06 20:01
Igor Sukhov27-Jun-06 20:01 
Questionxml schema Pin
alwz_nikhil25-Jun-06 22:50
alwz_nikhil25-Jun-06 22:50 
Questionxml transformation Pin
c0724-Jun-06 0:24
c0724-Jun-06 0:24 
QuestionXML data parsing Pin
bemahesh22-Jun-06 8:37
bemahesh22-Jun-06 8:37 
AnswerRe: XML data parsing Pin
Dustin Metzgar22-Jun-06 9:39
Dustin Metzgar22-Jun-06 9:39 
GeneralRe: XML data parsing Pin
bemahesh22-Jun-06 10:22
bemahesh22-Jun-06 10:22 
GeneralRe: XML data parsing Pin
Dustin Metzgar22-Jun-06 10:33
Dustin Metzgar22-Jun-06 10:33 
GeneralRe: XML data parsing [modified] Pin
bemahesh22-Jun-06 10:38
bemahesh22-Jun-06 10:38 
GeneralRe: XML data parsing Pin
Dustin Metzgar22-Jun-06 12:25
Dustin Metzgar22-Jun-06 12:25 
GeneralRe: XML data parsing Pin
bemahesh23-Jun-06 6:07
bemahesh23-Jun-06 6:07 
GeneralRe: XML data parsing Pin
Dustin Metzgar23-Jun-06 6:20
Dustin Metzgar23-Jun-06 6:20 
QuestionACCESS NESTED XML FILES Pin
MODI_RAHUL22-Jun-06 1:39
MODI_RAHUL22-Jun-06 1:39 
AnswerRe: ACCESS NESTED XML FILES Pin
Dustin Metzgar23-Jun-06 6:17
Dustin Metzgar23-Jun-06 6:17 
QuestionSearch a String Pin
david boon21-Jun-06 2:26
david boon21-Jun-06 2:26 
QuestionAccessing attributes without knowing there names Pin
sweep12321-Jun-06 0:27
sweep12321-Jun-06 0:27 
AnswerRe: Accessing attributes without knowing there names Pin
Elina Blank21-Jun-06 4:30
sitebuilderElina Blank21-Jun-06 4:30 

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.