• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XMLUtil - Help

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am specificlly looking into this function: XMLUtil.createDocument. It is being used in the following manner:
this.getVariableSet().setClaim(XMLUtil.createDocument(claim.getBytes()).getDocument());
claim is a string variable that i read from an array but I do not understand what the above is doing. A search on the net just brings me to examples but no explanation. Thanks in advance for your help.
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this seems kind of non-beginner-y...
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
XMLUtil is not a class from the standard Java API. Are you using a library which contains that class, and if so, which library is it? Also, we don't know what the rest of the class looks like from which you are calling this, so we don't know what the methods getVariableSet() and setClaim() mean. Without this information it's impossible to help you with this question.

If I'd had to guess, I'd think that XMLUtil.createDocument() creates an XML document object from the bytes that you pass to it, but probably you've guessed that yourself from the name of the method...
[ December 19, 2007: Message edited by: Jesper Young ]
 
Jeremiah da Costa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I should've stated more info, like this...
This is the code which I'm looking at and need translated to English so I may understand coming from a beginner (that's me) Thanks for putting up with me Jesper. CODE:

protected void onActionInitialize(ProcessModelContext ctx) {
Object[] args = ((JavaEventBody) ctx.getEvent()).getJavaParameters();
String lifecycleId = (String) args[0];
String claim = (String) args[1];
this.getVariableSet().setLifecycleId(lifecycleId);
this.getVariableSet().setClaim(
XMLUtil.createDocument(claim.getBytes()).getDocument());
LogUtil.log.info("ValidateClaim.Initialize");
}
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


This appears to be creating a DOM which is passed to the setClaim() method of some mysterious object reference recovered from getVariableSet()


begin rant - that statement embodies the programming style that I loath and despise. Did somebody think that ramming this sequence of actions into a single statement was clever?
How can this code be debugged when the result of every important step is hidden? Think of all the possible exceptions! You might get an null pointer exception from 3 ? maybe 4 or more points.

Ideally, when something goes wrong you would be able to identify the point at which the error occurred, but not with this oh-so-clever mush.
end rant


Bill
 
Jeremiah da Costa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bill. I didn't write it but trying to simplify it. New to Java but not programming.
 
Jeremiah da Costa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more newbie-to-Java question:
this.getVariableSet().setClaim(XMLUtil.createDocument(claim.getBytes()).getDocument());

The "this" in the above is it a reference to the object claim? What role is "this" playing?
 
reply
    Bookmark Topic Watch Topic
  • New Topic