Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

xml Node verschieben

Empfohlene Antworten

Veröffentlicht

Hallo.

Also ich hab 2 xml-dokumente.

xmlDoc1.xml und xmlDoc2.xml

Die beiden Elemente haben beide den seleben Aufbau und auch die Nodes sind Identisch

Nun möchte ich eine Node von xmlDoc1.xml nach xmlDoc2.xml verschieben.

Wenn ich nun: (node kommt aus dem ersten XML)


XmlDocument doc = new XmlDocument();

doc.Load( path2xmlDoc2);

doc.AppendChild( node)

Bekomme ich eine Exception, die da lautet:

Der einzufügende Knoten stammt aus einem anderen Dokumentenkontext.

Wie kann ich es nun machen, dass ich die Node in das 2te XML einfüge???

Hi,

aus der Javawelt kenne ich das Problem. Schau mal ob es ein "importNode" gibt. Ansonsten vielleicht auch mal detach oder so.

Viele Grüße,

riot

  • Autor

Es gibt ein ImportNode, aber wenn ich dann:


XmlNode newNode = doc.ImportNode(node, false);

doc.AppendChild(newNode);

mache, dann bekomme ich wieder eine Exception:

Das Dokument verfügt bereits über einen 'DocumentElement'-Knoten.

Es gibt ein ImportNode, aber wenn ich dann:

mache, dann bekomme ich wieder eine Exception:


Das Dokument verfügt bereits über einen 'DocumentElement'-Knoten.

Beide XML-Files sind doch identisch, somit existiert die importierte Node doch auch schon.

Du musst den Inhalt der Node verschieben...

  • Autor

Ups, da is mir in der beschreibung ein kleiner Fehler unterlaufen...

Die Inhalte sind nicht identisch, sondern nur der Aufbau der nodes:

Quasi


<ITEM ID = "000">

<VALUE>text</VALUE>

<VALUE2>test</VALUE>

</ITEM>

...

:upps

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.