Community
Participate
Working Groups
Per Beth Tibbitts' request, opening a request to keep track of this item: 1. Symptom: Using Beth's good foundational work of ETFw feedback view plug-in, I was able to build a plug-in to parse an XML file that PerfSuite (a performance measurement software package, see http://perfsuite.ncsa.illinois.edu) generates, and create a view with the source file names and line numbers, so that a line in the view could be double-clicked to bring the cursor to the corresponding line in the source file in the editor window. However, for this to work in a remote project, the DOCTYPE line in the original XML file that PerfSuite generated (the second line in the file) had to be manually removed, otherwise the plug-in does not work: an error message occurs in the error window, and no view is created. The error message is: TransformDocXMLParser IOException: /usr/apps/tools/perfsuite/1.0.0b2/share/perfsuite/dtds/pshwpc/multihwpcprofilereport-0.2.dtd (No such file or directory) 2. Analysis: The current ETFw feedback view plug-in works in the following way: it parses the selected XML file, finds the first XML element, finds the plug-in that registered for this element, and dispatches the work (the control flow) to that plug-in. However, the ETFw feedback view plug-in creates and uses a DOM XML parser, and the default behavior of the DOM parser is to load the DTD file specified in the DOCTYPE line in the XML file being parsed. For a file in a remote project, the path of the DTD file contained in the XML file is the path on the remote machine, and is usually invalid on the local machine, so the DOM parser can not find it, and throws an IOException. This error later causes a NullPointerException, so no view is created. The relevant code is in the the "findFeedbackParser(IFile file)" method in the "ShowFeedbackHandler.java" file. 3. Possible solution: One possible solution Beth and I discussed was to turn off external DTD validation when creating the XML parser, that is, add: factory.setFeature ("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); before using it to create the DocumentBuilder object. This idea was tested to be working for a small test Java file. The reference URL is: http://xerces.apache.org/xerces2-j/features.html
Can you append a small test case e.g. a dtd i can put on a remote system e.g. that works with the 'sample' plugin?
As a test case, you can use the following "sample.xml" (obtained from the sample plug-in and inserted one DOCTYPE line) and "sample.dtd" files by putting them in the same directory: sample.xml: <?xml version="1.0"?> <!DOCTYPE SampleXMLRoot SYSTEM "sample.dtd"> <SampleXMLRoot> <MyItem name="main is here" parent="mysample" file="sample.c" function="main" lineNo="14" isFunction="true" id="0"/> <MyItem name="loop is here" parent="mysample" file="sample.c" function="main" lineNo="16" isFunction="true" id="1"/> <MyItem name="this is return" parent="mysample" file="sample.c" function="turkey" lineNo="19" isFunction="true" id="2"/> <MyItem name="open brace" parent="braces" file="sample.c" function="turkey" lineNo="14" isFunction="true" id="3"/> <MyItem name="close brace" parent="braces" file="sample.c" function="turkey" lineNo="18" isFunction="true" id="4"/> </SampleXMLRoot> sample.dtd: <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT SampleXMLRoot (MyItem*)> <!ELEMENT MyItem EMPTY > <!ATTLIST MyItem name CDATA #REQUIRED parent CDATA #REQUIRED file CDATA #REQUIRED function CDATA #REQUIRED lineNo CDATA #REQUIRED isFunction ( true | false ) #REQUIRED id CDATA #REQUIRED > Or you may put them into a different directory, and change the path of the DTD in the XML file. For example, put the "sample.dtd" file in "/usr/local/share/sample/", and change the DOCTYPE line in "sample.xml" to: <!DOCTYPE SampleXMLRoot SYSTEM "/usr/local/share/sample/sample.dtd"> Thanks, Rui
i have checked in this fix to the ptp_5_0 branch
Tested the fix in the ptp_5_0 branch. In a remote C project, when a lively-generated PerfSuite XML file that has the DOCTYPE line containing the remote DTD file was selected, the fixed ETFw feedback plug-in correctly parsed the XML, found the first element, and dispatched to the PerfSuite plug-in. So the testing verified that this bug was fixed in the ptp_5_0 branch.
fixed in ptp_5_0 branch. Will copy to HEAD soon too.
this fix will be in ETFw 5.0.1 which will be in PTP SR1 5.0.2 (target milestone changed)
Also fixed in HEAD.