Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 8th, 2006, 11:55 AM
Peter Morris [Droopy eyes software]
Guest
 
Posts: n/a
Default Tag without endelement

I expect this in my xml
<van id="1234">
<stock level...../>
<stock level..../>
</van>

I do xmlReader.Read(), if the NodeType == XmlNodeType.Element then I call
ImportVanStockLevels(xmlReader);

ImportVanStockLevels will do this
1) read each attribute
2) call xmlReader.Read() until </van> is found

But I have a problem, sometimes the van has no stock, so I receive this

<van id="1234"/>

IsEmptyElement returns false, and HasValue returns true.

How can I detect this situation?

Thanks

Pete



  #2  
Old March 8th, 2006, 12:25 PM
Peter Morris [Droopy eyes software]
Guest
 
Posts: n/a
Default Re: Tag without endelement

Found the answer in Google, just wasn't sure what to search for as knowing
this information would in fact have been my answer (and then I wouldn't have
needed to Google for it) :-)

After using MoveToNextAttribute() for the last time use MoveToElement().
XmlReader will then return the NodeType for the element rather than the
attribute.


Pete


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles