| I need XML validation support [message #996006] |
Mon, 31 December 2012 14:47  |
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
|
|
|
|
|
| Re: I need XML validation support [message #997135 is a reply to message #996006] |
Thu, 03 January 2013 16:56   |
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  |
Wolfgang Knauf Messages: 61 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
|
|
|
Powered by
FUDForum. Page generated in 0.01770 seconds