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 04:51  |
Eclipse User |
|
|
|
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 12:27   |
Eclipse User |
|
|
|
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.
>
>
>
>
>
>
>
>
|
|
| | | |
(no subject) [message #675640 is a reply to message #675080] |
Wed, 01 June 2011 00:38   |
Eclipse User |
|
|
|
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
|
|
| | |
Re: (no subject) [message #677217 is a reply to message #676212] |
Tue, 07 June 2011 16:44  |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Tue Jul 01 03:04:18 EDT 2025
Powered by FUDForum. Page generated in 0.10037 seconds
|