cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Parsing XML in Java

IlyaYeroshenko
1-Newbie

Parsing XML in Java

Hello! I have to use obsolete Arbortext Editor 5.2. I need to collect text from XML in a certain way (I need to put '\n' for some text nodes in result string). I've already made a function in Java 5 which executes this using activeDocument. But I have problems using internal Java shipped with Arbortext Editor when I deal with unopenedXML files.


I want to get org.w3c.dom.Document object and then pass it to my function.I used default code with DocumentBuilder factory, it led to


org.apache.xerces.dom.DeferredDocumentImpl exception.

I try to use DOMParser which implementation is here:xercesImpl.jar


I need to ignore "DTDs not found"/namspace errors.

2 REPLIES 2

Ilya,

Look at com.arbortext.epic.Application.openDocument(). There are flags you can pass to that method to control things like whether error messages are displayed. I believe in 5.2 the javadoc was under the 'doc' directory in the install tree.

Chris

Another option, and this is something we also used in 5.x, is to use the
org.apache.xerces.parsers.DOMParser.

eg:
DOMParser parser = new DOMParser();
parser.parse(filePath);
Document doc = parser.getDocument();

- keith


On Fri, Feb 15, 2013 at 7:54 AM, Chris Nitchie <chris.nitchie@oberontech.com<br/>> wrote:

> Ilya,
>
> Look at com.arbortext.epic.Application.openDocument(). There are flags you
> can pass to that method to control things like whether error messages are
> displayed. I believe in 5.2 the javadoc was under the 'doc' directory in
> the install tree.
>
> Chris
>
>
Top Tags