By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,938 Members | 1,578 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,938 IT Pros & Developers. It's quick & easy.

Reading a COMPLEX CONTENT : Stan Can you help?

P: n/a
Hi STAN,
Stan: Thanks for your response to my previous post on reading a XSD file
using your article in
"https://blogs.msdn.com/stan_kitsis/archive/2005/08/06/448572.aspx".

it works quite well but I have one problem.. I am not able to read a Complex
Content.. Here is a portion of the XSD that contains the complex content. I
need to read the elements under it and could not get an handle to it..

Could you please help?

Thanks,
Ganesh
***********************
<xs:complexType name="UserBasic">
<xs:complexContent mixed="false">
<xs:extension base="core:OCIDataResponse">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="placed"
type="BasicLogEntry" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="received"
type="BasicLogEntry" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="missed"
type="BasicLogEntry" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
***********************
Jan 12 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Ganesh,

Try this:

XmlSchemaType type;

// type = ...

if (type is XmlSchemaComplexType)

{

XmlSchemaComplexType ct = type as XmlSchemaComplexType;

if (ct.ContentModel is XmlSchemaSimpleContent)

{

// simple content processing

}

else

{

if (ct.ContentModel is XmlSchemaComplexContent)

{

// complex content processing

}

// particle processing

XmlSchemaParticle particle = null;

if (ct.ContentModel == null)

particle = ct.Particle;

else

{

if (ct.ContentModel.Content is XmlSchemaComplexContentExtension)

{

XmlSchemaComplexContentExtension xscce =
ct.ContentModel.Content as XmlSchemaComplexContentExtension;

particle = xscce.Particle;

}

else if (ct.ContentModel.Content is
XmlSchemaComplexContentRestriction)

{

XmlSchemaComplexContentRestriction xsccr =
ct.ContentModel.Content as XmlSchemaComplexContentRestriction;

particle = xsccr.Particle;

}

}

// particle processing code

}

}
--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Ganesh Muthuvelu" <Ga*************@discussions.microsoft.com> wrote in
message news:B2**********************************@microsof t.com...
Hi STAN,
Stan: Thanks for your response to my previous post on reading a XSD file
using your article in
"https://blogs.msdn.com/stan_kitsis/archive/2005/08/06/448572.aspx".

it works quite well but I have one problem.. I am not able to read a
Complex
Content.. Here is a portion of the XSD that contains the complex content.
I
need to read the elements under it and could not get an handle to it..

Could you please help?

Thanks,
Ganesh
***********************
<xs:complexType name="UserBasic">
<xs:complexContent mixed="false">
<xs:extension base="core:OCIDataResponse">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="placed"
type="BasicLogEntry" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="received"
type="BasicLogEntry" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="missed"
type="BasicLogEntry" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
***********************

Jan 12 '06 #2

P: n/a
Hi Stan,
Thanks for the reply.It works well. Basically, I am reading the XSD file and
representing the XSD in a Tree View (with nodes of all the elements) in a
..NET application. The problem that I have now is that the Tree works well but
the nodes do not appear in the same order as they appear in the XSD file.
They are in any order. Do you know I could solve this?. I am creating the
nodes in the same way that you have the "recursive" calling of the "WalkThe
Particle" sub.

Thanks for your time.
Ganesh
"Stan Kitsis [MSFT]" wrote:
Ganesh,

Try this:

XmlSchemaType type;

// type = ...

if (type is XmlSchemaComplexType)

{

XmlSchemaComplexType ct = type as XmlSchemaComplexType;

if (ct.ContentModel is XmlSchemaSimpleContent)

{

// simple content processing

}

else

{

if (ct.ContentModel is XmlSchemaComplexContent)

{

// complex content processing

}

// particle processing

XmlSchemaParticle particle = null;

if (ct.ContentModel == null)

particle = ct.Particle;

else

{

if (ct.ContentModel.Content is XmlSchemaComplexContentExtension)

{

XmlSchemaComplexContentExtension xscce =
ct.ContentModel.Content as XmlSchemaComplexContentExtension;

particle = xscce.Particle;

}

else if (ct.ContentModel.Content is
XmlSchemaComplexContentRestriction)

{

XmlSchemaComplexContentRestriction xsccr =
ct.ContentModel.Content as XmlSchemaComplexContentRestriction;

particle = xsccr.Particle;

}

}

// particle processing code

}

}
--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Ganesh Muthuvelu" <Ga*************@discussions.microsoft.com> wrote in
message news:B2**********************************@microsof t.com...
Hi STAN,
Stan: Thanks for your response to my previous post on reading a XSD file
using your article in
"https://blogs.msdn.com/stan_kitsis/archive/2005/08/06/448572.aspx".

it works quite well but I have one problem.. I am not able to read a
Complex
Content.. Here is a portion of the XSD that contains the complex content.
I
need to read the elements under it and could not get an handle to it..

Could you please help?

Thanks,
Ganesh
***********************
<xs:complexType name="UserBasic">
<xs:complexContent mixed="false">
<xs:extension base="core:OCIDataResponse">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="placed"
type="BasicLogEntry" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="received"
type="BasicLogEntry" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="missed"
type="BasicLogEntry" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
***********************


Jan 13 '06 #3

P: n/a
I'm not sure what you're saying. Are the globals not ordered properly or
are you saying elements in a sequence are randomly ordered?

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Ganesh Muthuvelu" <Ga*************@discussions.microsoft.com> wrote in
message news:C8**********************************@microsof t.com...
Hi Stan,
Thanks for the reply.It works well. Basically, I am reading the XSD file
and
representing the XSD in a Tree View (with nodes of all the elements) in a
.NET application. The problem that I have now is that the Tree works well
but
the nodes do not appear in the same order as they appear in the XSD file.
They are in any order. Do you know I could solve this?. I am creating the
nodes in the same way that you have the "recursive" calling of the
"WalkThe
Particle" sub.

