For what it's worth, here is the XML I am trying to parse:
<?xml version="1.0" encoding="UTF-8"?>
<AuditEvent xmlns="http://bpm.tibco.com/2004/IAP/MED/1.2/MED"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-
instance" xsi:schemaLocation="http://bpm.tibco.com/2004/IAP/MED/1.2/MED
SWAuditMessage.xsd">
 <SchemaVersion>1.2</SchemaVersion>
 <MessageType>MED</MessageType>
 <ActivityID>9</ActivityID>
 <Procedure Name="EMTSUB">
   <NodeName>sw113</NodeName>
   <Number>6</Number>
   <Description/>
   <MajorVersion>0</MajorVersion>
   <MinorVersion>8</MinorVersion>
   <Type>SUB</Type>
   <Status>released</Status>
 </Procedure>
 <Case Number="1958">
   <Description>kt1</Description>
   <Starter>[EMAIL PROTECTED]</Starter>
   <TimeStarted Microseconds="838519">2006-12-21T10:37:34</TimeStarted>
 </Case>
 <AuditMessage>Case terminated normally</AuditMessage>
 <AuditStep>
   <AuditDate Microseconds="731196">2006-12-21T10:37:47</AuditDate>
   <ParentRef>
     <Procedure Name="EMTWSUB">
       <MajorVersion>0</MajorVersion>
       <MinorVersion>2</MinorVersion>
     </Procedure>
     <StepName>EMTSUB</StepName>
     <Casenum>1809</Casenum>
   </ParentRef>
 </AuditStep>
 <Field Name="SW_MAINCASE">
   <Type>NUM</Type>
   <Value>1809</Value>
 </Field>
</AuditEvent>


And here is the code:

               Document doc = DocumentHelper.parseText(msgText);
               Element root = doc.getRootElement();
               Node node = root.selectSingleNode("//SchemaVersion");
               if (node != null) {
                   log.println("Found SchemaVersion " + node.getText());
               }
               else {
                   log.println("Unable to locate SchemaVersion");
               }

In the console application, I get "Found SchemaVersion 1.2" as the output.
In the WAS app, get "Unable to locate SchemaVersion" as the output.

The log object is a PrintWriter by the way.

Thanks in advance!
Andrew

On 12/21/06, foo monkey <[EMAIL PROTECTED]> wrote:

I am working on  an XML project and wanting to use dom4j. I have things
working it seems. When I decided to use XPath, I found that I also need
Jaxen. So, I downloaded that, put it on the classpath and it seems to work.
Is this requirement documented somewhere? I confess that I've not fully read
all the docs so flame me if you'd like :) .

My other problem though is when I try to bundle this code up in a JEE app
and deploy it to a WebSphere Application Server. My app is happy with the
dom4j calls. But, when I try to do any XPath stuff using Jaxen, it just
doesn't work. It doesn't seem to be raising any exceptions. I just get NULL
when I do a node.selectSingleNode("//element") call.

Any ideas on how I might be able to resolve this one? Thanks to all for a
very cool (and free!) parser.

Thanks.
Andrew




--
"The future will be better tomorrow"
-- Al Gore
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to