![]() |
xml Nodes Attribute lesen
Ich habe eine BMECAT xml und möchte per TXMLDocument PRICE_FLAG lesen.
Mit s:= LNodeElement_CATALOG.ChildNodes.FindNode('PRICE_FL AG').Text; komme ich an das erste PRICE_FLAG, welches "false" ist. Mit s:= LNodeElement_CATALOG.ChildNodes.FindNode('PRICE_FL AG').AttributeNodes['type'].Text; komme ich an das erste Attribut, welches "incl_assurance" lautet. Wie aber komme ich an die weiteren drei PRICE_FLAG's? <?xml version="1.0" encoding="UTF-8"?> <BMECAT version="2005"> <HEADER> <CATALOG> <LANGUAGE>deu</LANGUAGE> <CATALOG_ID>2021</CATALOG_ID> <CATALOG_VERSION>09</CATALOG_VERSION> <CATALOG_NAME>Produktkatalog</CATALOG_NAME> <TERRITORY>DE</TERRITORY> <CURRENCY>EUR</CURRENCY> <PRICE_FLAG type="incl_assurance">false</PRICE_FLAG> <PRICE_FLAG type="incl_duty">true</PRICE_FLAG> <PRICE_FLAG type="incl_packing">false</PRICE_FLAG> <PRICE_FLAG type="incl_freight">false</PRICE_FLAG> </CATALOG> |
AW: xml Nodes Attribute lesen
Ich würde das anders angehen und durch die Nodes iterieren:
Delphi-Quellcode:
(nicht getestet)
var Node:IXMLNode;
Node:= LNodeElement_CATALOG.ChildNodes.First; while Node<>nil do begin if Node.NodeName = 'PRICE_FLAG' then begin if Node.Attributes['type'] = 'incl_assurance' then ... else if Node.Attributes['type'] = 'incl_duty' then ... end; Node := Node.NextSibling; end; |
AW: xml Nodes Attribute lesen
Danke, funktioniert.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:51 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-2025 by Thomas Breitkreuz