Home » Language IDEs » ServerTools (WTP) » How to validate XML files without specifying xmlns namespace attribute in the root element?((Eclipse WTP) XML Catalog entries are used to associate an XML Schema with a given namespace key. Can I do the same without adding xmlns namespace to every XML file?)
How to validate XML files without specifying xmlns namespace attribute in the root element? [message #675080] |
Mon, 30 May 2011 08:51 |
xemox Messages: 9 Registered: May 2010 |
Junior Member |
|
|
We have a lot of projects that consists of XML files. We have to validate all these XML files based on a single XML schema.
In order to realize this, we have used XML Catalog entries to associate an XML Schema with a given namespace key. In this way you define the location of XML Schema only once in XML Catalog and all XML files will be validated based on this single XML Schema. You can see the XML Category Entry below:
Entry element: URI
Location: dm_d/src/DESchema.xsd
URI: platform:/resource/dm_d/src/DESchema.xsd
Key type: Namespace name
Key: http://www.example.com
This method works fine, BUT only thing that you have to do is to add 'xmlns' namespace attribute to root element of every single XML file in your projects.
We don't want to add the namespace attribute to each XML file, because we have to update a lot of Client projects, which is not efficient and feasible.
At the moment, we are looking for other ways of XML validation based on a single XML schema without introducing xmlns namespace to each XML file.
How can we do this in Eclipse IDE?
Normal XML Validation (e.g.: underlines when you have wrong closing tag,..) in Eclipse XML editor works without namespace. Here, you don't have to define anything that relates to XML Schema. How it is done for this normal XML validation?
Can we do the same as in the normal XML validation?
Any tips, guidance in this direction are very appreciated.
Thanks!
Regards,
Xemox.
|
|
|
(no subject) [message #675221 is a reply to message #675080] |
Mon, 30 May 2011 16:27 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Does your schema have a target namespace? If so, your root element must
be using that namespace to conform to it, rigth?
xemox wrote:
> We have a lot of projects that consists of XML files. We have to
> validate all these XML files based on a single XML schema.
> In order to realize this, we have used XML Catalog entries to
> associate an XML Schema with a given namespace key. In this way you
> define the location of XML Schema only once in XML Catalog and all XML
> files will be validated based on this single XML Schema. You can see
> the XML Category Entry below:
>
> Entry element: URI
> Location: dm_d/src/DESchema.xsd
> URI: platform:/resource/dm_d/src/DESchema.xsd
> Key type: Namespace name
> Key: http://www.example.com
>
> This method works fine, BUT only thing that you have to do is to add
> 'xmlns' namespace attribute to root element of every single XML file
> in your projects.
>
> We don't want to add the namespace attribute to each XML file, because
> we have to update a lot of Client projects, which is not efficient and
> feasible.
>
> At the moment, we are looking for other ways of XML validation based
> on a single XML schema without introducing xmlns namespace to each XML
> file.
>
> How can we do this in Eclipse IDE?
>
> Normal XML Validation (e.g.: underlines when you have wrong closing
> tag,..) in Eclipse XML editor works without namespace. Here, you don't
> have to define anything that relates to XML Schema. How it is done
> for this normal XML validation?
>
> Can we do the same as in the normal XML validation?
>
> Any tips, guidance in this direction are very appreciated.
>
> Thanks! :)
>
> Regards,
> Xemox.
>
>
>
>
>
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
(no subject) [message #675242 is a reply to message #675080] |
Mon, 30 May 2011 21:23 |
|
Mon, 30 May 2011 04:51:02 -0400, /xemox/:
> At the moment, we are looking for other ways of XML validation based
> on a single XML schema without introducing xmlns namespace to each
> XML file.
>
> How can we do this in Eclipse IDE?
I don't think so. I've asked about 4 years ago about similar (if
not the same) thing:
"Infer an XML Schema or DTD grammar depending on the root element
name" <http://www.eclipse.org/forums/index.php/mv/msg/63174/>
I haven't seen development on the front, at least not in the base
Eclipse bundles.
--
Stanimir
|
|
|
Re: (no subject) [message #675263 is a reply to message #675221] |
Tue, 31 May 2011 00:21 |
xemox Messages: 9 Registered: May 2010 |
Junior Member |
|
|
Yes, my schema has a target namespace, namely http://www.example.com (as described above). When I add this namespace to my XML file, it works fine, it validates.
BUT the problem is that I don't want to add namespace to root element. Because it is not feasible to update all XML files/projects that are already in the client/customer side.
Do you know how to validate XML file based on XML Schema without introducing namespaces?
It is somehow done, in normal XML editor, it underlines with red color when you have non-valid XML. Where is that Schema? It/namespace is NOT in the ROOT element.
How can we do that?
[Updated on: Fri, 03 June 2011 08:06] Report message to a moderator
|
|
| |
(no subject) [message #675640 is a reply to message #675080] |
Wed, 01 June 2011 04:38 |
|
On 5/30/2011 4:51 AM, xemox wrote:
> We have a lot of projects that consists of XML files. We have to
> validate all these XML files based on a single XML schema.
> In order to realize this, we have used XML Catalog entries to associate
> an XML Schema with a given namespace key. In this way you define the
> location of XML Schema only once in XML Catalog and all XML files will
> be validated based on this single XML Schema. You can see the XML
> Category Entry below:
>
> Entry element: URI
> Location: dm_d/src/DESchema.xsd
> URI: platform:/resource/dm_d/src/DESchema.xsd
> Key type: Namespace name
> Key: http://www.example.com
>
> This method works fine, BUT only thing that you have to do is to add
> 'xmlns' namespace attribute to root element of every single XML file in
> your projects.
>
> We don't want to add the namespace attribute to each XML file, because
> we have to update a lot of Client projects, which is not efficient and
> feasible.
>
> At the moment, we are looking for other ways of XML validation based on
> a single XML schema without introducing xmlns namespace to each XML file.
>
> How can we do this in Eclipse IDE?
>
> Normal XML Validation (e.g.: underlines when you have wrong closing
> tag,..) in Eclipse XML editor works without namespace. Here, you don't
> have to define anything that relates to XML Schema. How it is done for
> this normal XML validation?
>
> Can we do the same as in the normal XML validation?
Bug 206370 is a relevant read, but the short answer is no, not without
writing plug-ins to deal with your special case, and maybe not even
then. They're not *.xml files at least, right?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=206370
--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
| | |
Re: (no subject) [message #677217 is a reply to message #676212] |
Tue, 07 June 2011 20:44 |
|
On 6/3/2011 4:21 AM, xemox wrote:
> Quote:
>> Bug 206370 is a relevant read, but the short answer is no, not without
>> writing plug-ins to deal with your special case, and maybe not even
>> then. They're not *.xml files at least, right?
I actually meant in terms of their file names. You have considerably
more flexibility if your file names can be used to differentiate them.
--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Goto Forum:
Current Time: Thu Sep 26 17:47:19 GMT 2024
Powered by FUDForum. Page generated in 0.04935 seconds
|