Hi I m no a pro but probably at the line: sourceCursor.moveXmlContents(targetCursor); your sourceCursor is one tag to bottom so you have to to something like: sourceCursor.toParent(); sourceCursor.moveXmlContents(targetCursor);
I hope that will help Marouane On Sun, 2006-04-30 at 01:57, Christian Schweers wrote: > Hi all, > > how can i move Xml content? > > Here is my xml document sample. > > <content> > <Media> > <Title>Mov1</Title> > <MediaType>DVD</MediaType> > </Media> > <Media> > <Title>Mov2</Title> > <MediaType>DVD</MediaType> > </Media> > <Media> > <Title>Mov3</Title> > <MediaType>DVD</MediaType> > </Media> > <Media> > <Title>Mov4</Title> > <MediaType>DVD</MediaType> > </Media> > </content> > > The challenge is to move the "Media" Tag with Title Mov4 to position one! > > Looks like this: > > <content> > <Media> > <Title>Mov4</Title> > <MediaType>DVD</MediaType> > </Media> > <Media> > <Title>Mov1</Title> > <MediaType>DVD</MediaType> > </Media> > <Media> > <Title>Mov2</Title> > <MediaType>DVD</MediaType> > </Media> > <Media> > <Title>Mov3</Title> > <MediaType>DVD</MediaType> > </Media> > </content> > > How can i do this? > > The following doesn't work :( > > XmlCursor sourceCursor = xml.newCursor(); > searchPath = "Media[Title='Mov4']"; > sourceCursor.selectPath(searchPath); > > XmlCursor targetCursor = xml.newCursor(); > searchPath = "Media[Title='Mov1']"; > targetCursor.selectPath(searchPath); > > sourceCursor.moveXmlContents(targetCursor) ---> Error: Can't insert > before the start of the document. > sourceCursorCursor.moveXml(targetCursor) ---> Error: Can't > move/copy/insert a whole document. > > I hope someone can help me. > > Thanks in advance. > > Christian > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

