sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Matt Frame's Avatar

Parsing XML Schemas


Question posted by: Matt Frame (Guest) on November 11th, 2005 10:51 PM
I am just starting to work with Schemas and VB.Net. I created a simple
schema with a structure of a top level group, then inside that group I have
sub-groups and elements and within the sub-groups I have other elements,
some of these elements have attributes.

I want to read that schema into a simple VB.Net app that reads the schema
file and just prints out the information about the schema like so:

For Each grp in schema.groups.values
console.writline("Group: {0}", grp.name)
For Each elm in grp
Console.Writline("Element: {0}, elm.name
For Each att In elm
Console.Writeline("Attribute: {0}, att.name
Next
Next
Next

As I said I may have groups within groups and so on and elements within
elements so I am really not sure how to use the SOM and do this. Is this
possible? Does anyone have a sample of doing something similar to this? I
have looked for samples around the internet and at Microsoft but I have not
come up with anything.

Your help is greatly appreciated.

Thanks,

Matt


3 Answers Posted
SQL Server Development Team [MSFT]'s Avatar
SQL Server Development Team [MSFT] November 11th, 2005 10:51 PM
Guest - n/a Posts
#2: Re: Parsing XML Schemas

You can load schema to memory (XmlSchema.Read) and use SOM model to access
it.
Thanks,

- ilia

--
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.
"Matt Frame" <mdframe@sorvive.com> wrote in message
news:uZ8MszRVDHA.2224@TK2MSFTNGP09.phx.gbl...[color=blue]
> I am just starting to work with Schemas and VB.Net. I created a simple
> schema with a structure of a top level group, then inside that group I[/color]
have[color=blue]
> sub-groups and elements and within the sub-groups I have other elements,
> some of these elements have attributes.
>
> I want to read that schema into a simple VB.Net app that reads the schema
> file and just prints out the information about the schema like so:
>
> For Each grp in schema.groups.values
> console.writline("Group: {0}", grp.name)
> For Each elm in grp
> Console.Writline("Element: {0}, elm.name
> For Each att In elm
> Console.Writeline("Attribute: {0}, att.name
> Next
> Next
> Next
>
> As I said I may have groups within groups and so on and elements within
> elements so I am really not sure how to use the SOM and do this. Is this
> possible? Does anyone have a sample of doing something similar to this?[/color]
I[color=blue]
> have looked for samples around the internet and at Microsoft but I have[/color]
not[color=blue]
> come up with anything.
>
> Your help is greatly appreciated.
>
> Thanks,
>
> Matt
>
>[/color]


Matt Frame's Avatar
Guest - n/a Posts
#3: Re: Parsing XML Schemas

I have to say you need to refer back to my original question where I ask the
question about SOM.


"SQL Server Development Team [MSFT]" <sqldev@microsoft.com> wrote in message
news:O80gTLgVDHA.2212@TK2MSFTNGP12.phx.gbl...[color=blue]
> You can load schema to memory (XmlSchema.Read) and use SOM model to access
> it.
> Thanks,
>
> - ilia
>
> --
> This posting is provided "AS IS" with no warranties, and confers no[/color]
rights.[color=blue]
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm.
> "Matt Frame" <mdframe@sorvive.com> wrote in message
> news:uZ8MszRVDHA.2224@TK2MSFTNGP09.phx.gbl...[color=green]
> > I am just starting to work with Schemas and VB.Net. I created a simple
> > schema with a structure of a top level group, then inside that group I[/color]
> have[color=green]
> > sub-groups and elements and within the sub-groups I have other elements,
> > some of these elements have attributes.
> >
> > I want to read that schema into a simple VB.Net app that reads the[/color][/color]
schema[color=blue][color=green]
> > file and just prints out the information about the schema like so:
> >
> > For Each grp in schema.groups.values
> > console.writline("Group: {0}", grp.name)
> > For Each elm in grp
> > Console.Writline("Element: {0}, elm.name
> > For Each att In elm
> > Console.Writeline("Attribute: {0}, att.name
> > Next
> > Next
> > Next
> >
> > As I said I may have groups within groups and so on and elements within
> > elements so I am really not sure how to use the SOM and do this. Is[/color][/color]
this[color=blue][color=green]
> > possible? Does anyone have a sample of doing something similar to this?[/color]
> I[color=green]
> > have looked for samples around the internet and at Microsoft but I have[/color]
> not[color=green]
> > come up with anything.
> >
> > Your help is greatly appreciated.
> >
> > Thanks,
> >
> > Matt
> >
> >[/color]
>
>[/color]


臺灣微軟技術支援部's Avatar
臺灣微軟技術支援部 November 11th, 2005 10:51 PM
Guest - n/a Posts
#4: Re: Parsing XML Schemas

Hi Matt,

To find child element in SOM, you may refer to this article in MSDN:

http://msdn.microsoft.com/library/d...-us/xmlsdk/htm/
som_concepts_7oks.asp

Luke

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?* If not Microsoft strongly advises
you to review the

information at the following link regarding Microsoft Security Bulletin
MS03-026 http://www.microsoft.com/security/s...ns/ms03-026.asp
and/or to

visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to

insure you are current with all security patches, not just MS03-026."

 
Not the answer you were looking for? Post your question . . .
196,842 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,842 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors