Working with HTML5

<oXygen/> general issues.
fjordaan
Posts: 3
Joined: Thu Nov 03, 2011 7:35 pm

Working with HTML5

Post by fjordaan » Thu Nov 03, 2011 8:17 pm

Can I install an HTML5 document type?

I'm used to developing XHTML with oXygen, but the new elements in HTML5 are being flagged as errors. I'm happy to stick with XHTML-style XML markup (which is fine in HTML5), but I would like oXygen to recognise all new elements and attributes so that I can rely on it for validation.

Any advice appreciated.
Francois

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Re: Working with HTML5

Post by george » Thu Nov 03, 2011 9:06 pm

Hi Francois,

oXygen 13.1 added support for XHTML 5. It will recognize automatically a document that has
<!DOCTYPE html>
as XHTML 5 and it will offer you content completion and validation support.

Best Regards,
George
George Cristian Bina

fjordaan
Posts: 3
Joined: Thu Nov 03, 2011 7:35 pm

Re: Working with HTML5

Post by fjordaan » Fri Nov 04, 2011 1:24 pm

Thank you! So there isn't a way to add HTML5 support to oXygen 10? The upgrade's quite pricey.

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Re: Working with HTML5

Post by george » Fri Nov 04, 2011 1:36 pm

You can add support for that also in oXygen 10 but you need to associate the XHTML 5 schema with your documents - either as a default schema through oXygen options or directly inside the document.

Best Regards,
George
George Cristian Bina

adrian
Posts: 2668
Joined: Tue May 17, 2005 4:01 pm

Re: Working with HTML5

Post by adrian » Fri Nov 04, 2011 1:45 pm

Hello,

You could use the HTML5 schemas available for EPUB 3.0:
http://idpf.org/epub/30/schema/

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

fjordaan
Posts: 3
Joined: Thu Nov 03, 2011 7:35 pm

Re: Working with HTML5

Post by fjordaan » Mon Nov 07, 2011 7:13 pm

I'm afraid I don't have any experience installing new schemas for oXygen. Could someone help?

Do I need all the files in http://idpf.org/epub/30/schema/epub30-schemas.zip or only those in http://idpf.org/epub/30/schema/mod/html5/ ?

What do I do with them? Do they need to go somewhere in here?
/Applications/oxygen 10.3/frameworks/

How do I get an "HTML5" option to appear in oXygen's "New" dialog box?

Sorry for the naive questions, but I'd appreciate some help.

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Working with HTML5

Post by sorin_ristache » Wed Nov 09, 2011 12:17 pm

Hello,

You can associate a schema with an XML document is Oxygen as described in the User Manual. For example you can use the action Associate Schema which is available on both the Document toolbar and the Document -> Schema menu.

As alternative you can create a document type from menu Options -> Preferences -> Document Type Association, the New button. After you add the new document type in Document Type Association the schema of the document type will be associated automatically with any XML document that will match the document type.


Regards,
Sorin

rleif
Posts: 7
Joined: Sun Nov 29, 2009 8:03 am

Re: Working with HTML5

Post by rleif » Thu Nov 10, 2011 1:07 am

Sorin, I followed your suggestion and went to the document toolbar and Associated string_bd16.xsd.
This resulted in adding attributes to the html element.
<!DOCTYPE html>
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml string_bd16.xsd"
xmlns="http://www.w3.org/1999/xhtml">

The xhtml5 page was still well formed. Since, in html5, the html element can take only one namespace attribute, xmlns="http://www.w3.org/1999/xhtml, As expected, when I tried to validate my xhtml5 page, oXygen provided the following error messages:

System ID: D:\XHTML&HTML5\Forms\html5_XMLSpy_example_RCL2.html
Main validation file: D:\XHTML&HTML5\Forms\html5_XMLSpy_example_RCL2.html
Schema: D:\XHTML&HTML5\Forms\string_bd16.xsd
Engine name: Saxon-EE 9.3.0.5
Severity: warning
Description: Schema at location string_bd16.xsd has target namespace "http://www.cytometryml.org/ACS/strings_bd" but requested namespace was "http://www.w3.org/1999/xhtml"

