Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   .NET-Framework (managed code) (https://www.delphipraxis.net/79-net-framework-managed-code/)
-   -   Delphi Problem bei Nutzung von XDocument (https://www.delphipraxis.net/215030-problem-bei-nutzung-von-xdocument.html)

DerMondistunsereSonne 25. Apr 2024 12:37

Problem bei Nutzung von XDocument
 
Moin,

In einer C#.DLL wird eine xml mit der XDocument Klasse erstellt. Versuche ich nun das Ergebnis als WideString in Delphi auszugeben, erhalten ich die Meldung, dass keine Objektinstanz festgelegt wurde.

Code:
public string ReturnXLM()

    XDocument doc = new XDocument(fancyStuff);
    return doc.ToString();
}
Hat da zufällig jemand eine Idee zu?

Sinspin 25. Apr 2024 15:46

AW: Problem bei Nutzung von XDocument
 
Und wo kommt die Meldung? In C#? In Delphi? An welcher Zeile?
Hast du nachgesehen was in dem String wirklich drinne steht?

himitsu 25. Apr 2024 16:00

AW: Problem bei Nutzung von XDocument
 
Arbeitet das XMLDocument asynchron und ist noch garnicht fertig mit dem Laden?

DerMondistunsereSonne 26. Apr 2024 06:44

AW: Problem bei Nutzung von XDocument
 
Ich vermute gerade den Fehler gerade noch im C# Teil, muss aber erst noch was schauen und melde mich dann.

DeddyH 26. Apr 2024 09:38

AW: Problem bei Nutzung von XDocument
 
Hm...
Zitat:

Zitat von https://learn.microsoft.com/en-us/dotnet/api/system.xml.linq.xdocument.-ctor?view=net-8.0#system-xml-linq-xdocument-ctor(system-object())
Remarks
There are not many scenarios that require you to create an XDocument. Instead, you can usually create your XML trees with an XElement root node. Unless you have a specific requirement to create a document (for example, because you have to create processing instructions and comments at the top level, or you have to support document types), it is often more convenient to use XElement as your root node.


DerMondistunsereSonne 26. Apr 2024 11:30

AW: Problem bei Nutzung von XDocument
 
Das Problem lag im FancyCode, dort wurde ein Objekt vergessen vorher zu füllen.Trotzdem danke!


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:37 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz