Visual editing of XHTML fragments in mixed namespace documen
Oxygen general issues.
-
- Posts: 1
- Joined: Mon Apr 11, 2011 12:06 pm
Visual editing of XHTML fragments in mixed namespace documen
Hi,
I want to be able to edit xml files that contain xhtml fragments - where the xhtml fragments can be edited using the visual editing mode (Author mode in Oxygen).
To illustrate with an example: say I have a file containing info on a list of employees. This is an xml file that conforms to some schema, but contains fragments from the xhtml namespace - say employee profiles. This file would be eventually processed by software, but to make editing easier, it's desired that the user have visual editing (WYSIWYG) features when editing the xhtml segments.
The best behavior would be that the software can be set to automatically switch to the xhtml authoring mode when the cursor is within the xhtml tags - ie the xhtml tool bar will be displayed and visual editing will be available. Or less optimally the user should be able to switch to the xhtml authoring mode when the cursor is within the xhtml fragment.
This is an example:
So the first question is whether this is possible in Oxygen.
The second question is: if the software is designed to use the xhtml visual mode only on xhtml documents (with html root element), it is still acceptable to have a document with an xhtml root, conforming to xhtml schema, but containing fragments from other xml namespaces with their own schemas. Something like this:
This is not much different than the first example. Again the desired behavior is to be able to visually edit the xhtml segments.
The issue is, when I try to open any xhtml document with a schema declaration as in the above , Author mode doesn't show the xhtml authoring toolbar, it seems to only do so for xhtml documents with a DTD declaration not a schema declaration! So the question is how to make this second scenario work - I'm just thinking it might be more plausible.
Of course my questions could apply to any type of document with a visual authoring mode such as DocBook or others being mixed with other namespaces.
Regards -
Basel Shishani.
I want to be able to edit xml files that contain xhtml fragments - where the xhtml fragments can be edited using the visual editing mode (Author mode in Oxygen).
To illustrate with an example: say I have a file containing info on a list of employees. This is an xml file that conforms to some schema, but contains fragments from the xhtml namespace - say employee profiles. This file would be eventually processed by software, but to make editing easier, it's desired that the user have visual editing (WYSIWYG) features when editing the xhtml segments.
The best behavior would be that the software can be set to automatically switch to the xhtml authoring mode when the cursor is within the xhtml tags - ie the xhtml tool bar will be displayed and visual editing will be available. Or less optimally the user should be able to switch to the xhtml authoring mode when the cursor is within the xhtml fragment.
This is an example:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<employee-list
xmlns="http://example.org/emp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.org/emp file:emp-list.xsd" >
<employee>
<name> J Blog</name>
<position> Project Manager</position>
<div id="emp-desc" xmlns="http://www.w3.org/1999/xhtml"
xsi:schemaLocation="http://www.w3.org/1999/xhtml ../frameworks/xhtml11/schema/xhtml11.xsd">
<h2> History </h2>
<p> J Blog joined the company ...</p>
</div>
</employee>
</employee-list>
The second question is: if the software is designed to use the xhtml visual mode only on xhtml documents (with html root element), it is still acceptable to have a document with an xhtml root, conforming to xhtml schema, but containing fragments from other xml namespaces with their own schemas. Something like this:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml ../frameworks/xhtml11/schema/xhtml11.xsd"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:emp="http://example.org/emp"
xsi:schemaLocation="http://example.org/emp file:emp-list.xsd">
<head> <title></title> </head>
<body>
<emp:employee-list>
<emp:employee>
<emp:name> J Blog</emp:name>
<emp:position> Project Manager</emp:position>
<div id="emp-desc">
<h2> History </h2>
<p> J Blog joined the company ...</p>
</div>
</emp:employee>
</emp:employee-list>
</body>
</html>
The issue is, when I try to open any xhtml document with a schema declaration as in the above , Author mode doesn't show the xhtml authoring toolbar, it seems to only do so for xhtml documents with a DTD declaration not a schema declaration! So the question is how to make this second scenario work - I'm just thinking it might be more plausible.
Of course my questions could apply to any type of document with a visual authoring mode such as DocBook or others being mixed with other namespaces.
Regards -
Basel Shishani.
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Visual editing of XHTML fragments in mixed namespace documen
Hi Basel,
Please see some answers below:
You can read the "Author Developer Guide" chapter from our user manual:
http://www.oxygenxml.com/doc/ug-oxygen/
This association will specify a CSS file which you must construct in order to properly render the custom XML format. You will have to construct your own toolbar and menu actions if you decide to use this approach.
Also Oxygen does not handle schemaLocation attributes specified on XML elements other that the root element so you will have to specify only one schemaLocation attribute on the root element which also contains the definition for the XHTML namespace. See the next answer below.
is not even well formed as it is illegal to have the same attribute (xsi:schemaLocation) declared twice in an element.
The "schemaLocation" attribute consists of pairs of type namespace location:
http://www.w3.org/TR/xmlschema-0/#schemaLocation
So the construct should be like:
Oxygen should recognize the XML as XHTML when passing to the Author page and show the toolbar appropriately.
If you want to also define CSS styles for the additional extension elements you can modify the XHTML CSS file directly:
OXYGEN_INSTALL_DIR/frameworks/xhtml/css/xhtml.css
and add new CSS rules.
Regards,
Radu
Please see some answers below:
This is not possible.The best behavior would be that the software can be set to automatically switch to the xhtml authoring mode when the cursor is within the xhtml tags - ie the xhtml tool bar will be displayed and visual editing will be available.
You have to create a new document type association for your custom XML file in the Oxygen Preferences->"Document Type Association" page.Or less optimally the user should be able to switch to the xhtml authoring mode when the cursor is within the xhtml fragment.
You can read the "Author Developer Guide" chapter from our user manual:
http://www.oxygenxml.com/doc/ug-oxygen/
This association will specify a CSS file which you must construct in order to properly render the custom XML format. You will have to construct your own toolbar and menu actions if you decide to use this approach.
Also Oxygen does not handle schemaLocation attributes specified on XML elements other that the root element so you will have to specify only one schemaLocation attribute on the root element which also contains the definition for the XHTML namespace. See the next answer below.
An XML like this:The second question is: if the software is designed to use the xhtml visual mode only on xhtml documents (with html root element), it is still acceptable to have a document with an xhtml root, conforming to xhtml schema, but containing fragments from other xml namespaces with their own schemas.
Code: Select all
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml ../frameworks/xhtml11/schema/xhtml11.xsd"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:emp="http://example.org/emp"
xsi:schemaLocation="http://example.org/emp file:emp-list.xsd">
...........
The "schemaLocation" attribute consists of pairs of type namespace location:
http://www.w3.org/TR/xmlschema-0/#schemaLocation
So the construct should be like:
Code: Select all
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml ../frameworks/xhtml11/schema/xhtml11.xsd http://example.org/emp file:emp-list.xsd"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:emp="http://example.org/emp">.........
If you want to also define CSS styles for the additional extension elements you can modify the XHTML CSS file directly:
OXYGEN_INSTALL_DIR/frameworks/xhtml/css/xhtml.css
and add new CSS rules.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service