473,803 Members | 3,534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to handle XML anomalies!

The following XML has an empty <UserDefinedT ag />
My VB.NET app got stuck here because I don't know how to handle it. It works
fine with a vlid user defined tag (next record)

<UserDefinedTag >40320121</UserDefinedTag>

Your help is greatly apprecited!!

Bill

- <JACOData>
- <Inventorys>
- <Inventory Type="Physical" >
<Product>Dyed Diesel</Product>
<TankNumber>150 08230383-1</TankNumber>
<UserDefinedT ag />
<DateTime>1/14/2007 1:00:49 PM</DateTime>
<Volume>308.122 </Volume>
<Ullage>2674.88 </Ullage>
<Height>12</Height>
<WaterHeight>3. 4</WaterHeight>
<DaystoEmpty> 1</DaystoEmpty>
</Inventory>

- <Inventory Type="Physical" >
<Product>Clea r Diesel</Product>
<TankNumber>150 08230411-1</TankNumber>
<UserDefinedTag >40320121</UserDefinedTag>
<DateTime>1/14/2007 12:00:49 PM</DateTime>
<Volume>308.122 </Volume>
<Ullage>5805.88 </Ullage>
<Height>12</Height>
<WaterHeight>-9.44</WaterHeight>
<DaystoEmpty> 0</DaystoEmpty>
</Inventory>
- </Inventory>
</Inventorys>
</JACOData>
Jan 18 '07 #1
3 1078
Bill Nguyen wrote:
The following XML has an empty <UserDefinedT ag />
My VB.NET app got stuck here because I don't know how to handle it. It works
fine with a vlid user defined tag (next record)

<UserDefinedTag >40320121</UserDefinedTag>
Well what exactly does your app with that XML? What goes wrong, do you
get a runtime error? How exactly does your code look?

An empty element is perfectly well-formed XML so the XML parser should
not give any problems.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jan 18 '07 #2
Martin;
The problem is that it doesn't throw any error!
I only want to detect if an element is empty.

Here's the code:

DS.ReadXml(mXML file)

Dim xRow As DataRow

Dim malternateID, mDaystoEmpty As Integer

For i = 0 To DS.Tables(1).Ro ws.Count - 1

malternateID = 0

If IsDBNull(DS.Tab les(1).Rows(i). Item("UserDefin edTag")) = False Then

malternateID = DS.Tables(1).Ro ws(i).Item("Use rDefinedTag")

Else

MsgBox("invalid altID!: " & mtankID)

End If

Thanks

Bill

"Martin Honnen" <ma*******@yaho o.dewrote in message
news:Ov******** ******@TK2MSFTN GP03.phx.gbl...
Bill Nguyen wrote:
>The following XML has an empty <UserDefinedT ag />
My VB.NET app got stuck here because I don't know how to handle it. It
works fine with a vlid user defined tag (next record)

<UserDefinedTag >40320121</UserDefinedTag>

Well what exactly does your app with that XML? What goes wrong, do you get
a runtime error? How exactly does your code look?

An empty element is perfectly well-formed XML so the XML parser should not
give any problems.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Jan 18 '07 #3
Bill Nguyen wrote:
The problem is that it doesn't throw any error!
I only want to detect if an element is empty.
Do you have a schema associated with the XML? An empty element is not an
error in terms of XML and for instance if the type of the element is
xs:string then in case of the empty element the element is not null but
rather contains the emtpy string.
What you can do is use xsi:nil as a special attribute in XML markup e.g.
<UserDefinedT ag xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:nil="true"/>
but then the schema needs to defined that the element is nillable.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jan 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1407
by: clintonG | last post by:
I'm hoping somebody has started a table documenting Firefox rendering anomalies or can refer to this type of document. Neither text nor textboxes are not being sized the same as IE and there are probably other issues. The same appears to be true of Netscape. -- <%= Clinton Gallagher METROmilwaukee "Regional Information Services" NET csgallagher AT metromilwaukee.com
6
2328
by: Tony Proctor | last post by:
Hi everyone We're experiencing some serious anomalies with the scheduling of ASP threads. I'd be interested to hear if anyone knows what algorithm is used (e.g. simple round-robin, or something more sophisticated), and what situations might perturb it. Even a hint as to what would be considered normal scheduling might help. The root of our problem is that we observed a normally well-behaved web application suddenly limit itself to a...
7
3257
by: Tony Johansson | last post by:
Hello!! Assume I have a handle body pattern with classes called Handle and Body. In the Body class I store one int value for example 7 or some other integer value. In the Handle class I have a pointer to the Body class. If a want to create a STL container of List with the following declaration List <Handle <Body> > list
0
2173
by: Tony Johansson | last post by:
Hello! Here I have two classes these are called Handle and Body and a main. You have the class definition below. Some basic information. In the Handle class is there a pointer to the Body. Each Body object contains one primitive datatype int. The Body instance is created in the constructor for Handle. In main I instansiate some Handle object and use the STL function push_front to push these object into the list.
2
3057
by: Indiana Epilepsy and Child Neurology | last post by:
Before asking this questions I've spent literally _years_ reading (Meyer, Stroustrup, Holub), googling, asking more general design questions, and just plain thinking about it. I am truly unable to figure out what would be a "proper" OO design (in C++) for this. There may be alternatives to writing my own ODBC handle classes, and I may be interested in them, but I'd like to pursue this particular problem, if for no other reason than to...
14
2737
by: Howard | last post by:
Hi, I recently had a problem where I decided to store objects in a vector. (Previously, I had always stored pointers in vectors). Well, naturally, when storing an object in a vector, using push_back, the object I had in hand was getting copied (twice, in fact). That led to a problem, in that my object contained a "handle" to another object, and when the object being pushed went out of scope and was destroyed, the referenced object was...
6
2876
by: Leandro Berti via DotNetMonster.com | last post by:
Hi All, I wrote a code to do serial communication with an equipament. When i use the code outside of threaded class it seens work properly, but when i put inside a class and execute a thread in the first seconds the communication is ok, later i receive read/write error. I?ve been in MSDN site and there i discover that the read/write error is a INVALID_HANDLE problem. But why??? I just create the serial communication file and use it....
7
1825
by: Ken Varn | last post by:
I am working in managed C++. I have a Mutex object in which I need to replace the Handle property with a new handle. The new handle is being constructed using Win32 CreateMutex call. I need to call the Win32 version in order to set the security descriptor for the mutex, which is not natively supported in .NET Framework 1.1. I always get a little nervous about resource leaks when trying to bridge Win32 with .NET, so I want to make sure...
2
35635
weaknessforcats
by: weaknessforcats | last post by:
Handle Classes Handle classes, also called Envelope or Cheshire Cat classes, are part of the Bridge design pattern. The objective of the Bridge pattern is to separate the abstraction from the implementation so the two can vary independently. Handle classes usually contain a pointer to the object implementation. The Handle object is used rather than the implemented object. This leaves the implemented object free to change without affecting...
0
9565
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10550
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.