Hello Martin,
Schema and namespace are two different issues, you can write a schema
for elements in no namespace if needed. So I am not sure I understand
the problem, why do you want to use a namespace if the incoming XML
does not have elements in a namespace?
Ah so I have found someone who knows what they're talking about.
Excellent.
Ok so I have XMl coming in that looks like this....
-------------------------------------------------------------
<Element1>
<Element2>
<Element3>
</Element3>
</Element2>
</Element1>
-------------------------------------------------------------
I have used this to generate a schema so that I could access this through
VB's XMlLiterals using Intellisense.
-------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="
http://www.w3.org/2001/XMLSchema">
<xs:element name="Element1">
<xs:complexType>
<xs:sequence>
<xs:element name="Element2">
<xs:complexType>
<xs:sequence>
<xs:element name="Element3" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
-------------------------------------------------------------
I began to explore this and discovered a targetNamespace attribute was available
in the <xs:schema> element which tied in with what was presented to me in
VB for imports options.
I created such an attribute on my schema
-------------------------------------------------------------
<xs:schema targetNamespace="
http://SomeNameSpace" attributeFormDefault="unqualified"
elementFormDefault="qualified" xmlns:xs="
http://www.w3.org/2001/XMLSchema">
-------------------------------------------------------------
Then I imported the namespace in my VB Project thus
-------------------------------------------------------------
Imports <xmlns="
http://SomeNameSpace">
-------------------------------------------------------------
However when I used an XElement to Parse my data in from it's source I found
that basic Queries failed.
This seemed to be corrected if I either removed my imports statement or injected
an...
-------------------------------------------------------------
xmlns="
http://SomeNameSpace"
-------------------------------------------------------------
....attribute into my data.
Now I freely admit to being confused by a fair amount of XML stuff and have
learned all of this through experimentation, so I may well have got some
of the terminology wrong. Sorry about that.
Hopefully this clarrifies my position.
So therefore my question is how can I retain my Intellisense while coding
queries and not have to "Inject" the xmlns attribute directly into my text?
Thanks once again for your help