DocBook: attribute 'float' not allowed here validation error

Questions about XML that are not covered by the other forums should go here.
abc
Posts: 4

DocBook: attribute 'float' not allowed here validation error

Thu Jul 03, 2014 3:22 pm

With this code

Code: Select all

<sect3>
<title>A Title</title>
<para>Some text::</para>
<para>
  <figure id="my_id">
    <title>Figure title</title>
    <mediaobject>
      <imageobject>
        <imagedata
          fileref="images/blah.png"
        />
      </imageobject>
    </mediaobject>
  </figure></para>
</sect3>


Oxygen XML Editor 13.2, build 2012040515 is giving me the error

Code: Select all

E [Jing] attribute "float" not allowed here; expected attribute "annotations", "arch", "audience", "condition", "conformance", "dir", "floatstyle", "label", "linkend", "os", "pgwide", "remap", "revision", "revisionflag", "role", "security", "userlevel", "vendor", "version", "wordsize", "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show", "xlink:title", "xlink:type", "xml:base", "xml:id", "xml:lang" or "xreflabel"


Why am I getting that validation error? The red squiggly lines are on this line

Code: Select all

<figure id="my_id">
. I also tried adding the

Code: Select all

float
attribute like this

Code: Select all

<figure id="my_id" float="false">
which didn't change anything.

Why am I getting the "attribute "float" not allowed here" error even though I am not even using that attribute?

How am I supposed to fix that?
abc
Posts: 4

Re: DocBook: attribute 'float' not allowed here validation e

Thu Jul 03, 2014 3:28 pm

Adding the "xml" prefix to the "id" didn't help either:

Code: Select all

<figure xml:id="initial_script" float="true">
Radu
Posts: 5757

Re: DocBook: attribute 'float' not allowed here validation e

Thu Jul 03, 2014 3:34 pm

Hi,

Could you post a complete XML sample? I cannot quite reproduce your problem.
Are you using Docbook 5? If so, all IDs should indeed be defined using xml:id instead of id.

I opened a regular installation of Oxygen 13.2 and tried to validate this small XML document (created from your code sample):

Code: Select all

<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<article xmlns="http://docbook.org/ns/docbook"
    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
    <info>
        <title>Article Template Title</title>
        <author>
            <orgname>Organization Name</orgname>
            <address>
                <city>City</city>
                <street>Street</street>
                <postcode>000000</postcode>
                <country>Country</country>
            </address>
            <email>user@example.com</email>
        </author>
    </info>
    <sect1>
        <title>Section1 Title</title>
        <subtitle>Section1 Subtitle</subtitle>
        <para>Text</para>
        <sect2>
            <title>dsadad</title>
            <sect3>
                <title>A Title</title>
                <para>Some text::</para>
                <para>
                    <figure id="my_id">
                        <title>Figure title</title>
                        <mediaobject>
                            <imageobject>
                                <imagedata fileref="images/blah.png"/>
                            </imageobject>
                        </mediaobject>
                    </figure>
                </para>
            </sect3>
        </sect2>
    </sect1>
</article>


and validation reported a problem with the id attribute but no problem with the "float" attribute.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
abc
Posts: 4

Re: DocBook: attribute 'float' not allowed here validation e

Thu Jul 03, 2014 4:00 pm

Thank you for your quick reply!

Here is the entire XML example. Yes, we are using DocBook 5.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://www.oasis-open.org/docbook/xml/5.0/rng/docbookxi.rng" type="xml"?>
<sect1 xml:id="test" xmlns="http://docbook.org/ns/docbook"
  xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink">
  <title>Test</title>
  <sect2>
    <title>Some title</title>
    <para>Some text:</para>
    <para>
      <figure xml:id="initial_script" float="true">
        <title>Some figure title</title>
        <mediaobject>
          <imageobject>
            <imagedata fileref="images/some_image.png"/>
          </imageobject>
        </mediaobject>
      </figure>
    </para>
  </sect2>
</sect1>


I tried your example and it works without validation error after I added the "xml" prefix to "id":

Code: Select all

<figure xml:id="my_id">


I supposed that there is a mistake with my nesting of the DocBook XML elements.. or something else. I'll try to figure it out. If you happend to see the problem, I'd be grateful for a hint.
Radu
Posts: 5757

Re: DocBook: attribute 'float' not allowed here validation e

Thu Jul 03, 2014 4:18 pm

Hi,

From the XML sample you sent you seem to be using the float attribute on the <figure> element.
If I remove that attribute from there, the XML validates.
Looking at the Docbook 5 specification for figure:

http://docbook.org/tdg5/en/html/figure.html

it seems there is no attribute called float allowed on the element but there is an attribute called floatstyle which you could probably try instead.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
abc
Posts: 4

Re: DocBook: attribute 'float' not allowed here validation e

Thu Jul 03, 2014 5:42 pm

With your analysis, hints and link to the specification, I was able to locate and fix the problem.

Thanks a lot for your help!

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest