473,811 Members | 2,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlSchema: get basic type of XmlSchemaAttrib ute?

I'm finding the XmlSchema object model very hard to follow :-(

I've figured out by trial and error how to do most things I need,
but this one has me beat.

Suppose my schema has a simple type defined as follows:

<xs:simpleTyp e name="abc">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="A" />
<xs:enumerati on value="B" />
<xs:enumerati on value="C" />
</xs:restriction>
</xs:simpleType>

Now suppose one of my elements has an attribute whose type
is the "abc" type shown above, as in:

<xs:attribute name="attribute 1" type="abc" />

If I navigate through the SOM to find the attribute,
my XmlSchemaAttrib ute object will have its SchemaTypeName. Name
property set to "abc".

My question is: how do I find out the basic type of the
attribute? I simply want to know that it's based on the
xs:string built-in type, but I can't find any way to
do that using the SOM...
Nov 12 '05 #1
2 1660
Hi Gary

How about this. Reads the schema, gets a simple type whose name is abc, then
looks at the base type.

HTH

Nigel Armstrong

Dim fs As New IO.FileStream(" C:\test.xsd", IO.FileMode.Ope n)
Dim s As Xml.Schema.XmlS chema = Xml.Schema.XmlS chema.Read(fs, Nothing)
s.Compile(Nothi ng)
fs.Close()
Dim ot As Xml.Schema.XmlS chemaObjectTabl e = s.SchemaTypes
Dim st As Xml.Schema.XmlS chemaSimpleType = CType(ot.Item(N ew
Xml.XmlQualifie dName("abc")), Xml.Schema.XmlS chemaSimpleType )
MessageBox.Show (st.BaseSchemaT ype.ToString())
"Gary McGill" wrote:
I'm finding the XmlSchema object model very hard to follow :-(

I've figured out by trial and error how to do most things I need,
but this one has me beat.

Suppose my schema has a simple type defined as follows:

<xs:simpleTyp e name="abc">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="A" />
<xs:enumerati on value="B" />
<xs:enumerati on value="C" />
</xs:restriction>
</xs:simpleType>

Now suppose one of my elements has an attribute whose type
is the "abc" type shown above, as in:

<xs:attribute name="attribute 1" type="abc" />

If I navigate through the SOM to find the attribute,
my XmlSchemaAttrib ute object will have its SchemaTypeName. Name
property set to "abc".

My question is: how do I find out the basic type of the
attribute? I simply want to know that it's based on the
xs:string built-in type, but I can't find any way to
do that using the SOM...

Nov 12 '05 #2
Nigel,

I tried that, but what it actually gets is the name of the .NET class used
to represent the type (such as System.Xml.Sche ma.Datatype_str ing") rather
than the qualified name of the type (such as "string" or "positiveIntege r").

I suppose I could use the bit after the "_" but that sounds ugly - surely
there must be a better way?

Gary

"Nigel Armstrong" <Ni************ @discussions.mi crosoft.com> wrote in
message news:FF******** *************** ***********@mic rosoft.com...
Hi Gary

How about this. Reads the schema, gets a simple type whose name is abc, then looks at the base type.

HTH

Nigel Armstrong

Dim fs As New IO.FileStream(" C:\test.xsd", IO.FileMode.Ope n)
Dim s As Xml.Schema.XmlS chema = Xml.Schema.XmlS chema.Read(fs, Nothing)
s.Compile(Nothi ng)
fs.Close()
Dim ot As Xml.Schema.XmlS chemaObjectTabl e = s.SchemaTypes
Dim st As Xml.Schema.XmlS chemaSimpleType = CType(ot.Item(N ew
Xml.XmlQualifie dName("abc")), Xml.Schema.XmlS chemaSimpleType )
MessageBox.Show (st.BaseSchemaT ype.ToString())
"Gary McGill" wrote:
I'm finding the XmlSchema object model very hard to follow :-(

I've figured out by trial and error how to do most things I need,
but this one has me beat.

Suppose my schema has a simple type defined as follows:

<xs:simpleTyp e name="abc">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="A" />
<xs:enumerati on value="B" />
<xs:enumerati on value="C" />
</xs:restriction>
</xs:simpleType>

Now suppose one of my elements has an attribute whose type
is the "abc" type shown above, as in:

<xs:attribute name="attribute 1" type="abc" />

If I navigate through the SOM to find the attribute,
my XmlSchemaAttrib ute object will have its SchemaTypeName. Name
property set to "abc".

My question is: how do I find out the basic type of the
attribute? I simply want to know that it's based on the
xs:string built-in type, but I can't find any way to
do that using the SOM...

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9094
by: AlexS | last post by:
Hello, I have error when reading schema using XmlSchema. Read and then .Compile: System.Xml.Schema.XmlSchemaException: May not be nominated as the {substitution group affiliation} of any other declaration. An error occurred at , (11, 3). Schema compile error: System.Exception: Schema error ---> System.Xml.Schema.XmlSchemaException: May no
4
7123
by: Stefan Rotter | last post by:
Hi, I'm trying to load a schema into an XmlSchema object with the Read and Compile methods. I use Read with a ValidationEventHandler. No errors occurs but when I look at the XmlSchema properties it contains NOTHING. The schema file is correct because I can use it to validate xmldocuments with the XMLValidatingReader. What am I doing wrong here? Code:
3
2806
by: Nathan Wallace | last post by:
Hello, I have 2 schema, for argument sake let's call them child.xsd and parent.xsd. I define all my types in parent.xsd and the child.xsd include the parent.xsd using the following tag: <xs:include schemaLocation="http://localhost/xsds/parent.xsd"/> Now when I create an XmlSchema object on the child.xsd I couldn't get the type that I define in the parent.xsd. How do I get this? Do I need to create
1
1542
by: Rumen Traykov via .NET 247 | last post by:
Have somebody had already the problem of having to write more than one XmlSchema, where some of these schemas have imports to others and respectively derived types? The imports cannot be resolved until I dont save all schemas to disk, but I cannot do this because I get an error for the derived types(which have base types from schema which is not written yet, so the import cannot be resolved). How could I solve this problem? I dont need any...
1
1390
by: SideByEach | last post by:
If I wanted to find the type referenced in this XML's root node, what object would I use in the SOM? <xs:schema xmlns="http://www.w3.org/1999/XSL/Transform"elementFormDefault="qualified" targetNamespace="http://www.w3.org/1999/XSL/Transform"xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense">
4
1655
by: Igor Koretsky | last post by:
Hi. Using VB.Net System.Xml 1.0 SchemaCollection Object I am getting an error when trying to add ‘Schema A’ to the SchemaCollection. Here are my schema files..
1
4391
Samji
by: Samji | last post by:
Hello. I have this XML document: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <vbtagsconf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vbtags.xsd"> <vbtag name="bold" params="false" group="basic"> <regexp>\</regexp> <code>&lt;b&gt;</code> </vbtag>
1
4030
by: Ryan | last post by:
Hello Xml Gurus, I'm trying to build an XML schema in memory using the System.Xml.XmlSchema namespace objects, validate it, and then write it to a file. The problem I'm facing is that XmlSchema.Write() is changing <xsd:element minOccurs="1" name="AccountId" type="s-xsd:primarykey" /> to be
0
2039
by: =?Utf-8?B?TGFzdGJ1aWxkZXJz?= | last post by:
Hi all, I have a weird problem which has been causing me a headache for the last two days. I have to dynamicly generate a schema in memory and load it into a dataset in memory to be returned for further use. To create the schema I am using the XMLSchema classes and the result is the
0
9727
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10398
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10133
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.