How to enable Author mode if parsing errors

Post here questions and problems related to oXygen frameworks/document types.
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

How to enable Author mode if parsing errors

Post by Pascale »

Hi

I need to edit a XML document (custom DTD) that refers entities that are not reachable on my system.
This is fine, as the resulting document is well-formed, uncomplete but valid when the entity content can not be included. It works perfectly well with another XML editor...

However, when I try to open that document with Oxygen in Author mode, it complains about
E [ISO Schematron] I/O error reported by XML parser processing file:xxx.xml: zzz.xml (The system cannot find the file specified)
where xxx is my XML document and zz is the entity chich is included, and the Author mode is not fired, the file is simply opened in Text mode.

Is it possible to ignore or intercept that error and to force Oxygen to open the file in Author mode ?
Can I do it by changing the preferences or do I need some Java customization ?
Could you please provide instructions and sample code on how to do it ?

Thanks,
Pascale
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to enable Author mode if parsing errors

Post by Radu »

Hi Pascale,

What version of Oxygen are you using?

Undefined entity references should not stop Oxygen to switch the XML to the Author editing mode.
I tested with a simple XML document like:

Code: Select all

<!DOCTYPE root SYSTEM "a.dtd">
<root>
&abcdef;
</root>
and a DTD like:

Code: Select all

<!ELEMENT  root (#PCDATA)>
and Oxygen showed an error for the missing entity reference but allowed me to switch to the Author editing mode.

Again, the Schematron error you obtain should not impend switching to the Author editing mode in any way, it is just a consequence of the fact that probably the XML is invalid. When you switch manually to the Author visual editing mode do you receive an error message dialog? If so, what does it state?

So could you give me more precise details about your situation? Maybe send us (support@oxygenxml.com) some sample XML documents + DTDs.
I will assume that the document type configuration (framework) for your XML document sets the Author page as the default page for opening an XML. What association rules do you have for the XML document? Are they based on some DTD information?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

Re: How to enable Author mode if parsing errors

Post by Pascale »

Hi Radu,

I am using Oxygen v16.
I tried to reproduce the problem with a simplified book.

Here is my sample document:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//ABC//DTD XML Book//EN" "book.dtd"
[<!ENTITY legalnotices SYSTEM "legalnotices.xml">
<!ENTITY bookbody SYSTEM "bookbody.xml">
]>
<book id="book1" >
<booktitle>My Book Test</booktitle>
<abstract>
<para>This document is a test book.</para>
</abstract>

&legalnotices;
&bookbody;</book>
and my DTD:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<!-- ============================================================= -->
<!-- PUBLIC DOCUMENT TYPE DEFINITION -->
<!-- ============================================================= -->

<!ELEMENT book (booktitle, subtitle?, abstract, legalnotices, bookbody) >
<!ATTLIST book
id ID #IMPLIED
>

<!ELEMENT abstract (para+) >
<!ELEMENT bookbody (section+) >
<!ELEMENT booktitle (#PCDATA) >
<!ELEMENT legalnotices (section+) >
<!ELEMENT para (#PCDATA) >
<!ELEMENT section (label, (para | list | table)*) >
<!ELEMENT subtitle (#PCDATA) >
Error at the bootom of the editing window is:

Code: Select all

F [Xerces] FileNotFoundException-C:\...\legalnotices.xml (The system cannot find the file specified)
and when I click on the Author tab it displays a dialog box that says :

Code: Select all

Could not open the document in "Author" mode. Cannot parse document: C:\...\legalnotices.xml (The system cannot find the file specified)
Pascale
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to enable Author mode if parsing errors

Post by Radu »

Hi Pascale,

Such problems are quite severe and the XML parser we use breaks when trying to create the internal nodes structure used in the Author visual editing mode. We'll look into this, maybe we can somehow make the parsing of the XML when switching to the visual Author editing mode more relaxed to such problems. I will update this thread if we find a solution for a future version.

In the meantime you can place somewhere on your disk an XML catalog with content like:

Code: Select all

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<systemSuffix systemIdSuffix="legalnotices.xml" uri="legalnotices.xml"/>
<systemSuffix systemIdSuffix="bookbody.xml" uri="bookbody.xml"/>
</catalog>
which would point to two empty XML files located in the same folder with the catalog.
Then in the Oxygen XML / XML Catalog preferences page add a link to that catalog.
Those entities will be resolved to empty content so the switch to the Author page will work.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

Re: How to enable Author mode if parsing errors

Post by Pascale »

Hi Radu,

thanks for the answer.
And, yes, please keep me informed if you can implement a more relaxed parsing when switching to Author mode.
In the meantime, I will investigate if using a Catalog as you suggested can solve the problem.

Regards,
Pascale
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to enable Author mode if parsing errors

Post by Radu »

Hi,

Just to update this thread, Oxygen 17 should be able to show in the Author page a sample document like the one above.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply