Author Topic: <img>example.com/example.jpg</img> syntax  (Read 4629 times)

Ecnassianer

  • Sr. Member
  • ****
  • Posts: 126
    • Carpe Chaos
<img>example.com/example.jpg</img> syntax
« on: March 31, 2011, 05:12:55 am »
For almost all the images in my books I use this format for image tags:
Code: [Select]
<img><src scale=".5">example.com/example1.jpg</src><src scale="1.0">example.com/example2.jpg</src></img>
But every so often I have an image that doesn't change a different scales and invariably I write:
Code: [Select]
<img>example.com/example.jpg</img>
Which silently fails, and I spend 15 minutes figuring out that I'm supposed to use:
Code: [Select]
<img src="example.com/example.jpg"/>
And by then I've moved it up and down in the xml to make sure it's not hidden under something, but it wasn't, which means it now is... and then I debug that.

Could we add support for the non-property sourcing of images without the src tags? Like this:
Code: [Select]
<img>example.com/example.jpg</img>
That way use of the <img> tag can be consistent with or without <src> tags.

If that's undesirable or impossible, can an <img> tag without a src property that doesn't contain a <src> tag throw a warning?
See my megazine at CarpeChaos.com

Hans Nücke

  • Administrator
  • Hero Member
  • *****
  • Posts: 954
  • MegaZine3 Sales Manager
Re: <img>example.com/example.jpg</img> syntax
« Reply #1 on: March 31, 2011, 10:28:59 am »
That change is "undesirable" ;-)
Reason: it is in conflict with the standard structure and syntax.

The easiest, fastest and safest approach is to us a validator.
We suggest http://www.validome.org/xml/validate/

Copy and paste the complete content of your megazine.mz3 file into the field "source code" and have it validated.
You'll either get as result a "valid document" message, or in case of problems a detailed error report. Which in most cases clearly identifies the row of failure with a description of what is wrong.

Give it a try with one of your problematic files and you'll see that you can solve and find issues very fast!
Good luck

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1989
  • MegaZine3 Developer
    • MegaZine3
Re: <img>example.com/example.jpg</img> syntax
« Reply #2 on: March 31, 2011, 12:46:16 pm »
For future reference: to allow validating, add the line
Code: (xml)
  1. <!DOCTYPE book SYSTEM "http://www.megazine3.de/megazine2.dtd">
to the top of your book definition XML (.mz3 file). Otherwise validome won't know which doctype to use.

Also, to clarify Hans' statement regarding why this alternative syntax probably won't make it in: child nodes (and text is technically a child node) are used for several other things, such as dynamic scaling and localization. So I'd like to avoid possible hiccups arising from changing that bit :/
But as Hans said, just push your XML through validome and it'll point you to all those spots anyway :)
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.