Ok, that fixes the problem, but it doesn't explain why the problem was happening in the first place. Or it doesn't explain why the first three examples ever worked. Nowhere in my application did I ever define a default namespace. In all 4 cases when I trace "data.namespace().uri" I get " http://www.w3.org/2000/svg" regardless of whether I do the trace before or after setting the default namespace.
Is this a bug? I'm running the exact same line of code each time. The only thing I can think of is that the source of the XML is different. The first 3 are created through deserialization from the server. The 4th is just the normal XML constructor. I do see why this would matter. - Daniel Freiman On Thu, Nov 19, 2009 at 12:55 AM, Tracy Spratt <[email protected]> wrote: > > > This declaration, “xmlns="http://www.w3.org/2000/svg"” sets the default > namespace that is appended to every node name that is not qualified by some > other namespace. Unless you declare it in AS, you will not be able to > access nodes like “data”. > > > > Try this declaration, at instance (global) level scope: > > default xml namespace = "http://www.w3.org/2000/svg"; > > > > Tracy Spratt, > > Lariat Services, development services available > ------------------------------ > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of *Daniel Freiman > *Sent:* Thursday, November 19, 2009 12:42 AM > *To:* [email protected] > *Subject:* [SPAM] Re: [SPAM] Re: [SPAM] Re: [flexcoders] XML e4x error > > > > > > I think I tried that already but I'll double check in the morning. > > Based on the XML and the code, isn't the default namespace already defined > and shouldn't e4x be already using it? > > - Daniel Freiman > > On Wed, Nov 18, 2009 at 11:46 PM, Tracy Spratt <[email protected]> wrote: > > > > What happens if you declare the default namespace, then do: > > > > data.pa...@d > > > > Tracy Spratt, > > Lariat Services, development services available > ------------------------------ > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of *Daniel Freiman > *Sent:* Wednesday, November 18, 2009 8:37 PM > *To:* [email protected] > *Subject:* [SPAM] Re: [SPAM] Re: [flexcoders] XML e4x error > > > > > > I've stated the symptom. As you can see in the given XML, there is a child > named path. So I should be getting value for that code instead of a null > error. I don't know why it's not picking it up. My best guess is that it > is because of namespaces, but I can't see a differences between the XML > objects that this code works for, and the one it doesn't work for. The > "[0]" should be optional (at least relative to getting a null value or > not). I'm not sure how else to state my goal other than how the expression > is already written. I want the "d" attribute of the "path" child and I want > it to work for all of the cases I've supplied or find the reason why it's > not working so I can fix the last case. Right now it is only working for 3 > out of 4. > > - Daniel Freiman > > On Wed, Nov 18, 2009 at 4:09 PM, Tracy Spratt <[email protected]> wrote: > > > > Didn’t you state the problem yourself? With an expression: > > data.path[...@d[0] > > If there is no path[0], then you would expect the error. > > > > Why are you using the [0] syntax? Is it because of the namespaces? What > is the actual goal of your expression? > > > > Tracy Spratt, > > Lariat Services, development services available > ------------------------------ > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of *Daniel Freiman > *Sent:* Wednesday, November 18, 2009 3:53 PM > *To:* [email protected] > *Subject:* [SPAM] Re: [flexcoders] XML e4x error > > > > > > I've tried that previously. There wasn't any difference, which should be > expected given the request path. > > - Daniel Freiman > > On Wed, Nov 18, 2009 at 3:46 PM, InvertedSpear <[email protected]> > wrote: > > > > > The only thing I can see in the one that is giving you a problem is > different > from the others is there is a <text /> tag. The one above it has a > <text></text> pair. This could be being read as a null text instead of a 0 > length string. Try changing that and let us know. > > ~Mike > > > > Daniel Freiman wrote: > > > > I'm running the following line of code on XML objects and getting > > inconsistent results: > > > > data.path[...@d[0] > > > > In 3 cases, I get a valid answer. In the last case, data.path[0] == null > > and thus errors. > > Can anyone see any difference? > > The valid XML are: > > > > <g transform="matrix(0 -1 1 0 50 112.5)" improv:classname="image" > > id="Object07B" xmlns="http://www.w3.org/2000/svg" xmlns:pdf=" > > http://ns.adobe.com/pdf/2006" xmlns:xlink="http://www.w3.org/1999/xlink" > > xmlns:improv="http://ns.colorquick.com/improv/mars"> > > <image height="75" width="75" x="12.5" xlink:href="/images/Smiley.png" > > y="150" improv:rotation="-90"/> > > <path d="M 12.5 150 L 87.5 150 L 87.5 75 L 12.5 75 C 22.5 65 22.5 > > 160 > > 12.5 150" stroke-width="0" improv:classname="border"/> > > </g> > > <g transform="matrix(1 0 0 1 150 112.5)" improv:classname="image" > > id="ObjectD6B" xmlns="http://www.w3.org/2000/svg" xmlns:pdf=" > > http://ns.adobe.com/pdf/2006" xmlns:xlink="http://www.w3.org/1999/xlink" > > xmlns:improv="http://ns.colorquick.com/improv/mars"> > > <image height="75" width="75" x="112.5" xlink:href="/images/Smiley.jpg" > > y="75" improv:rotation="0"/> > > <path d="M 112.5 75 L 187.5 75 L 187.5 150 L 112.5 150 C 122.5 140 > > 122.5 85 112.5 75" stroke-width="0" improv:classname="border"/> > > </g> > > <g transform="matrix(1 0 0 1 10 430)" improv:classname="text" > > id="Object817" > > xmlns="http://www.w3.org/2000/svg" > > xmlns:pdf="http://ns.adobe.com/pdf/2006" > > xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:improv=" > > http://ns.colorquick.com/improv/mars"> > > <text fill="rgb(0,0,0)" font-family="F1" font-size="12" x="10" > > y="420.763671875" improv:rotation="0" width="289.9453125" > > height="11.26171875">Ipsor Lopsumething and other things that will test > > stuff.</text> > > <path d="M 10 420.763671875 L 299.9453125 420.763671875 L 299.9453125 > > 432.025390625 L 10 432.025390625 L 10 420.763671875" stroke-width="0" > > improv:classname="border"/> > > </g> > > > > The XML that throws the error is: > > > > <g transform="matrix(1 0 0 1 0 0)" improv:classname="text" id="ObjectE68" > > xmlns="http://www.w3.org/2000/svg" > > xmlns:pdf="http://ns.adobe.com/pdf/2006" > > xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:improv=" > > http://ns.colorquick.com/improv/mars"> > > <text fill="rgb(0,0,0)" font-family="Arial" font-size="12" x="57.1" > > y="185.2" improv:rotation="0" width="97.65" height="92"/> > > <path d="M 57.1 185.2 L 154.75 185.2 L 154.75 277.2 L 57.1 277.2 L 57.1 > > 185.2" stroke-width="0" improv:classname="border"/> > > </g> > > > > > > -- > View this message in context: > http://old.nabble.com/XML-e4x-error-tp26415121p26415423.html > Sent from the FlexCoders mailing list archive at Nabble.com. > > > > > > > >

