Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

problem reading XML nodes with selectSingleNode , dom4j

807589Sep 4 2008 — edited Sep 4 2008
Hi everyone,

i'm getting so much trouble trying to read from an XML file. I found on the internet several places with people referring to a similar problem when trying to select nodes from a xml document. This is what I'm doing:
SAXReader   reader  = new SAXReader();
File is = new File(file);
Document document = reader.read(is);

Node n=document.selectSingleNode("workflow_design/workflow");  // -->  it crashes here
This is just an example of what i'm trying to do . I've tried to select different nodes of my xml document and it always crashes. I've tried with "//workflow_design/workflow", with "/workflow_design/workflow", "//workflow", and all the possible combinations and it never works.

In constrast, if I read an element as shown below,I get no errors:
Element e = root.element("workflow")
My xml document is :
<?xml version="1.0" encoding="ISO-8859-1"?>

<workflow_design>
  <workflow name="TRAMITE" class="com.isoco.iwf.core.engine.design.WorkflowDesign">
    <name>TRAMITE</name>
    <version>1</version>
    <default_locale language="en" country="US"/>
    <locales size="0"/>
    <presentation_letter letter_id="presentation_letter.html" path="info"/>
    <create_request size="0"/>
    <finish_request size="0"/>
    <cancel_request size="0"/>
    <operations size="2">
      <operations_0 name="MAIN" class="com.isoco.iwf.core.engine.design.workflow.StartOperation">
        <name>MAIN</name>
        <description>Default operation to execute</description>
      </operations_0>
      <operations_1 name="operation" class="com.isoco.iwf.core.engine.design.workflow.OperationDesign">
        <name>operation</name>
        <restart>false</restart>
        <autostart>false</autostart>
        <actions size="3">
          <actions_0 name="MAIN" class="com.isoco.iwf.core.engine.design.operation.StartAction">
            <name>MAIN</name>
            <description>First accion to execute</description>
          </actions_0>
          <actions_1 name="YES" class="com.isoco.iwf.core.engine.design.operation.EndReturnYes">
            <name>YES</name>
            <description>Operation Finish</description>
          </actions_1>
          <actions_2 name="NO" class="com.isoco.iwf.core.engine.design.operation.EndReturnNo">
            <name>NO</name>
            <description>Operation STOP</description>
          </actions_2>
        </actions>
        <links/>
      </operations_1>
    </operations>
    <links>
      <first_operation from="MAIN" to="operation" unique="true" required="true">Default</first_operation>
    </links>
</workflow>
</workflow_design>
I've been struggling with the selection of nodes for several hours and it just doesn't work. It returns a NoClassDefFoundError. WHY ???? I'm desperate. Please can anyone give me a hand ????

Thank you!!!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 2 2008
Added on Sep 4 2008
1 comment
439 views