System ID: D:\XHTML&HTML5\Forms\html5_XMLSpy_example_RCL2.html
Main validation file: D:\XHTML&HTML5\Forms\html5_XMLSpy_example_RCL2.html
Schema: D:\XHTML&HTML5\Forms\string_bd16.xsd
Engine name: Saxon-EE 9.3.0.5
Severity: warning
Description: Validation will continue without the schema at string_bd16.xsd

System ID: D:\XHTML&HTML5\Forms\html5_XMLSpy_example_RCL2.html
Main validation file: D:\XHTML&HTML5\Forms\html5_XMLSpy_example_RCL2.html
Schema: D:\XHTML&HTML5\Forms\string_bd16.xsd
Engine name: Saxon-EE 9.3.0.5
Severity: error
Description: Cannot validate <{....org/1999/xhtml}html>: no element declaration available
Start location: 4:39

System ID: D:\XHTML&HTML5\Forms\html5_XMLSpy_example_RCL2.html
Main validation file: D:\XHTML&HTML5\Forms\html5_XMLSpy_example_RCL2.html
Schema: D:\XHTML&HTML5\Forms\string_bd16.xsd
Engine name: Saxon-EE 9.3.0.5
Severity: error
Description: Cannot validate <{....org/1999/xhtml}html>: no element declaration available

It is possible to include a xmlns attribute in a section element. One possible approach to this problem is to reuse the RDFa material for html5. Has oXygen done anything with RDFa prefixes or CURIES?
Besides my own intersts, I believe that a xhtml5 that included forms that worked with xml forms would be an ideal replacement for XForms. It should permit the creation of xml containing highly portable documents and other applications.
How do I attach my code to this?
Thank you.
Robert (Bob) Leif

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Working with HTML5

Post by sorin_ristache » Thu Nov 10, 2011 6:31 pm

Hello,

You have to associate the epub-xhtml-30.rnc schema with the XML files which you want to edit and validate as HTML 5 documents. In Oxygen 10 please follow these steps for associating the HTML 5 schema from epub30-schemas.zip with an XML document:
  • create a new XML file with the File -> New action or the New button from the toolbar, which displays the Create an XML document dialog box,
  • select the Relax NG tab of this dialog box,
  • select the Compact syntax radio button,
  • using the file browser button (the button with the small yellow folder icon) enter the path of the epub-xhtml-30.rnc file from the folder where you unzipped the epub30-schemas.zip archive,
  • press the OK button.
A new XML file will be created in which the content completion and the validation will be driven by the HTML 5 schema.

If you have an XML document that is already created (not a new one) and you want to associate this schema to it then press the Associate Schema button from the toolbar (or go to menu Document -> XML Document -> Associate Schema) and in the Associate Schema dialog box just enter the same epub-xhtml-30.rnc file.


Regards,
Sorin

rleif
Posts: 7
Joined: Sun Nov 29, 2009 8:03 am

Re: Working with HTML5

Post by rleif » Fri Nov 11, 2011 10:53 pm

Sorin,
Thank you for your suggestion. It worked, but did not solve the problem. As shown below, one can now add the xmlns element. However, since the elements in the relax-ng schema do not include references to the new namespace, the inclusion of elements from the new namespace results in a validation error. This can be fixed by changing the relaxng schema to include the equivalent of an xsd anySimpleType for elements such as: p,h1,h2, etc. and input etc. A case statement might be used to separate the true HTML5 elements from user schema based elements. This would provide input and userInput.
Since there is no obvious means to attach code, I will provide my listings below. The oXygen error messages have been included as comments.
Yours,
Bob Leif
--------------------------------------------------------------

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:strings_bd="http://www.cytometryml.org/ACS/strings_bd"
targetNamespace="http://www.cytometryml.org/ACS/strings_bd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<element name="Bounded_16" type="strings_bd:Bounded_16_Type"/>
<simpleType name="Bounded_16_Type" id="Bounded_16_Type">
<restriction base="token">
<minLength value="1"/>
<maxLength value="16"/>
</restriction>
</simpleType>
</schema>
--------------------------------------------------------------

