XmlSchemaParticle.EmptyParticle

This is a multi-part message in MIME format.

------=_NextPart_000_0232_01C7EA57.1C70D740
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi

I'm currently trying to create a dataset from an xml schema (.xsd).
(I'm unable to use XSD.exe due to the format of our xml).

I have come across a problem while traversing down the schema tree.
When I encounter an XmlSchemaComplexType I want to detect if the =
Particle or ContentParticleType =3D EmptyParticle.
However, I am unable to do this due to EmptyParticle being an internal =
class to XmlSchemaParticle.
Comparing it with null doesn't work - because the EmptyParticle is not =
the same as null.

Can anyone point me in the right direction to get this snippet of code =
to work correctly ?


XmlSchemaComplexType ct;    // This is assigned a valid object elsewhere

if (ct.Particle !=3D XmlSchemaParticle.EmptyParticle || =
ct.ContentTypeParticle !=3D null)
{
    XmlSchemaParticle p =3D ct.Particle;
    if (ct.ContentTypeParticle !=3D null)
    {
        p =3D ct.ContentTypeParticle;
    }
}



Cheers

--=20
Ged Moretta
Senior Software Engineer
AppSense Ltd
www.appsense.com

-----------------------------------------------------------------------
This signature isn't automatic. I have to type it manually every time.
------=_NextPart_000_0232_01C7EA57.1C70D740
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16527" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm currently trying to create a =
dataset from an=20
xml schema (.xsd).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>(I'm unable to use XSD.exe due to the =
format of our=20
xml).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have come across a problem while =
traversing down=20
the schema tree.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>When I encounter an =
XmlSchemaComplexType I want to=20
detect if the Particle or ContentParticleType =3D =
EmptyParticle.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>However, I am unable to do this due to=20
EmptyParticle being an internal class to XmlSchemaParticle.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Comparing it with null doesn't work - =
because the=20
EmptyParticle is not the same as null.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Can anyone point me in the right =
direction to get=20
this snippet of code to work correctly ?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>XmlSchemaComplexType =
ct;&nbsp;&nbsp;&nbsp; // This=20
is assigned a valid object elsewhere</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV><FONT face=3DArial =
size=3D2><FONT=20
size=3D2>
<DIV></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> =
(ct.Particle !=3D=20
</FONT><FONT color=3D#2b91af size=3D2>XmlSchemaParticle</FONT><FONT=20
size=3D2>.EmptyParticle || ct.ContentTypeParticle !=3D </FONT><FONT =
color=3D#0000ff=20
size=3D2>null</FONT><FONT size=3D2>)</FONT></DIV>
<DIV><FONT size=3D2>{</DIV>
<DIV></FONT><FONT color=3D#2b91af size=3D2>&nbsp;&nbsp;&nbsp;=20
XmlSchemaParticle</FONT><FONT size=3D2> p =3D ct.Particle;</DIV>
<DIV></FONT><FONT color=3D#0000ff size=3D2>&nbsp;&nbsp;&nbsp; =
if</FONT><FONT size=3D2>=20
(ct.ContentTypeParticle !=3D </FONT><FONT color=3D#0000ff =
size=3D2>null</FONT><FONT=20
size=3D2>)</DIV>
<DIV>&nbsp;&nbsp;&nbsp; {</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p =3D=20
ct.ContentTypeParticle;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></FONT></FONT>
<DIV><FONT face=3DArial size=3D2>Cheers</FONT></DIV><FONT face=3DArial =
size=3D2>
<DIV><BR>-- <BR>Ged Moretta<BR>Senior Software Engineer<BR>AppSense =
Ltd</DIV>
<DIV><A href=3D"http://www.appsense.com">www.appsense.com</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>--------------------------------------------------------------------=
---<BR>This=20
signature isn't automatic. I have to type it manually every=20
time.</FONT></DIV></BODY></HTML>

------=_NextPart_000_0232_01C7EA57.1C70D740--

0
Ged
8/29/2007 3:10:26 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
936 Views

Similar Articles

[PageSpeed] 17

Reply:

Similar Artilces:

XmlSchemaParticle
I am trying to traverse a schema to learn how to use the SOM. I am pretty far into the schema tree but have found a small problem I can't seem to figure out. I have a group reference as one of the sequenced elements. When creating my text report I get the information about all of the elements inside the group but it seems as though the group name is nowhere to be found when going down through the tree. I am assuming that I am not seeing something correctly when recursively looking through the XmlSchemaParticles but I just can't seem to find it. It's as though the particles only...

XmlSchemaParticle.EmptyParticle
This is a multi-part message in MIME format. ------=_NextPart_000_0232_01C7EA57.1C70D740 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi I'm currently trying to create a dataset from an xml schema (.xsd). (I'm unable to use XSD.exe due to the format of our xml). I have come across a problem while traversing down the schema tree. When I encounter an XmlSchemaComplexType I want to detect if the = Particle or ContentParticleType =3D EmptyParticle. However, I am unable to do this due to EmptyParticle being an internal = class to ...