473,799 Members | 3,817 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

namespace of type reference

Dear all,

I have the following problem
In a schema I refer to a type in a different schema like this:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
targetNamespace ="http://www.example.com " xmlns:test="tes t">

<xs:import namespace="test " schemaLocation= "test.xsd"/>
<xs:element name="test">
<xs:complexType >
<xs:sequence>
<xs:element name="IncludedE lement" type="test:Test Type"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

What I want to achieve is the following:

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://www.example.com " xmlns:test="tes t"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="test test.xsd">
<test:IncludedE lement>
<test:SomeEleme nts/>
<test:IncludedE lement/>
</test:IncludedEl ement>
</test>

But this is what I get

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://www.example.com " xmlns:test="tes t"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="test test.xsd">
<IncludedElemen t>
<test:SomeEleme nts/>
<test:IncludedE lement/>
</IncludedElement >
</test>

Using the schema above, the SomeElements and the nested IncludeElement are
of the correct namespace (test), But the "containing " IncludeElement is not
:(

I know a reference to that element instead of to that type will do the
trick, but the schema I am refering to only has only 1 global element, an I
am not able to change that schema.
Can someone help me out?

Many thanks,

Koen

Jul 20 '05 #1
3 1459


Koen De Wolf wrote:

I have the following problem
In a schema I refer to a type in a different schema like this:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
targetNamespace ="http://www.example.com " xmlns:test="tes t">

<xs:import namespace="test " schemaLocation= "test.xsd"/>
<xs:element name="test">
<xs:complexType >
<xs:sequence>
<xs:element name="IncludedE lement" type="test:Test Type"/>
If IncludedElement is supposed to be in the namespace test then you need
to define it in test.xsd and use
<xs:element ref="test:Inclu dedElement" />
here. Your main schema can only define elements in its targetNamespace .
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

What I want to achieve is the following:

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://www.example.com " xmlns:test="tes t"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="test test.xsd">
<test:IncludedE lement>
<test:SomeEleme nts/>
<test:IncludedE lement/>
</test:IncludedEl ement>
</test>

But this is what I get

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://www.example.com " xmlns:test="tes t"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="test test.xsd">
<IncludedElemen t>
<test:SomeEleme nts/>
<test:IncludedE lement/>
</IncludedElement >
</test>

Using the schema above, the SomeElements and the nested IncludeElement are
of the correct namespace (test), But the "containing " IncludeElement is not
:(

I know a reference to that element instead of to that type will do the
trick, but the schema I am refering to only has only 1 global element, an I
am not able to change that schema.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
That was what I was afraid of. So it is not possible to have somehow 2
target namespaces.

Tx,

Koen

"Martin Honnen" <ma*******@yaho o.de> wrote in message
news:40******** @olaf.komtel.ne t...


Koen De Wolf wrote:

I have the following problem
In a schema I refer to a type in a different schema like this:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
targetNamespace ="http://www.example.com " xmlns:test="tes t">

<xs:import namespace="test " schemaLocation= "test.xsd"/>
<xs:element name="test">
<xs:complexType >
<xs:sequence>
<xs:element name="IncludedE lement" type="test:Test Type"/>


If IncludedElement is supposed to be in the namespace test then you need
to define it in test.xsd and use
<xs:element ref="test:Inclu dedElement" />
here. Your main schema can only define elements in its targetNamespace .
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

What I want to achieve is the following:

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://www.example.com " xmlns:test="tes t"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="test test.xsd">
<test:IncludedE lement>
<test:SomeEleme nts/>
<test:IncludedE lement/>
</test:IncludedEl ement>
</test>

But this is what I get

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://www.example.com " xmlns:test="tes t"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="test test.xsd">
<IncludedElemen t>
<test:SomeEleme nts/>
<test:IncludedE lement/>
</IncludedElement >
</test>

Using the schema above, the SomeElements and the nested IncludeElement are of the correct namespace (test), But the "containing " IncludeElement is not :(

I know a reference to that element instead of to that type will do the
trick, but the schema I am refering to only has only 1 global element, an I am not able to change that schema.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3


Koen De Wolf wrote:
That was what I was afraid of. So it is not possible to have somehow 2
target namespaces.


One schema has one target namespace and can only define elements in that
target namespace, any element in another namespace needs to be defined
in a separate schema that is then imported and the element is referenced.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #4

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

Similar topics

1
2725
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a namespace prefix, what is its namespace, if default namespaces do not apply? Are (either of) prefixed or non-prefixed attributes correct? For example, are the following equivalent: <html:br class="foo"...
2
3979
by: dimension | last post by:
Hi, in visual studio 2005 beta, when i type "using System.Web." no code complete helper pops up. Similarly, when typing "using System.Net." i do not see an HttpWebRequest in the list that pops up. According to the documentation, HttpWebRequest should be a part of the System.Web namespace. I am not sure why this is happening? Can anyone assist?
6
555
by: clinton__bill | last post by:
Hi, I usually use "using namespace <namespace_name>" to reference a namespace. Today I run across a code, in its header file it has this, namespace SP1{ class C1; } While SP1::C1 is a namespace::class declared and defined somewhere else. It seems the above 3 lines is similar to "using namespace SP1;",
29
1881
by: Tiraman | last post by:
Hi, I Build my own dll with my own namespace name and i would like to put it in one place but for the project bin folder so all of the projects will be able to use it . i tried to put the dll in this place ----> c:\MyDlls\Test.dll And i wrote in my aspx file the following <%@ Import Namespace="Test.MyClass"%>
0
2349
by: Steven Bolard | last post by:
Hello, I am trying to port my .net 1.1 application to 2.0. I am using vs2005. I am trying to get my webservices to run and although i can compile them and and get wsdl and service descriptions through internet explorer when hitting the ..asmx url, i cannot generate a proxy class to use in my winforms assembly. When i try to generate a proxy, i get no error message but nor do i get a reference.vb so there is no type info. If i then try...
1
1257
by: SMart | last post by:
I am having a problem with a C# dll in my Visual Studio 2005 ASP.NET web site project: when I add a reference to a certain the dll, it tells me that the type or namespace “Log” does not exist in the namespace SGS.DataServices. The namespace that I am looking for is SGS.DataServices.Log. When I type SGS.DataServices the namespace that is available is “System”. When that dll was initially written, the namespace was in fact...
0
904
by: SMart | last post by:
I am having a problem with a C# dll in my Visual Studio 2005 ASP.NET web site project: when I add a reference to a certain the dll, it tells me that the type or namespace “Log” does not exist in the namespace SGS.DataServices. The namespace that I am looking for is SGS.DataServices.Log. When I type SGS.DataServices the namespace that is available is “System”. When that dll was initially written, the namespace was in fact...
3
2867
by: sjt003 | last post by:
I have been developing web apps in Visual Studio 2003, but since the other developers in my office don't use Visual Studio, I may have to stop too unless there is an efficient way for them to compile the code outside of Visual Studio if they need to adjust something I created. I have been trying to use vbc.exe, but I'm having problems with references to the DataSet I have created. Multiple pages reference my dataset - "DataSet1", ......
4
353
by: vncntj | last post by:
I've tested this project locally, by running it http://localhost:1436/Data/gift.aspx and everything is perfect. But if it onto the remote server I get "The type or namespace name could not be found" this is my gift.aspx.cs *************************************** using System; using System.Data;
4
4355
by: Jon | last post by:
I have an example C# programme which shows me how to communicate with a scientist instrument. It includes the namespace statement "using Ivi.Visa.Interop" If I copy this into a blank winform programme, when I compile, I get an error "The type or namespace name 'Ivi' could not be found (are you missing a using directive or an assembly reference?)" How do I do this? I can presumably find the required reference in the example programme, but...
0
9687
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
10488
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
10237
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
9077
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
6808
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();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4144
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
3
2941
bsmnconsultancy
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...

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.