Code: Select all

<!DOCTYPE html>
<?xml-model href="file:/C:/Program%20Files%20(x86)/Oxygen%20XML%20Editor%2013/frameworks/xhtml/xhtml5%20(epub3)/epub-xhtml-30.rnc" type="application/relax-ng-compact-syntax"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:strings_bd="http://www.cytometryml.org/ACS/strings_bd16">
<head>
<!--meta content="application/xhtml+xml" http-equiv="content-type"/-->
<!--meta charset="utf-8"/-->
<!--meta MIME="text/html" charset="utf-8"/-->
<link href="html5_example.css" rel="stylesheet" type="text/css"/>
<title>HTML5_Form 1</title>
</head>
<body>
<!-- This validates -->
<form action="string_bd16.xml" enctype="application/x-www-form-urlencoded"
method="post">
<div class="entry">
<p><label for="form-1">Name</label>
<input id="form-1" name="string_bd16" type="text"/></p>
</div>
<!-- entry end -->
<div class="button">
<button type="submit">Send</button>
</div>
</form>
</body>
</html>
-------------------------------------------------------------

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="file:/C:/Program%20Files%20(x86)/Oxygen%20XML%20Editor%2013/frameworks/xhtml/xhtml5%20(epub3)/epub-xhtml-30.rnc" type="application/relax-ng-compact-syntax"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:strings_bd="http://www.cytometryml.org/ACS/strings_bd16">
<head>
<link href="html5_example.css" rel="stylesheet" type="text/css" />
<title>HTML5_Form 1</title>
</head>
<body>
<p><strings_bd:Bounded_16>Test</strings_bd:Bounded_16></p>
<!--System ID: D:\XHTML&HTML5\Forms\html_Form_Minimal_w_data-type_fails.xml
Main validation file: D:\XHTML&HTML5\Forms\html_Form_Minimal_w_data-type_fails.xml
Schema: C:\Program Files (x86)\Oxygen XML Editor 13\frameworks\xhtml\xhtml5 (epub3)\epub-xhtml-30.rnc
Engine name: Jing
Severity: error
Description: element "strings_bd:Bounded_16" not allowed here; expected the element end-tag, text or element "a", "abbr", "area", "audio", "b", "bdi", "bdo", "br", "button", "canvas", "cite", "code", "command", "datalist", "del", "dfn", "em", "embed", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "map", "mark", "meter", "ns1:switch", "ns2:math", "ns3:svg", "object", "output", "progress", "q", "ruby", "s", "samp", "script", "select", "small", "span", "strong", "sub", "sup", "textarea", "time", "u", "var", "video" or "wbr" (with xmlns:ns1="http://www.idpf.org/2007/ops" xmlns:ns2="http://www.w3.org/1998/Math/MathML" xmlns:ns3="http://www.w3.org/2000/svg")
Start location: 10:7
End location: 10:28 -->
<form action="string_bd16.xml" enctype="application/x-www-form-urlencoded"
method="post">
<div class="entry">
<p><label for="form-1">Name</label>
<input id="form-1" name="text" type="text" /></p>
</div>
<div class="button">
<button type="submit">Send</button>
</div>
</form>
</body>
</html>
--------------------------------------------------------------

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="file:/C:/Program%20Files%20(x86)/Oxygen%20XML%20Editor%2013/frameworks/xhtml/xhtml5%20(epub3)/epub-xhtml-30.rnc" type="application/relax-ng-compact-syntax"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:strings_bd="http://www.cytometryml.org/ACS/strings_bd16">
<head>
<link href="html5_example.css" rel="stylesheet" type="text/css" />
<title>HTML5_Form 1</title>
</head>
<body>
<form action="string_bd16.xml" enctype="application/x-www-form-urlencoded"
method="post">
<div class="entry">
<p><label for="form-1">Name</label>
<input id="form-1" name="Bounded_16" type="strings_bd:Bounded_16_Type" /></p>
<!-- System ID: D:\XHTML&HTML5\Forms\html_Form_Minimal_w_input_fails.xml
Main validation file: D:\XHTML&HTML5\Forms\html_Form_Minimal_w_input_fails.xml
Schema: C:\Program Files (x86)\Oxygen XML Editor 13\frameworks\xhtml\xhtml5 (epub3)\epub-xhtml-30.rnc
Engine name: Jing
Severity: error
Description: value of attribute "type" is invalid; must be equal to "button", "checkbox", "color", "date", "datetime", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "radio", "range", "reset", "search", "submit", "tel", "text", "time", "url" or "week"
Start location: 14:48
End location: 14:76
-->
</div>
<div class="button">
<button type="submit">Send</button>
</div>
</form>
</body>
</html>

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Working with HTML5

