Hi all,
I wrote some generator of classes from XSD files but encountred unexpected (for me) values in parsed DOM.
First I load XSD with XmlSchema.Read( ) method, then iterate through XmlSchemaElemen ts. I have a function
IsComplex() which return bool value if it has simple content (e.g. type string, int,...) or complex one (sequence,
choice, ..). This function looks like this:
bool IsComplex(XmlSc hemaElement el) {
if (el.SchemaType is XmlSchemaComple xType) {
XmlSchemaComple xType t = (XmlSchemaCompl exType)el.Schem aType;
if (t.ContentModel is XmlSchemaSimple Content)
return false;
else
return true;
}
else
return false;
}
but when I use definition of type within XSD, SchemaType property of element returns null. I would expect here
instance of XmlSchemaComple xType. However SchemaTypeName is not null and contains correct value
(PackageList for example bellow).
Is it correct behaviour ? Is there better approach how to recognize content of schema element ?
Here's sample of XSD:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://test.shipments" targetNamespace ="http://test.shipments" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shipments ">
<xs:complexType >
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbo unded" name="shipment" >
<xs:complexType >
<xs:sequence>
<xs:element name="shipment_ reference" type="xs:string " />
<xs:element name="packages" type="PackageLi st" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexTy pe name="PackageLi st">
<xs:sequence>
<xs:element name="package_r eference" type="xs:string " />
</xs:sequence>
</xs:complexType>
</xs:schema>
Thanks for any help,
eXavier 2 1614
You must compile your schema using XmlSchema.Compi le and then access the ElementType property to obtain an instance of the XmlSchemaType corresponding to the type in the schema.
"eXavier" <fh**@centrum.c z> wrote in message news:uA******** ******@TK2MSFTN GP14.phx.gbl...
Hi all,
I wrote some generator of classes from XSD files but encountred unexpected (for me) values in parsed DOM.
First I load XSD with XmlSchema.Read( ) method, then iterate through XmlSchemaElemen ts. I have a function
IsComplex() which return bool value if it has simple content (e.g. type string, int,...) or complex one (sequence,
choice, ..). This function looks like this:
bool IsComplex(XmlSc hemaElement el) {
if (el.SchemaType is XmlSchemaComple xType) {
XmlSchemaComple xType t = (XmlSchemaCompl exType)el.Schem aType;
if (t.ContentModel is XmlSchemaSimple Content)
return false;
else
return true;
}
else
return false;
}
but when I use definition of type within XSD, SchemaType property of element returns null. I would expect here
instance of XmlSchemaComple xType. However SchemaTypeName is not null and contains correct value
(PackageList for example bellow).
Is it correct behaviour ? Is there better approach how to recognize content of schema element ?
Here's sample of XSD:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://test.shipments" targetNamespace ="http://test.shipments" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shipments ">
<xs:complexType >
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbo unded" name="shipment" >
<xs:complexType >
<xs:sequence>
<xs:element name="shipment_ reference" type="xs:string " />
<xs:element name="packages" type="PackageLi st" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexTy pe name="PackageLi st">
<xs:sequence>
<xs:element name="package_r eference" type="xs:string " />
</xs:sequence>
</xs:complexType>
</xs:schema>
Thanks for any help,
eXavier
Thanks a lot, it works as I need.
However, MSDN class library is poor documentation for using SOM, is there some good source of information on working with SOM ?
I would rather avoid this try-fail approach next time.
eXavier
"Zafar Abbas [MSFT]" <za****@microso ft.com> wrote in message news:%2******** **********@TK2M SFTNGP14.phx.gb l...
You must compile your schema using XmlSchema.Compi le and then access the ElementType property to obtain an instance of the XmlSchemaType corresponding to the type in the schema.
"eXavier" <fh**@centrum.c z> wrote in message news:uA******** ******@TK2MSFTN GP14.phx.gbl...
Hi all,
I wrote some generator of classes from XSD files but encountred unexpected (for me) values in parsed DOM.
First I load XSD with XmlSchema.Read( ) method, then iterate through XmlSchemaElemen ts. I have a function
IsComplex() which return bool value if it has simple content (e.g. type string, int,...) or complex one (sequence,
choice, ..). This function looks like this:
bool IsComplex(XmlSc hemaElement el) {
if (el.SchemaType is XmlSchemaComple xType) {
XmlSchemaComple xType t = (XmlSchemaCompl exType)el.Schem aType;
if (t.ContentModel is XmlSchemaSimple Content)
return false;
else
return true;
}
else
return false;
}
but when I use definition of type within XSD, SchemaType property of element returns null. I would expect here
instance of XmlSchemaComple xType. However SchemaTypeName is not null and contains correct value
(PackageList for example bellow).
Is it correct behaviour ? Is there better approach how to recognize content of schema element ?
Here's sample of XSD:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://test.shipments" targetNamespace ="http://test.shipments" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shipments ">
<xs:complexType >
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbo unded" name="shipment" >
<xs:complexType >
<xs:sequence>
<xs:element name="shipment_ reference" type="xs:string " />
<xs:element name="packages" type="PackageLi st" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexTy pe name="PackageLi st">
<xs:sequence>
<xs:element name="package_r eference" type="xs:string " />
</xs:sequence>
</xs:complexType>
</xs:schema>
Thanks for any help,
eXavier This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: eXavier |
last post by:
Hi all,
I wrote some generator of classes from XSD files but encountred unexpected (for me) values in parsed DOM.
First I load XSD with XmlSchema.Read() method, then iterate through XmlSchemaElements. I have a function
IsComplex() which return bool value if it has simple content (e.g. type string, int,...) or complex one (sequence,
choice, ..). This function looks like this:
bool IsComplex(XmlSchemaElement el) {
if (el.SchemaType is...
|
by: Rein Petersen |
last post by:
Hi Folks,
I'm reading a schema using SOM (System.Xml.Schema) and there are namespaced
attributes that I need to access but I'm having problems with the
UnhandledAttributes property - that is is continually reports an error:
Object reference not set to an instance of an object.
My code looks like this:
|
by: Rein Petersen |
last post by:
Somebody please tell me what is the matter with the
System.Xml.Schema.XmlSchemaElement.UnhandledAttributes property.
I don't seem to be able to access no matter how I try...
Rein
|
by: Christian Lammel |
last post by:
OK, repost:
> I implemented a schema helper function GetDeclaration (similar to MSXML),
> that finds a XmlSchemaElement for a given XmlElement, using a
> XmlSchemaCollection. There is one kind of element, that is defined in
schema
> A with some annontation.
>
> <xs:element name="MyElement" type="SomeType">
> <xs:annotation>
|
by: ezra epstein |
last post by:
Aother head banger for me.
Below is a complete example of the code
Using Postgres 7.4,
the function "test" gets this: psql:temp3.sql:10: ERROR: syntax error
at or near "%" at character 135
the function "test2" gets this: psql:temp3.sql:10: ERROR: syntax error
at or near "ROWTYPE" at character 141
| |
by: Sam Vanhoutte |
last post by:
Hello,
I am generating an XML schema for the use in Biztalk 2004. Everything
works, except for one simple thing.
I cannot add XmlSchemaElements to a XmlSchemaComplexType. This is necessary
for the use of subrecords (nested elements, like the SubRecord1 element in
the example below).
I can add attributes to the complextype, but I don't succeed in adding
elements to this.
|
by: Josh |
last post by:
Is there anyway to get the correct XmlSchemaElement from an XSD that
corresponds to an element within an Xml Document Instance?
I want to automatically generate a UI for an Xml Instance based upon
information contained within an XSD. Based on the selected element
within the Xml Instance document I want to find the corresponding
XmlSchemaElement in the XSD and then get parameters from the XSD to
customize the UI (min, max, allowable...
|
by: Lyle Fairfield |
last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/acfctNZ_HV05186465.asp
"If the value of the variant argument is Null, the Nz function returns
the number zero or a zero-length string (always returns a zero-length
string when used in a query expression)"
****
How many records are there in FirstTable in which Product Is Null.
SELECT COUNT(*) AS CountofNullProdcut
|
by: Henning M |
last post by:
Hej All
Im relativ new to VB.net and im trying to collect som device information
using cfgmgr32.dll
I use - Declare Function GetListLength Lib "cfgmgr32.dll" Alias
"CM_Get_Device_ID_List_SizeA" (ByRef pulLen As Integer, ByVal pszFilter As
Integer, ByVal UlFlags As Integer) As Integer -
To get the length of the device list. This seems to work as I get a
CR_SUCCESS (I get a number around 8500. But as I'm not sure what is in the
|
by: Francois Grieu |
last post by:
When running the following code under MinGW, I get
realloc(p,0) returned NULL
Is that a non-conformance?
TIA,
Francois Grieu
#include <stdio.h>
#include <stdlib.h>
|
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,...
| |
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |