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
"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" <GaneshMuthuvelu@discussions.microsoft.com> wrote in
> message news:C81CB0CC-B4BB-4DB5-861A-353ABAB967C4@microsoft.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" <GaneshMuthuvelu@discussions.microsoft.com> wrote in
> >> message news:B26981F5-535D-422F-84D1-94B0634037F7@microsoft.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>
> >> > ***********************
> >>
> >>
> >>
>
>