Post by sorin_ristache » Wed Nov 16, 2011 2:03 pm

Hello Bob,
rleif wrote:This can be fixed by changing the relaxng schema to include the equivalent of an xsd anySimpleType for elements such as: p,h1,h2, etc. and input etc.
The traditional elements like h1, h2, p, form, etc. can still be used in HTML 5 in the same context / location as in previous versions (HTML 4, XHTML). If you want to restrict the length of an input field for documents that contain something like

Code: Select all

<input id="form-1" name="Bounded_16" type="strings_bd:Bounded_16_Type" />
with a new type definition then you have to extend the HTML 5 schema by adding in this schema (file:/C:/Program%20Files%20(x86)/Oxygen%20XML%20Editor%2013/frameworks/xhtml/xhtml5%20(epub3)/epub-xhtml-30.rnc) the Relax NG equivalent of the W3C XML Schema definition that you posted:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:strings_bd="http://www.cytometryml.org/ACS/strings_bd"
targetNamespace="http://www.cytometryml.org/ACS/strings_bd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<element name="Bounded_16" type="strings_bd:Bounded_16_Type"/>
<simpleType name="Bounded_16_Type" id="Bounded_16_Type">
<restriction base="token">
<minLength value="1"/>
<maxLength value="16"/>
</restriction>
</simpleType>
</schema>
The validation error is caused by a missing definition of Bounded_16_Type from the HTML 5 schema. Can you post here please how you tried to add the Bounded_16_Type definition to the Relax NG schema for HTML 5?


Regards,
Sorin

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Re: Working with HTML5

Post by george » Thu Nov 17, 2011 11:11 am

Hi Rob,

It seems to me that you have some expectations that come from the fact that you use XHTML 5. Please remove that and just consider that you have an XML document and a Relax NG schema. The validation will do just that: check that the document matches the patterns specified in the schema. If you have a set of values specified in the schema and then you use a different value in the XML file then you will get an error. If you use an XML element in your file and that is not allowed by the schema then you will get an error. This is what happened in your tests - you use an XML and a schema and the schema does not define an element that you use and it does not accept a value that you use and it signals you those errors.

Hope this helps,
George
George Cristian Bina

rleif
Posts: 7
Joined: Sun Nov 29, 2009 8:03 am

Re: Working with HTML5

Post by rleif » Fri Nov 18, 2011 9:52 am

Sorin and George,
Translating the over 60 reasonably complex cytometryML xsd schemas (http://www.cytometryML.org) into Relax NG, is impractical. I might add that the predominant standard in the USA for medical schemas appears to be xsd, which in its latest version, XSD1.1, has a very good design in that it includes the use of assertions, restriction (templates or generics), and extension (class based type creation) and the capacity to interleave schemas. The average user should not touch the xhtml5 schema. The strings_bd16 was a very simple test case.
I will try looking at your Relax NG schema to see. if it has wild cards in the correct places, such as that which contains the paragraph elements p, h1, h2, etc.
Thank you.
Bob Leif

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Re: Working with HTML5

Post by george » Fri Nov 18, 2011 10:58 am

Hi Bob,

You may want to look also into NVDL. This allows extracting fragments of your document based on their namespace and direct them to different schemas, and you can have different schema types for different fragments - for example the XHTML can go to a Relax NG schema while your namespace can go to an XML Schema.

Best Regards,
George
George Cristian Bina

Post Reply