Thanks for your time.
Ganesh
"Stan Kitsis [MSFT]" wrote:
Ganesh,

Try this:

XmlSchemaType type;

// type = ...

if (type is XmlSchemaComplexType)

{

XmlSchemaComplexType ct = type as XmlSchemaComplexType;

if (ct.ContentModel is XmlSchemaSimpleContent)

{

// simple content processing

}

else

{

if (ct.ContentModel is XmlSchemaComplexContent)

{

// complex content processing

}

// particle processing

XmlSchemaParticle particle = null;

if (ct.ContentModel == null)

particle = ct.Particle;

else

{

if (ct.ContentModel.Content is
XmlSchemaComplexContentExtension)

{

XmlSchemaComplexContentExtension xscce =
ct.ContentModel.Content as XmlSchemaComplexContentExtension;

particle = xscce.Particle;

}

else if (ct.ContentModel.Content is
XmlSchemaComplexContentRestriction)

{

XmlSchemaComplexContentRestriction xsccr =
ct.ContentModel.Content as XmlSchemaComplexContentRestriction;

particle = xsccr.Particle;

}

}

// particle processing code

}

}
--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Ganesh Muthuvelu" <Ga*************@discussions.microsoft.com> wrote in
message news:B2**********************************@microsof t.com...
> Hi STAN,
> Stan: Thanks for your response to my previous post on reading a XSD
> file
> using your article in
> "https://blogs.msdn.com/stan_kitsis/archive/2005/08/06/448572.aspx".
>
> it works quite well but I have one problem.. I am not able to read a
> Complex
> Content.. Here is a portion of the XSD that contains the complex
> content.
> I
> need to read the elements under it and could not get an handle to it..
>
> Could you please help?
>
> Thanks,
> Ganesh
>
>
> ***********************
> <xs:complexType name="UserBasic">
> <xs:complexContent mixed="false">
> <xs:extension base="core:OCIDataResponse">
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="placed"
> type="BasicLogEntry" />
> <xs:element minOccurs="0" maxOccurs="unbounded"
> name="received"
> type="BasicLogEntry" />
> <xs:element minOccurs="0" maxOccurs="unbounded" name="missed"
> type="BasicLogEntry" />
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> ***********************


Jan 17 '06 #4

P: n/a
If I draw a tree with all the nodes (for each element), the tree does not
represent the XSD in the same order as they appear in the actual file. The
elements are are in random.

Thanks,
Ganesh

"Stan Kitsis [MSFT]" wrote:
I'm not sure what you're saying. Are the globals not ordered properly or
are you saying elements in a sequence are randomly ordered?

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Ganesh Muthuvelu" <Ga*************@discussions.microsoft.com> wrote in
message news:C8**********************************@microsof t.com...
Hi Stan,
Thanks for the reply.It works well. Basically, I am reading the XSD file
and
representing the XSD in a Tree View (with nodes of all the elements) in a
.NET application. The problem that I have now is that the Tree works well
but
the nodes do not appear in the same order as they appear in the XSD file.
They are in any order. Do you know I could solve this?. I am creating the
nodes in the same way that you have the "recursive" calling of the
"WalkThe
Particle" sub.

Thanks for your time.
Ganesh
"Stan Kitsis [MSFT]" wrote:
Ganesh,

Try this:

XmlSchemaType type;

// type = ...

if (type is XmlSchemaComplexType)

{

XmlSchemaComplexType ct = type as XmlSchemaComplexType;

if (ct.ContentModel is XmlSchemaSimpleContent)

{

// simple content processing

}

else

{

if (ct.ContentModel is XmlSchemaComplexContent)

{

// complex content processing

}

// particle processing

XmlSchemaParticle particle = null;

if (ct.ContentModel == null)

particle = ct.Particle;

else

{

if (ct.ContentModel.Content is
XmlSchemaComplexContentExtension)

{

XmlSchemaComplexContentExtension xscce =
ct.ContentModel.Content as XmlSchemaComplexContentExtension;

particle = xscce.Particle;

}

else if (ct.ContentModel.Content is
XmlSchemaComplexContentRestriction)

{

XmlSchemaComplexContentRestriction xsccr =
ct.ContentModel.Content as XmlSchemaComplexContentRestriction;

particle = xsccr.Particle;

}

}

// particle processing code

}

}
--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Ganesh Muthuvelu" <Ga*************@discussions.microsoft.com> wrote in
message news:B2**********************************@microsof t.com...
> Hi STAN,
> Stan: Thanks for your response to my previous post on reading a XSD
> file
> using your article in
> "https://blogs.msdn.com/stan_kitsis/archive/2005/08/06/448572.aspx".
>
> it works quite well but I have one problem.. I am not able to read a
> Complex
> Content.. Here is a portion of the XSD that contains the complex
> content.
> I
> need to read the elements under it and could not get an handle to it..
>
> Could you please help?
>
> Thanks,
> Ganesh
>
>
> ***********************
> <xs:complexType name="UserBasic">
> <xs:complexContent mixed="false">
> <xs:extension base="core:OCIDataResponse">
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="placed"
> type="BasicLogEntry" />
> <xs:element minOccurs="0" maxOccurs="unbounded"
> name="received"
> type="BasicLogEntry" />
> <xs:element minOccurs="0" maxOccurs="unbounded" name="missed"
> type="BasicLogEntry" />
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> ***********************


Jan 17 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.