Einzelnen Beitrag anzeigen

Benutzerbild von RWarnecke
RWarnecke

Registriert seit: 31. Dez 2004
Ort: Stuttgart
4.408 Beiträge
 
Delphi XE8 Enterprise
 
#1

XML und Nodes mit HTML Tags

  Alt 5. Dez 2017, 19:06
Hallo zusammen,

ich habe eine einfache XML-Datei. Die versuche ich über himXML zu öffnen. Das funktioniert auch noch, nur wenn ich jetzt versuche einzelne Nodes auszulesen oder mir nur die Anzahl der Nodes wiedergeben will bekomme ich den folgenden Fehler :

---------------------------
Debugger Exception Notification
---------------------------
Project eBayWerkzeugkoffer.exe raised exception class EXMLException with message '[EXMLException] TXMLFile.ParsingTree:
unknown closing tag - node "font" is the last opened, but closing "strong" is found'.
---------------------------
Break Continue Help
---------------------------

Die einzelnen Nodes sind wie folgt aufgebaut :

Code:
<Item>
   <id>63312</id>
   <ApplyShippingDiscount></ApplyShippingDiscount>
   <AttrXML></AttrXML>
   <AutoPay></AutoPay>
   <BuyItNowPrice>0</BuyItNowPrice>
   <Country>DE</Country>
   <Currency></Currency>
   <Description><font rwr='1' size='4' style='font-family:Arial'>
<style>img{max-width:100%}</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<p align="left">
<strong><font color="#ff0010" face="Arial" size="4">Beispieltext</font></strong>
</p>
</font></Description>
   <ExpressOptOut></ExpressOptOut>
   <GetItFast></GetItFast>
</Item>
Wenn ich den HTML-Quelltext aus der Node "Description" entferne, dann funktioniert der folgende Quelltext :
Delphi-Quellcode:
var
  xmlFile: TXMLFile;
  nodeList: TXMLNodeList;
begin
  xmlFile := TXMLFile.Create();
  xmlFile.LoadFromFile(XMLFileName);

  nodeList := xmlFile.Nodes;
  result := IntToStr(nodeList.Count);
end;
XMLFileName ist ein String mit dem Pfad zur XML-Datei. Was muss ich machen, damit das auch mit dem HTML-Quelltext funktioniert ?
Rolf Warnecke
App4Mission
  Mit Zitat antworten Zitat