Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   XML (https://www.delphipraxis.net/46-xml/)
-   -   C# HasAttributes liefert False, obwohl Attribut vorhanden (https://www.delphipraxis.net/114880-hasattributes-liefert-false-obwohl-attribut-vorhanden.html)

Luckie 2. Jun 2008 11:24


HasAttributes liefert False, obwohl Attribut vorhanden
 
Folgende XML:
XML-Code:
<?xml version="1.0" encoding="UTF-8"?>
<businessRelationship id="1">
    <businessSupplier id="1">
Und kein Code:
Code:
public void Load(string BRFile)
        {
            _xmlFile = BRFile;                      
            try
            {
                _pathDocument = new XPathDocument(_xmlFile);
                XPathNavigator _nav = _pathDocument.CreateNavigator();
                if (_nav.SelectSingleNode("businessRelationship") != null)
                {                   
                    if (_nav.HasAttributes)
                    {
                       
                    }
                }
                _bsi = new BusinessSupplierItem(_pathDocument);
                _bsi.GetDetails();
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
Warum liefert if (_nav.HasAttributes) false, obwohl ein Attribut vorhanden ist?

Khabarakh 2. Jun 2008 12:21

Re: HasAttributes liefert False, obwohl Attribut vorhanden
 
Dass SelectSingleNode null zurück gibt, wenn der Knoten nicht vorhanden ist, hast du ja erkannt. Was aber bekommst du zurück, wenn der Knoten vorhanden ist :zwinker: ?

[edit]Knoten <-> Konten, wirklich nicht einfach... [/edit]

Luckie 2. Jun 2008 12:26

Re: HasAttributes liefert False, obwohl Attribut vorhanden
 
Ich glaube, ich weiß, was ich falsch mache. danke für den Hinweis.


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:36 Uhr.

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