K. Venugopal writes:
>
> Hi Paul ,
>
> Paul Kinnucan wrote:
>
> >Hi,
> >
> >I need some advice on how to deal with a problem that I have
> >encountered trying to use xerces to parse external entities
> >in multifile documents created by Arbortext's Epic editor.
> >
> >The documents in question are technical manuals consisting of a book
> >file that references a set of chapter files as external entities
> >defined by the book's doctype declaration. The chapter files are
> >themselves XML files, i.e., XML "fragments" of the book. At the head
> >of each chapter file is an XML comment that encloses a doctype
> >declaration that specifies the same doctype as that defined by the
> >book files doctype declaration, i.e., the book's document type.
> >
> >The problem occurs when writers use Epic to "include" external text
> >files (usually nonXML program listings) in a chapter file. Epic
> >implements this by inserting an entity definition for the inserted
> >file in the commented out doctype declaration at the head of the
> >chapter file and a reference to the entity where the inserted
> >text is to appear. When displaying the chapter, Epic knows to
> >look for the definition of the entity in the commented out
> >doctype declaration. However, xerces does not. It regards the
> >external entity as undefined and errors out, preventing me from
> >parsing the file.
> >
> >
> If i have understood your problem right
I'm afraid I didn't state the problem completely enough. The Epic
editor is a WYZYWIG editor that happens to use XML as its internal
markup language. Authors see a formatted rendering of the document on
the screen. They never see or manipulate XML. The XML is all generated
automatically by Epic behind the scenes. For example, to include a
text file by reference in a chapter, the author positions the cursor
at the insertion point in a formatted rendering of the document on the
screen and selects Insert File Reference from the Epic menu. Epic
displays a file selection dialog. The user selects the file to be
inserted. The contents of the file then appear on the screen at the
insertion point. Behind the scenes Epic generates the necessary
external entity declaration in the commented-out doctype at the head
of the internal XML representation of the document and the entity
instance itself at the insertion point.
> you can declare your entities
> for text files in your book xml where you have declared entities for
This would require authors to edit the XML generated by Epic with some
other editor, copying the entity declaration generated by Epic from
the chapter file to the book file. This would not only be labor
intensive but also error prone and a maintenance nightmare. It could
lead to corruption of the document making it impossible to be edited
by Epic. I have to find a way of parsing the XML generated by Epic
that does not entail manually editing that XML after the fact. I was
hoping there would be some way, e.g., via a custom entity resolver, to
pursuade Xerces to use the entity declarations in the commented out
doctypes that Epic generates at the head of chapter files to resolve
external references.
> your chapter xml files.
>
> In addition to this you need to set
> parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
> "http://www.w3.org/2001/XMLSchema");
>
> It should have worked when you set schema validation to true and above
> property is needed only in case of jaxp . I will look into this .
>
I don't see the relevance of this suggestion to my problem.
We use the Docbook DTD. We don't use schemas.
- Paul
>
> Regards
> venu
>
> >How can I parse such files? I've noticed that the DOMParser class
> >has setEntityResolver() and getEntityResolver() methods. This
> >suggests to me that it might be possible for me to define and use my
> >owe external entity resolver. This resolver would try to use the
> >default resolver and if that failed would look for a definition of the
> >entity in the commented-out doctype declaration at the head of the
> >file. Does the setEntityResolver method actually support such
> >a solution? Is there a better way to resolve this problem? Any
> >help you can give me would be deeply appreciated.
> >
> >- Paul
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title></title>
> </head>
> <body>
> <br>
> Hi Paul ,<br>
> <br>
> Paul Kinnucan wrote:<br>
> <blockquote type="cite"
> cite="[EMAIL PROTECTED]">
> <pre wrap="">Hi,
>
> I need some advice on how to deal with a problem that I have
> encountered trying to use xerces to parse external entities
> in multifile documents created by Arbortext's Epic editor.
>
> The documents in question are technical manuals consisting of a book
> file that references a set of chapter files as external entities
> defined by the book's doctype declaration. The chapter files are
> themselves XML files, i.e., XML "fragments" of the book. At the head
> of each chapter file is an XML comment that encloses a doctype
> declaration that specifies the same doctype as that defined by the
> book files doctype declaration, i.e., the book's document type.
>
> The problem occurs when writers use Epic to "include" external text
> files (usually nonXML program listings) in a chapter file. Epic
> implements this by inserting an entity definition for the inserted
> file in the commented out doctype declaration at the head of the
> chapter file and a reference to the entity where the inserted
> text is to appear. When displaying the chapter, Epic knows to
> look for the definition of the entity in the commented out
> doctype declaration. However, xerces does not. It regards the
> external entity as undefined and errors out, preventing me from
> parsing the file.
> </pre>
> </blockquote>
> <font color="#3333ff"> If i have understood your problem right you can
> declare
> your entities for text files in your book xml where you have declared
> entities
> for your chapter xml files. </font> <br>
> <br>
> In addition to this you need to set <br>
> parser.setProperty(<a class="moz-txt-link-rfc2396E"
> href="http://java.sun.com/xml/jaxp/properties/schemaLanguage">"http://java.sun.com/xml/jaxp/properties/schemaLanguage"</a>,
> <a class="moz-txt-link-rfc2396E"
> href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>);<br>
> <br>
> It should have worked when you set schema validation to true and above
> property
> is needed only in case of jaxp . I will look into this .<br>
> <br>
> <br>
> Regards<br>
> venu<br>
> <br>
> <blockquote type="cite"
> cite="[EMAIL PROTECTED]">
> <pre wrap="">
> How can I parse such files? I've noticed that the DOMParser class
> has setEntityResolver() and getEntityResolver() methods. This
> suggests to me that it might be possible for me to define and use my
> owe external entity resolver. This resolver would try to use the
> default resolver and if that failed would look for a definition of the
> entity in the commented-out doctype declaration at the head of the
> file. Does the setEntityResolver method actually support such
> a solution? Is there a better way to resolve this problem? Any
> help you can give me would be deeply appreciated.
>
> - Paul
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated"
> href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
> For additional commands, e-mail: <a class="moz-txt-link-abbreviated"
> href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
>
> </pre>
> </blockquote>
> <br>
> </body>
> </html>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]