Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » I need XML validation support(How to resolve an obsolete W3C namespace with XML Catalog (or others) in Eclipse Juno.)
I need XML validation support [message #996006] Mon, 31 December 2012 14:47 Go to next message
Felipe Lotas is currently offline Felipe Lotas
Messages: 3
Registered: December 2012
Junior Member
I like to use Eclipse to edit FB2 files (fictionbook.org).

I can not use links in the message, so:
{web} = h t t p : / / w w w
without spaces.

The file header .fb2 is:
<?xml version="1.0" encoding="utf-8">
<FictionBook xmlns="{web}.gribuser.ru/xml/fictionbook/2.0" xmlns:l="{web}.w3.org/1999/xlink">
   ...
</ FictionBook>


The XML Schema files are online. I can not modify them. Please review them (only header) to understand the problem:
{web}.gribuser.ru/xml/fictionbook/2.0/xsd/FictionBook2.xsd
{web}.gribuser.ru/xml/fictionbook/2.0/xsd/FictionBookGenres.xsd
{web}.gribuser.ru/xml/fictionbook/2.0/xsd/FictionBookLang.xsd
{web}.gribuser.ru/xml/fictionbook/2.0/xsd/FictionBookLinks.xsd

I added two "Catalog Entry" in "XML Catalog" with the new namespaces:
Location: {web}.gribuser.ru/xml/fictionbook/2.0/xsd/FictionBook2.xsd
Key Type: Namespace name
key: {web}.gribuser.ru/xml/fictionbook/2.0
Location: {web}.gribuser.ru/xml/fictionbook/2.0/xsd/FictionBookGenres.xsd
Key Type: Namespace name
key: {web}.gribuser.ru/xml/fictionbook/2.0/genres


I have no knowledge of XSD, but I think the problem is that the file {web}.gribuser.ru/xml/fictionbook/2.0/xsd/FictionBookLang.xsd uses an obsolete namespace (W3C):
{web}.w3.org/XML/1998/namespace


{web}.gribuser.ru/xml/fictionbook/2.0/xsd/FictionBookLang.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.4 U ({web}.xmlspy.com) by Dmitry Gribov (DDS) -->
<xs:schema targetNamespace="{web}.w3.org/XML/1998/namespace" xmlns:xs="{web}.w3.org/2001/XMLSchema" xmlns="{web}.w3.org/XML/1998/namespace" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:attribute name="lang" type="xs:language">
		<xs:annotation>
			<xs:documentation>Element content's languige</xs:documentation>
		</xs:annotation>
	</xs:attribute>
</xs:schema>


Is it possible to validate FB2 files with XML Catalog or other Eclipse tool/plugin?

thanks
icon3.gif  Re: I need XML validation support [message #996055 is a reply to message #996006] Mon, 31 December 2012 18:09 Go to previous messageGo to next message
Felipe Lotas is currently offline Felipe Lotas
Messages: 3
Registered: December 2012
Junior Member
I've found a solution, but i dont know if it's correct or no. Can you check?

I've download FictionBookLink.xsd
I've download and modify FictionBook2.1.xsd and FictionBookGenres.xsd

Changes in XSDs are

In FictionBook2.1.xsd:
out<-- <xs:import namespace="{web}.w3.org/XML/1998/namespace" schemaLocation="FictionBookLang.xsd"/>
in --> <xs:import schemaLocation="{web}.w3.org/2001/xml.xsd" namespace="{web}.w3.org/XML/1998/namespace"/>


In FictionBookGenre.xsd:
out<-- <xs:schema targetNamespace="{web}.gribuser.ru/xml/fictionbook/2.0/genres" xmlns="{web}.w3.org/XML/1998/namespace" xmlns:xs="{web}.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
in --> <xs:schema targetNamespace="{web}.gribuser.ru/xml/fictionbook/2.0/genres" xmlns:xs="{web}.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">


Changes in XML Catalog entries are

Location: /media/CARBON/FB2/xsd/2.1/FictionBook2.1.xsd
Key: {web}.gribuser.ru/xml/fictionbook/2.0


Location: /media/CARBON/FB2/xsd/2.1/FictionBookGenres.xsd
Key: {web}.gribuser.ru/xml/fictionbook/2.0/genres


It seems to work fine. Is OK? Is correct change references of 1998/namespace to new 2001/XMLSchema? Affect to the validation results?

Do you know any option/triky like that, for XML Catalog, that permits work with online XSDs? Eclipse System schemas are intouchable.
I've no idea of XSD

Thanks
¬°¬°Happy new year!!
Re: I need XML validation support [message #996969 is a reply to message #996055] Thu, 03 January 2013 05:06 Go to previous messageGo to next message
Wolfgang Knauf is currently offline Wolfgang Knauf
Messages: 63
Registered: July 2009
Member
Hi,

I think you need a "schemaLocation" attribute in der XML declaration, so
that Eclipse can resolve the XSD file.

It should be something like this (not tested ;-)):

<?xml version="1.0" encoding="utf-8">
<FictionBook xmlns="{web}.gribuser.ru/xml/fictionbook/2.0"
xmlns:l="{web}.w3.org/1999/xlink"
xsi:schemaLocation="{web}.gribuser.ru/xml/fictionbook/2.0
{web}.gribuser.ru/xml/fictionbook/2.0/xsd/FictionBook2.xsd">
...
</ FictionBook>

For xlink no schemaLocation is required, because Eclipse can resolve it
itself.

Hope this helps

Wolfgang
Re: I need XML validation support [message #997135 is a reply to message #996006] Thu, 03 January 2013 16:56 Go to previous messageGo to next message
Felipe Lotas is currently offline Felipe Lotas
Messages: 3
Registered: December 2012
Junior Member
The online XSDs contents in {web}.gribuser.ru/xml/fictionbook/2.0/xsd are

FictionBook2.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="{web}.gribuser.ru/xml/fictionbook/2.0" xmlns="{web}.gribuser.ru/xml/fictionbook/2.0" xmlns:xs="{web}.w3.org/2001/XMLSchema" xmlns:xlink="{web}.w3.org/1999/xlink" xmlns:genre="{web}.gribuser.ru/xml/fictionbook/2.0/genres" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:import namespace="{web}.w3.org/1999/xlink" schemaLocation="FictionBookLinks.xsd"/>
  <xs:import namespace="{web}.gribuser.ru/xml/fictionbook/2.0/genres" schemaLocation="FictionBookGenres.xsd"/>
  <xs:import namespace="{web}.w3.org/XML/1998/namespace" schemaLocation="FictionBookLang.xsd"/>
  <xs:element name="FictionBook">
    ... [large file] ...
  </xs:element>
</xs:schema>



FictionBookGenres.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="{web}.gribuser.ru/xml/fictionbook/2.0/genres" xmlns="{web}.gribuser.ru/xml/fictionbook/2.0/genres" xmlns:xs="{web}.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:simpleType name="genreType">
    ... [large file] ...
  </xs:simpleType>
</xs:schema>



FictionBookLinks.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="{web}.w3.org/1999/xlink" xmlns:xs="{web}.w3.org/2001/XMLSchema" xmlns="{web}.w3.org/1999/xlink" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:attribute name="type" type="xs:string" fixed="simple">
    <xs:annotation>
      <xs:documentation>link type</xs:documentation>
    </xs:annotation>
  </xs:attribute>
  <xs:attribute name="href" type="xs:string">
    <xs:annotation>
      <xs:documentation>link target</xs:documentation>
    </xs:annotation>
  </xs:attribute>
</xs:schema>


FictionBookLang.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="{web}.w3.org/XML/1998/namespace" xmlns:xs="{web}.w3.org/2001/XMLSchema" xmlns="{web}.w3.org/XML/1998/namespace" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:attribute name="lang" type="xs:language">
    <xs:annotation>
      <xs:documentation>Element content's languige</xs:documentation>
    </xs:annotation>
  </xs:attribute>
</xs:schema>


I have modified my local copy of the files used in Eclipse validation. The modified FictionBook2.xsd is
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="{web}.gribuser.ru/xml/fictionbook/2.0" xmlns="{web}.gribuser.ru/xml/fictionbook/2.0" xmlns:xs="{web}.w3.org/2001/XMLSchema" xmlns:xlink="{web}.w3.org/1999/xlink" xmlns:genre="{web}.gribuser.ru/xml/fictionbook/2.0/genres" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:import namespace="{web}.w3.org/1999/xlink" schemaLocation="FictionBookLinks.xsd"/>
  <xs:import namespace="{web}.gribuser.ru/xml/fictionbook/2.0/genres" schemaLocation="FictionBookGenres.xsd"/>
  <xs:import namespace="{web}.w3.org/XML/1998/namespace" schemaLocation="{web}.w3.org/2001/xml.xsd"/>
  <xs:element name="FictionBook">
  ... [large file] ...
  </xs:element>
</xs:schema>



Now FictionBookLang.xsd is not used. I override the import of FictionBookLang.xsd in FictionBook2.xsd with
<xs:import namespace="{web}.w3.org/XML/1998/namespace" schemaLocation="{web}.w3.org/2001/xml.xsd"/>


I have no knowledge about XML schemas. I'd like to use Eclipse to edit FB2 files and validate them, but seems that Eclipse XML Catalog don't like FictionBookLang.xsd's contents.
Is my solution/triky correct in terms of XML schemas?
Is a correct FB2 validation?
Does 2001/xml.xsd define the same lang atribute that 1998/namespace?

Thanks

[Updated on: Thu, 03 January 2013 16:57]

Report message to a moderator

Re: I need XML validation support [message #1008271 is a reply to message #997135] Mon, 11 February 2013 05:39 Go to previous message
Wolfgang Knauf is currently offline Wolfgang Knauf
Messages: 63
Registered: July 2009
Member
Hi

sorry for the late reply.

Could you post the web location of the fictionbook xsds? I tried to
browse http://gribuser.ru/xml/fictionbook/2.0 - but this seems to result
in a 404 error, and I cannot read the page ;-).

I found the files (2.2 version) also here:
http://yaboobooker.googlecode.com/svn-history/r3/trunk/schemas/2.2

Using Eclipse, I could create this xml file. Take a look at the schema
location "xsi:schemaLocation="http://www.gribuser.ru/xml/fictionbook/2.0
http://yaboobooker.googlecode.com/svn-history/r3/trunk/schemas/2.2/FictionBook.xsd".

<?xml version="1.0" encoding="UTF-8"?>
<p:FictionBook xmlns:p="http://www.gribuser.ru/xml/fictionbook/2.0"
xmlns:p1="http://www.w3.org/1999/xlink"
xmlns:p2="http://www.gribuser.ru/xml/fictionbook/2.0/genres"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.gribuser.ru/xml/fictionbook/2.0
http://yaboobooker.googlecode.com/svn-history/r3/trunk/schemas/2.2/FictionBook.xsd
">
<p:description>
<p:title-info>
<p:genre>sf_history</p:genre>
<p:author>
<p:first-name>Test</p:first-name>
<p:middle-name>middle</p:middle-name>
<p:last-name>last</p:last-name>
</p:author>
<p:book-title>p:book-title</p:book-title>
<p:lang>p:lang</p:lang>
</p:title-info>
<p:document-info>
<p:author>
<p:first-name>Test</p:first-name>
<p:middle-name>middle</p:middle-name>
<p:last-name>last</p:last-name>
</p:author>
<p:date>p:date</p:date>
<p:id>token</p:id>
<p:version>0.0</p:version>
</p:document-info>
</p:description>
<p:body>
<p:section />
</p:body>
</p:FictionBook>

You could also add the xsd files to your xml catalog, but I did not
manage to handle this ;-). It seems that the somehow overwrite some xml
standard XSDs, this is somehow "strange"...


Best regards

Wolfgang

Am 03.01.2013 22:56, schrieb Felipe Lotas:
> The online XSDs contents are
>
> FictionBook2.xsd
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="{web}.gribuser.ru/xml/fictionbook/2.0"
> xmlns="{web}.gribuser.ru/xml/fictionbook/2.0"
> xmlns:xs="{web}.w3.org/2001/XMLSchema"
> xmlns:xlink="{web}.w3.org/1999/xlink"
> xmlns:genre="{web}.gribuser.ru/xml/fictionbook/2.0/genres"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:import namespace="{web}.w3.org/1999/xlink"
> schemaLocation="FictionBookLinks.xsd"/>
> <xs:import namespace="{web}.gribuser.ru/xml/fictionbook/2.0/genres"
> schemaLocation="FictionBookGenres.xsd"/>
> <xs:import namespace="{web}.w3.org/XML/1998/namespace"
> schemaLocation="FictionBookLang.xsd"/>
> <xs:element name="FictionBook">
> ... [large file] ...
> </xs:element>
> </xs:schema>
>
>
> FictionBookGenres.xsd
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema
> targetNamespace="{web}.gribuser.ru/xml/fictionbook/2.0/genres"
> xmlns="{web}.gribuser.ru/xml/fictionbook/2.0/genres"
> xmlns:xs="{web}.w3.org/2001/XMLSchema" elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> <xs:simpleType name="genreType">
> ... [large file] ...
> </xs:simpleType>
> </xs:schema>
>
>
> FictionBookLinks.xsd
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="{web}.w3.org/1999/xlink"
> xmlns:xs="{web}.w3.org/2001/XMLSchema" xmlns="{web}.w3.org/1999/xlink"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:attribute name="type" type="xs:string" fixed="simple">
> <xs:annotation>
> <xs:documentation>link type</xs:documentation>
> </xs:annotation>
> </xs:attribute>
> <xs:attribute name="href" type="xs:string">
> <xs:annotation>
> <xs:documentation>link target</xs:documentation>
> </xs:annotation>
> </xs:attribute>
> </xs:schema>
>
> FictionBookLang.xsd
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="{web}.w3.org/XML/1998/namespace"
> xmlns:xs="{web}.w3.org/2001/XMLSchema"
> xmlns="{web}.w3.org/XML/1998/namespace" elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> <xs:attribute name="lang" type="xs:language">
> <xs:annotation>
> <xs:documentation>Element content's languige</xs:documentation>
> </xs:annotation>
> </xs:attribute>
> </xs:schema>
>
> I have modified my local copy of the files used in Eclipse validation.
> The modified FictionBook2.xsd is
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="{web}.gribuser.ru/xml/fictionbook/2.0"
> xmlns="{web}.gribuser.ru/xml/fictionbook/2.0"
> xmlns:xs="{web}.w3.org/2001/XMLSchema"
> xmlns:xlink="{web}.w3.org/1999/xlink"
> xmlns:genre="{web}.gribuser.ru/xml/fictionbook/2.0/genres"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:import namespace="{web}.w3.org/1999/xlink"
> schemaLocation="FictionBookLinks.xsd"/>
> <xs:import namespace="{web}.gribuser.ru/xml/fictionbook/2.0/genres"
> schemaLocation="FictionBookGenres.xsd"/>
> <xs:import namespace="{web}.w3.org/XML/1998/namespace"
> schemaLocation="{web}.w3.org/2001/xml.xsd"/>
> <xs:element name="FictionBook">
> ... [large file] ...
> </xs:element>
> </xs:schema>
>
>
> Now FictionBookLang.xsd is not used. I override the import of
> FictionBookLang.xsd in FictionBook2.xsd with
> <xs:import namespace="{web}.w3.org/XML/1998/namespace"
> schemaLocation="{web}.w3.org/2001/xml.xsd"/>
>
>
> I have no knowledge about XML schemas. I'd like to use Eclipse to edit
> FB2 files and validate them, but seems that Eclipse XML Catalog don't
> like FictionBookLang.xsd's contents.
> Is my solution/triky correct in terms of XML schemas?
> Is a correct FB2 validation? Does 2001/xml.xsd define the same lang
> atribute that 1998/namespace?
>
> Thanks
Previous Topic:How to debug Web app with Tomcat & Eclipse
Next Topic:Removing obsolete files from the server
Goto Forum:
  


Current Time: Wed Jul 30 19:20:21 EDT 2014

Powered by FUDForum. Page generated in 0.01671 seconds