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 19:08:18 -0400
thank you! hair loss is surely depressing...
On Sep 8, 2005, at 6:28 PM, Chuck Hill wrote:
Save yourself some hair.
http://www.javaworld.com/javaworld/jw-10-2002/jw-1025-
opensourceprofile.html
Chuck
On Sep 8, 2005, at 3:17 PM, Nathan Walker wrote:
OK, so I got it to read in the XML now without the
MalformedURLException but now I get this:
2005-09-08 18:09:47,258 WARN TikiBarz[49613] NSLog
(ERXNSLogLog4jBridge.java:41) - <DirectAction>: Exception in
performActionNamed() on the action "newOrder" with the message:
java.lang.ArrayIndexOutOfBoundsException: -1
[2005-09-08 18:09:47 EDT] <WorkerThread13>
java.lang.ArrayIndexOutOfBoundsException: -1
at
com.webobjects.appserver.xml._private._MappingHandler.endElement
(_MappingHandler.java:119)
at org.apache.xerces.parsers.AbstractSAXParser.endElement
(AbstractSAXParser.java:577)
at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement
(XMLNamespaceBinder.java:898)
at org.apache.xerces.impl.XMLNamespaceBinder.endElement
(XMLNamespaceBinder.java:644)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(
XMLDocumentFragmentScannerImpl.java:1008)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
$FragmentContentDispatcher.dispatch
(XMLDocumentFragmentScannerImpl.java:1469)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(XMLDocumentFragmentScannerImpl.java:329)
at org.apache.xerces.parsers.DTDConfiguration.parse
(DTDConfiguration.java:525)
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:1175)
at com.webobjects.appserver.xml.WOXMLDecoder.decodeRootObject
(WOXMLDecoder.java:700)
at com.webobjects.appserver.xml.WOXMLDecoder.decodeRootObject
(WOXMLDecoder.java:676)
at XMLDecodeMachine.decodeXML(XMLDecodeMachine.java:26)
at DirectAction.newOrderAction(DirectAction.java:47)
And index out of bounds exception ?? now, that seems it would
have something to do with the XML or mapping model..Here is the
XML and below it is the mapping model I'm using (the mapping model
is bare because I'm just trying to get it working, then I would
add mapping for all the attributes):
<customizebar><step1><roofSelection>Palm Branches</
roofSelection><frontPanalSelection>Bamboo</frontPanalSelection></
step1><step2><customBarTop>None</customBarTop></
step2><step3><accessories>None</accessories></step3><step4><order
OrderTotal="4625" OrderNumber="50480"><firstname></
firstname><lastname /><address></address><city></city><state>AL</
state><zip></zip><phone></phone><email></email><username></
username><password></password><cardname></cardname><cardnum></
cardnum><cardexp>/</cardexp><cardtype>Visa</cardtype></order></
step4></customizebar>
Mapping Model:
<model>
<entity name="CustomBar" xmlTag="customizebar"
ignoreUnmappedTags="YES">
<property name="roof" xmlTag="roofSelection" />
<property name="front" xmlTag="frontPanalSelection" />
</entity>
<entity name="CustomBar" xmlTag="CustomBarTop"
ignoreUnmappedTags="YES">
<property name="customName" xmlTag="CustomName"
attribute="YES" />
</entity>
<entity name="Orders" xmlTag="order" ignoreUnmappedTags="YES">
<property name="orderTotal" xmlTag="OrderTotal"
attribute="YES" />
<property name="orderNumber" xmlTag="OrderNumber"
attribute="YES" />
</entity>
</model>
I'm trying everything thing here and trying not to go insane.....
On Sep 8, 2005, at 2:05 PM, Nathan Walker wrote:
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.mappingModelWi
thXMLFile(_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:
40visionworxpro.com
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects
developers who want to increase their overall knowledge of
WebObjects, or those who are trying to solve specific application
development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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