DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 15 Aug 2007 14:50:23 -0400,    posted on: microsoft.public.dotnet.framework        back       

Thread Index
  1    Quinn
          2    John Saunders [MVP] john.saunders at trizetto.com


How to list element names from an xml schema   
if I have a schema like this:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="Root">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Version" type="xsd:string"/>
        <xsd:element name="VerDate" type="xsd:date"/>
        <xsd:element minOccurs="0" maxOccurs="unbounded" 
name="SoftwareInfo">
          <xsd:complexType>
            <xsd:sequence>
            <xsd:element name="No" type="xsd:integer"/>
            <xsd:element name="Type" type="xsd:string"/>
            <xsd:element name="Name" type="xsd:decimal" />
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
         </xsd:element>
</xsd:schema>


How do I loop through each element and print something like this:

Root
Version
Verdate
....

Thanks.
Date:Wed, 15 Aug 2007 14:50:23 -0400   Author:  

Re: How to list element names from an xml schema   
"Quinn"  wrote in message 
news:uX$Gl023HHA.5316@TK2MSFTNGP04.phx.gbl...

> if I have a schema like this:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  <xsd:element name="Root">
>    <xsd:complexType>
>      <xsd:sequence>
>        <xsd:element name="Version" type="xsd:string"/>
>        <xsd:element name="VerDate" type="xsd:date"/>
>        <xsd:element minOccurs="0" maxOccurs="unbounded" 
> name="SoftwareInfo">
>          <xsd:complexType>
>            <xsd:sequence>
>            <xsd:element name="No" type="xsd:integer"/>
>            <xsd:element name="Type" type="xsd:string"/>
>            <xsd:element name="Name" type="xsd:decimal" />
>            </xsd:sequence>
>          </xsd:complexType>
>        </xsd:element>
>         </xsd:element>
> </xsd:schema>
>
>
> How do I loop through each element and print something like this:
>
> Root
> Version
> Verdate


Take a look at the documentation of the XmlSchema class, at 
XmlSchema.http://msdn2.microsoft.com/en-us/library/system.xml.schema.xmlschema.aspx. 
You can load a schema via the Read method 
(http://msdn2.microsoft.com/en-us/library/system.xml.schema.xmlschema.read.aspx).
-- 
John Saunders [MVP]
Date:Wed, 15 Aug 2007 18:01:27 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us