SharpStyle Labs

Creativity is coming up with new things. Innovation is doing new things. We make software that helps you do both.

  • Pages

  • a

  • Archives

Flex Builder 3 Beta 2 — "default xml namespace" issue

Posted by sharpstyle on October 16, 2007

This one seems to be documented here: https://bugs.adobe.com/jira/browse/ASC-2800

Consider the following:

for each (var element : XML in _samplePresetsXml.children())
{
    var ns : Namespace = new Namespace(element.namespace());
   
default xml namespace = ns;
    ….

line with "default xml…" throws the following error during launch:

VerifyError: Error #1025: An invalid register 2 was accessed.
      at PresetsConfiguration/_PresetsConfiguration_XML1_i()
      at PresetsConfiguration()[D:\Work\Flex3\PresetsConfiguration\PresetsConfiguration.mxml:114]
      at _PresetsConfiguration_mx_managers_SystemManager/create()
      at mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\flex_3_beta2sdk\frameworks\projects\framework\src\mx\managers\SystemManager.as:2428]
      at mx.managers::SystemManager/docFrameHandler()[E:\dev\flex_3_beta2sdk\frameworks\projects\framework\src\mx\managers\SystemManager.as:2320]

While the following two variants work completely fine:

var ns : Namespace = new Namespace(_samplePresetsXml.namespace());
for each (var element : XML in _samplePresetsXml.children())
{
   
ns = new Namespace(element.namespace());
   
default xml namespace = ns;
    …

OR

var ns : Namespace = new Namespace(_samplePresetsXml.namespace());
for each (var element : XML in _samplePresetsXml.children())
{
    default xml namespace = ns;
    …

My XML is pretty straightfoward:

<?xml version="1.0" standalone="yes"?>
<Examples xmlns=http://tempuri.org/Examples.xsd>
  <Example>
    <Id>17d4d7f6-d7d4-4de4-b8b9-e04a5ea5d35b</Id>
    ….

A piece of advice: when working with XML, get to know namespaces and what role they play in retrieving node values. In reference to above, this is how you would get to GUID in ID if not using "default xml namespace" directive:

trace(">>" + element.ns::Id.text());

Mike Grushin
CTO

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>