Ok, I am not sure if it is possible. But what I'm trying to do is
validate an XML file with out having to add namespace in the xml.
What I mean is lets say I have 2 XSD
they have different namespaces and lvl2 is used in lvl using the
import feature
lvl1.xsd
-> lvl2.xsd
the xml I would like to validate would be as follow
<level1>
<level2>
<string>hello </string>
<Number>10</Number>
</level2>
<level1>
right now I have to define the namespace of a level to to use the
sublevel tag that way:
....
<l2:string>hell o</l2:string>
<l2:Number>10 </l2:Number>
....
my problem is I don't want the guy who write the xml to be aware of
the structure I use for the XSD. and I want the possibility of having
multiple tags with the same name having different signification based
on where they are placed in the schema.
what I though of is in someway, if he find a tag <level2> it
automaticaly switch the default namespace to the level2 and so on
until it reach </level2> where it would switch back to the level1
namespace.
I think what I want should be pretty easy to do but I just can't
manage make that work.
Thx in advance for your help 3 6298
There is no way of directly validating your instance based on multiple
prefix mappings for a namespace. It is possible, though, for you to play
with the namespaces (via the API) to create and maintain context to achieve
this. Are you using MSXML or System.XML?
If you want the user to not *know* about the namespace in yoru schemas then
why dont you put the schema content in one schema with no targetNamespace ?
or even in one commo namespace?
Zafar
"John Smith" <me*********@ho tmail.com> wrote in message
news:71******** *************** ***@posting.goo gle.com... Ok, I am not sure if it is possible. But what I'm trying to do is validate an XML file with out having to add namespace in the xml.
What I mean is lets say I have 2 XSD they have different namespaces and lvl2 is used in lvl using the import feature
lvl1.xsd -> lvl2.xsd
the xml I would like to validate would be as follow
<level1> <level2> <string>hello </string> <Number>10</Number> </level2> <level1>
right now I have to define the namespace of a level to to use the sublevel tag that way: ... <l2:string>hell o</l2:string> <l2:Number>10 </l2:Number> ...
my problem is I don't want the guy who write the xml to be aware of the structure I use for the XSD. and I want the possibility of having multiple tags with the same name having different signification based on where they are placed in the schema.
what I though of is in someway, if he find a tag <level2> it automaticaly switch the default namespace to the level2 and so on until it reach </level2> where it would switch back to the level1 namespace.
I think what I want should be pretty easy to do but I just can't manage make that work.
Thx in advance for your help
well, my last message screwed when I tried to send it so I won't write
it again. But well thx for your input. I'll have to look how to do
that myself using System.XML.
Right now I'm only using the validator in Visual Studio .Net
(XML|Validate XML) but I get all kind of errors: the 'blablabla'
element is not defined but in XMLspy the schema is working perfectly.
They are not in the same project but they are part of the same
solution. So I'm kind of lost about what I'm doing wrong.
Anyway, thx for your help I'll look into that
"Zafar Abbas [MSFT]" <za****@microso ft.com> wrote in message news:<ua******* ******@TK2MSFTN GP12.phx.gbl>.. . There is no way of directly validating your instance based on multiple prefix mappings for a namespace. It is possible, though, for you to play with the namespaces (via the API) to create and maintain context to achieve this. Are you using MSXML or System.XML?
If you want the user to not *know* about the namespace in yoru schemas then why dont you put the schema content in one schema with no targetNamespace ? or even in one commo namespace?
Zafar
"John Smith" <me*********@ho tmail.com> wrote in message news:71******** *************** ***@posting.goo gle.com... Ok, I am not sure if it is possible. But what I'm trying to do is validate an XML file with out having to add namespace in the xml.
What I mean is lets say I have 2 XSD they have different namespaces and lvl2 is used in lvl using the import feature
lvl1.xsd -> lvl2.xsd
the xml I would like to validate would be as follow
<level1> <level2> <string>hello </string> <Number>10</Number> </level2> <level1>
right now I have to define the namespace of a level to to use the sublevel tag that way: ... <l2:string>hell o</l2:string> <l2:Number>10 </l2:Number> ...
my problem is I don't want the guy who write the xml to be aware of the structure I use for the XSD. and I want the possibility of having multiple tags with the same name having different signification based on where they are placed in the schema.
what I though of is in someway, if he find a tag <level2> it automaticaly switch the default namespace to the level2 and so on until it reach </level2> where it would switch back to the level1 namespace.
I think what I want should be pretty easy to do but I just can't manage make that work.
Thx in advance for your help
Internally, when validating a schema, .NET call a function
Schema.Compile. If the schema contains any include or import, those
url references needs to be resolved.
If you are currently using .NET framework 1.0, be advised that .NET
framework 1.0 does not implement/call a default XmlResolver.
It means that all schema containing include or import would fail, .NET
will not be able to validate the file against the schema.
Those schema will be valid in XMLSpy. XMLSpy will also be able to
validate the file against the schemas.
If you are using .NET framework 1.0, even
implementing a custom XmlResolver will not work, because it will not
be called, the overloaded version of function XmlSchema.Compi le with
the Xml Resolver, XmlSchema.Compi le( ValidationEvent Handler,
XmlResolver) did not exist in framework 1.0. In framework 1.0, one
trick to bypass the problem is to merge both file. You can do that
manually, but you can also do that programatically : load both files,
take the types (complex and simple types) definition from the second
schema. Add every type definition to the first file (Don't forget to
add the namespace definitions). Validate the file against that new
schema.[list:a3563162a1]In .NET framework 1.1, you can also implement your
own XmlResolver derived class.[/list:u:a3563162 a1] This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Graham Banks |
last post by:
Does using multiple inheritance introduce any more performance overhead than
single inheritance?
|
by: tshad |
last post by:
Can you do a search for more that one string in another string?
Something like:
someString.IndexOf("something1","something2","something3",0)
or would you have to do something like:
if ((someString.IndexOf("something1",0) >= 0) ||
((someString.IndexOf("something2",0) >= 0) ||
|
by: Mark |
last post by:
why doesn't .NET support multiple inheritance?
I think it's so silly!
Cheers,
Mark
|
by: Orgun |
last post by:
Hi,
I sent this message to the moderated c++ group too but it is
waiting for moderator approval and I wanted to send here too.
I am new to Design Patterns. I want to write a simple
DeviceManager which is only interested in CD/DVD devices. I want to get
the list of CD/DVD devices and "be informed when a disc inserted into a
device". I am...
|
by: Aaron Gray |
last post by:
AFAICT FireFox SVG does not work with DOM Level 1 constructs, it needs
Namespaces.
Is this correct ?
Aaron
| |
by: icfai |
last post by:
hi friends....
I have got a problem regarding loading of multiple assemblies, actually its required for an editor which implements the intellisenseas in vb or dotnet.
for that it is required to load that assembly whose sub-classes are required to be loaded into the list box after pressing dot.
for example in the code given below i have...
|
by: John |
last post by:
Hi All,
Although C# has Generics, it still does not support the generic
programming paradigm. Multiple inheritance is required to support real
generic programming. Here is a simple design pattern to illustrate this.
Problem:
I need to expose two lists of objects from a high-level class. I would
like to expose these lists as read-only, but...
|
by: =?Utf-8?B?Q2FtZWw=?= |
last post by:
For anyone who has utilised classes under XSD.exe and CodeDOM (please
redirect me to another group perhaps if not here) please any ideas on how to
translate the multiple namespaces present within multiple XmlSchema , i.e.,
via xs:import, to multiple output C# namespaces when using CodeDOM?
Have no problem passing multiple schemas to...
|
by: camel |
last post by:
For anyone who has utilised classes under XSD.exe and CodeDOM, please any ideas on how to translate the multiple namespaces present within multiple XmlSchema , i.e., via xs:import, to multiple output C# namespaces when using CodeDOM?
Have no problem passing multiple schemas to XmlSchemaImporter and generating to single namespace, but this is...
|
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...
|
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...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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...
|
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...
|
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...
|
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...
| |