expanding included files in text mode
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 2
- Joined: Tue Oct 04, 2011 12:55 am
expanding included files in text mode
Hi,
I currently have includes in my docbook book to include
chapter files. I have two questions that may be related.
1) Here is an example:
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="legalnotice.xml" />
I currently get the error:
Unexpected element "xi:include".
What do I need to do to address this validation error. I have Xinclude processing enabled in the preferences.
2) In the Oxygen editor, is there a way to expand all my includes in
a single editor screen as if it were a single file and be able to edit them...while in Text mode? I know this was possible when using file entities with Epic.
Thanks,
Paul
I currently have includes in my docbook book to include
chapter files. I have two questions that may be related.
1) Here is an example:
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="legalnotice.xml" />
I currently get the error:
Unexpected element "xi:include".
What do I need to do to address this validation error. I have Xinclude processing enabled in the preferences.
2) In the Oxygen editor, is there a way to expand all my includes in
a single editor screen as if it were a single file and be able to edit them...while in Text mode? I know this was possible when using file entities with Epic.
Thanks,
Paul
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: expanding included files in text mode
Hi Paul,
For Docbook 4 your XML document's header should look like:
The internal DTD subset is customized so that "xi:include" elements are allowed to occur in most Docbook elements.
For Docbook 5 (RNG based) the XML header should be like this:
It also points to a RNG schema which recognizes the xi:include elements.
To provide more details, DTD-based validation is made by the Xerces parser before the includes are expanded, so that's why they must be recognized by the associated DTDs.
RNG-based validation is made after the xi:includes are processed so there is no need for an xi:include aware RNG schema, but the schema is useful to provide content completion when inserting xi:includes.
In the Author page we show the xi:includes expanded but they are not editable. In order to edit them you can right click in the content and choose Edit Reference
Regards,
Radu
You are probably using the DTD-based Docbook 4.1) Here is an example:
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="legalnotice.xml" />
I currently get the error:
Unexpected element "xi:include".
What do I need to do to address this validation error. I have Xinclude processing enabled in the preferences.
For Docbook 4 your XML document's header should look like:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.docbook.org/xml/4.5/docbookx.dtd"
[ <!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
%xinclude;
]>
<book>.....
For Docbook 5 (RNG based) the XML header should be like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbookxi.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">...
To provide more details, DTD-based validation is made by the Xerces parser before the includes are expanded, so that's why they must be recognized by the associated DTDs.
RNG-based validation is made after the xi:includes are processed so there is no need for an xi:include aware RNG schema, but the schema is useful to provide content completion when inserting xi:includes.
No this is not possible.2) In the Oxygen editor, is there a way to expand all my includes in
a single editor screen as if it were a single file and be able to edit them...while in Text mode? I know this was possible when using file entities with Epic.
In the Author page we show the xi:includes expanded but they are not editable. In order to edit them you can right click in the content and choose Edit Reference
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 2
- Joined: Tue Oct 04, 2011 12:55 am
Re: expanding included files in text mode
Hi Radu,
Thanks much for your reply.
So, I added the new code that you suggested:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
[
<!ENTITY % all.entities SYSTEM "all-entities.ent">
%all.entities;
<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
%xinclude;
]>
And, I no longer get errors in the editor, but I do get
validation errors from our external validation script.
Attempt to load network entity http://www.docbook.org/xml/4.4/xinclude.mod
So, can I have two ENTITY entries for a book? Also,
http://www.docbook.org/xml/4.4/xinclude.mod doesn't seem to
resolve to anything.
Thanks,
Paul
Thanks much for your reply.
So, I added the new code that you suggested:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
[
<!ENTITY % all.entities SYSTEM "all-entities.ent">
%all.entities;
<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
%xinclude;
]>
And, I no longer get errors in the editor, but I do get
validation errors from our external validation script.
Attempt to load network entity http://www.docbook.org/xml/4.4/xinclude.mod
So, can I have two ENTITY entries for a book? Also,
http://www.docbook.org/xml/4.4/xinclude.mod doesn't seem to
resolve to anything.
Thanks,
Paul
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: expanding included files in text mode
Hi Paul,
Oxygen uses XML catalogs (the default XML catalog which comes with the Docbook distribution) to map the reference:
"http://www.docbook.org/xml/4.4/xinclude.mod"
to a local module located here:
OXYGEN_INSTALL_DIR/frameworks/docbook/4.4/dtd/xinclude.mod
The main Docbook XML catalog located here:
OXYGEN_INSTALL_DIR/frameworks/docbook/catalog.xml
has this rewrite prefix rule:
So one way would be to add a catalog entry in your external validation script which maps the remote location to a local module.
Another way would be to expand the referenced module directly in the XML file like:
But this is uglier.
Regards,
Radu
Oxygen uses XML catalogs (the default XML catalog which comes with the Docbook distribution) to map the reference:
"http://www.docbook.org/xml/4.4/xinclude.mod"
to a local module located here:
OXYGEN_INSTALL_DIR/frameworks/docbook/4.4/dtd/xinclude.mod
The main Docbook XML catalog located here:
OXYGEN_INSTALL_DIR/frameworks/docbook/catalog.xml
has this rewrite prefix rule:
Code: Select all
<rewriteSystem
systemIdStartString="http://www.docbook.org/xml/4.4/"
rewritePrefix="4.4/dtd/"/>
Another way would be to expand the referenced module directly in the XML file like:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.docbook.org/xml/4.5/docbookx.dtd" [
<!ELEMENT xi:include (xi:fallback?) >
<!ATTLIST xi:include
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
href CDATA #REQUIRED
parse (xml|text) "xml"
xpointer CDATA #IMPLIED
encoding CDATA #IMPLIED
accept CDATA #IMPLIED
accept-charset CDATA #IMPLIED
accept-language CDATA #IMPLIED >
<!ELEMENT xi:fallback ANY >
<!ATTLIST xi:fallback
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" >
<!ENTITY % local.preface.class "| xi:include" >
<!ENTITY % local.part.class "| xi:include" >
<!ENTITY % local.chapter.class "| xi:include" >
<!ENTITY % local.section.class "| xi:include" >
<!ENTITY % local.divcomponent.mix "| xi:include" >
<!ENTITY % local.para.char.mix "| xi:include" >
<!ENTITY % local.info.class "| xi:include" >
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'" >
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED" >
]>
<book>....
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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