Re: Flash and WebObjects...Make it Work with XML or other ?
Re: Flash and WebObjects...Make it Work with XML or other ?
- Subject: Re: Flash and WebObjects...Make it Work with XML or other ?
- From: Nathan Walker <email@hidden>
- Date: Thu, 8 Sep 2005 14:05:40 -0400
Wow, I am starting to make stupid mistakes because I have been
battling this off and on for the past two weeks and I've about thrown
my hands up on this one and I've just started to become angry as to
why dealing with XML has become so difficult for me. Thanks for the
hard clarification, I needed that !
I have been dragging on this project because of this and I am just
ready to have this part figured out...
Frustration definitely causes dumb mistakes and ridiculous oversight...
On Sep 8, 2005, at 1:33 PM, Chuck Hill wrote:
Nathan,
On Sep 8, 2005, at 8:58 AM, Nathan Walker wrote:
I gave this a try and I am still getting a MalformedURLException.
Debugging requires careful reading of the API and stack trace and a
scientific approach of hypothesis, test, repeat. You are making
assumptions and jumping to incorrect conclusions. That is not an
effective way of finding bugs.
I will restate the above (from your point of view) as: I made
several changes and I am getting a MalformedURLException which I am
assuming is coming from the same place that it originally did.
Here's the part of the stack trace:
Read carefully now, top to bottom:
[2005-09-08 11:54:56 EDT] <WorkerThread13>
com.webobjects.foundation.NSForwardException for
java.net.MalformedURLException
at java.net.URL.<init>(URL.java:571)
at java.net.URL.<init>(URL.java:434)
at java.net.URL.<init>(URL.java:383)
at org.apache.xerces.impl.XMLEntityManager.startEntity
(XMLEntityManager.java:807)
at org.apache.xerces.impl.XMLEntityManager.startDocumentEntity
(XMLEntityManager.java:753)
at org.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource
(XMLDocumentScannerImpl.java:260)
at org.apache.xerces.parsers.DTDConfiguration.parse
(DTDConfiguration.java:499)
at org.apache.xerces.parsers.DTDConfiguration.parse
(DTDConfiguration.java:581)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at org.apache.xerces.parsers.AbstractSAXParser.parse
(AbstractSAXParser.java:1114)
at
com.webobjects.appserver.xml._private._MappingModel.mappingModelWithX
MLFile(_MappingModel.java:405)
at
com.webobjects.appserver.xml._private._WOXMLMappingDecoder.<init>
(_WOXMLMappingDecoder.java:121)
at com.webobjects.appserver.xml.WOXMLDecoder.decoderWithMapping
(WOXMLDecoder.java:581)
This tells us that the exception is coming from a call to
decoderWithMapping() on WOXMLDecoder. This call happens at this line:
at XMLDecodeMachine.decodeXML(XMLDecodeMachine.java:25)
at DirectAction.newOrderAction(DirectAction.java:47)
the XMLDecodeMachine.decodeXML method is here (with line 25 denoted):
public String decodeXML (String theXML) {
mappingFile = application().resourceManager
().pathForResourceNamed("OrderXMLModel.xml", null, null);
NSData xmlData = new NSData(theXML, "UTF-8");
line 25 --> CustomBar custBar = (CustomBar)
WOXMLDecoder.decoderWithMapping(mappingFile).decodeRootObject
(xmlData);
System.out.println(custBar);
So the error is coming from WOXMLDecoder.decoderWithMapping
(mappingFile). That indicates that it is mappingFile _not_ xmlData
that is in error. The mapppingFile parameter should be "an URL to
the mapping file that specifies the mapping model". You are
creating mappingFile like this:
mappingFile = application().resourceManager().pathForResourceNamed
("OrderXMLModel.xml", null, null);
pathForResourceNamed returns a path, not a URL. A path is not a
URL and so a MalformedURLException would be expected. Read the
WOResourceManager API more thoroughly. Notice there is a method
urlForResourceNamed. That will probably work but you will still
need to make it absolute which is probably more work than you
want. First, I would try adding 'file://' to the start of
mappingFile to see if that works. Also see the maze of
java.net.URL and java.net.URI.
return "Done";
}
I don't understand why I am getting the
malformedURLException...I'm passing in an NSData object which is
acceptable. I AM CONFUSED here. It's just not making sense !!
That is because you are assuming that it is coming from where it is
not. :-)
Chuck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden