|
|
|
Re: I need XML validation support [message #997135 is a reply to message #996006] |
Thu, 03 January 2013 21: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 21:57] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.06230 seconds