Greg Jewell

Greenhorn
+ Follow
since Mar 08, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Greg Jewell

Hello,

I know this isn't strictly web service related, but this seems like the most appropriate forum since JAX-WS utilizes JAXB.

I am using JAXB to generate Java classes from a set of schemas that I have been given. The data types in these schemas reference each other frequently. Due to various reasons, I need to change the name of several fields in the generated code. To do this, I'm using bindings files to look for the nodes in question, and then to rename them in the Java code.

I'm running into issues, however, when a single schema may be processed by xjc multiple times. (As I mentioned, these schemas quite frequently reference each other.) Depending on the order that the schemas are processed, the Java code may be regenerated without the changed parameter names unless I duplicate all of the customization across all of the bindings files.

Is there any way to import/include one binding file in another? I want to do something like this:



I know that xjc allows any number of binding files to be specified, but I'm using ant to invoke the xjc task, and things get hairy when I have different numbers of bindings that are needed for different invocations.


Thanks!
13 years ago
Thanks for the reply. I modified my expressions to include the other information.

This would seem to make a lot of expressions much more complex than if the matcher weren't reset. This, in turn, would slow things down a lot. Is there a reason why the matcher is reset automatically?
18 years ago
Hello All,

I'm trying to parse and modify a String using the java.util.regex package. The string in question looks like this:

foo
#a b

bar
#a c

I want to remove the comment from the bar section. My code looks for "bar", and gets the end of the region where the match is made. I then do this:

Pattern pattern = Pattern.createPattern("#?(a.*));
Matcher matcher = pattern.matcher(string);
matcher.find(endIndex);

When I print matcher.group(); I get the expected "#a c". However, when I do:

matcher.replaceFirst("$1");

The comment in front of "a b" is removed. What am I doing wrong?


Thanks for any help,
Greg Jewell
18 years ago
I just started using w3c DOM the other day and encountered the same problem. (I had previously used jdom and dom4j.) The solution I found to convert a Document to a String follows. There may be other (easier) methods, but this is the route I used. Note that this uses JAXP from Sun's 1.4.2 SDK.

import java.io.StringWriter;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
DOMSource source = new DOMSource(document);
StringWriter stringWriter = new StringWriter();
StreamResult result = new StreamResult(stringWriter);
transformer.transform(source, result);
String xmlString = stringWriter.toString();
Hi All,

I am working on a project in which the dev team has downloaded and is using Xerces to parse XML. I have also downloaded Sun's JWSDP-1.5 and am trying to create SOAP messages. When I attempt to get the SOAPPart of the message, I receive the following exception:

java.lang.NoClassDefFoundError: com/sun/org/apache/xerces/internal/dom/DocumentImpl

The problem is obvious. One possible solution is to copy the xercesImpl.jar provided with the JWSDP into the project. However, the preferred solution would be to use the Xerces implementation already being used by the rest of the dev team. Is there something that I can put into my code that will allow me to achieve this?

(Note that my code doesn't reference the DocumentImpl class directly -- it's called somewhere within Sun's code.)

Thanks,
Greg
20 years ago
Thank you very much, Petr. This is exactly what I was looking for.
20 years ago
Hi All,

I have a class inside a jar that wants to read the containing jar's manifest. Given that I don't know where on the machine the jar will be placed, I don't know how to instantiate a JarFile object. How do I determine the location of the jar in order to get a JarFile or JarURLConnection object?


Thanks,
Greg Jewell
20 years ago
Hi All,
I'm trying to get Cocoon 1.8.2 up and running under Tomcat 4.1.12. I've made significant progress, but am encountering an error that I don't understand.
In order to get this far, I've had to configure Cocoon to use the SunXMLParser rather than Xerces. (The versions of Xerces found in Cocoon 1.8.2 and Tomcat 4.1.12 appear to be incompatible with each other.)
I can load cocoon/Cocoon.xml without problems. When I try to open cocoon/samples/index.xml, though, I get the following error:
java.net.MalformedURLException: unknown protocol: d
I've placed all the cocoon jar files in webapps/cocoon/WEB-INF/lib, and copied the cocoon samples directory to webapps/cocoon/samples. I've also updated the version of Utils.java that is distributed with cocoon 1.8.2 to the version found in the current development snapshot.
What am I missing?

Thanks,
Greg Jewell
22 years ago
Hi All,
I'm attempting to install cocoon 1.8 into Tomcat 4.1.12. I've made pretty good progress so far, but have encountered a problem that I haven't been able to get around.
Whenever I attempt to access the page http://<server:port>/cocoon/Cocoon.xml, I receive an error stating that cocoon is unable to load the resource cocoon.properties, and the exception thrown is a NullPointerException.
I've modified <tomcat-home>/webapps/cocoon/WEB-INF/web.xml to point to ./cocoon.properties in order to get this error. If I use the "standard" value of WEB-INF/cocoon.properties, cocoon is still unable to load the resource, but throws a FileNotFoundException.
I found a post by Caroline Iux dated 24 Sept 2001 that had the same issue with WebSphere. Her solution, unfortunately, did not work for me.

Thanks a lot,
Greg Jewell
[ October 31, 2002: Message edited by: Greg Jewell ]
[ October 31, 2002: Message edited by: Greg Jewell ]
22 years ago
Hi All,
I've had a request from a user to change the behavior of a JOptionPane. He likes to tab through choices in the pane, but tends to press enter rather than space when the choice that he wants has focus. How can I change the JOptionPane so that the default button follows the focus?
I'm currently displaying the pane using the JOptionPane.showConfirmDialog(..) method.

Thanks,
Greg Jewell
22 years ago