I'm parsing an MXML document and then creating the elements. This would
allow me to show a live preview of an MXML document at runtime. So far what
I have is based using my own XML document that has a list of components in
where the node name was a one to one match with a qualified class name.

<components>
    <component name="Button" class="spark.components.Button"/>
</components>

And I have been, for the time being, mostly ignoring the namespace and just
using the Spark component set.

But now it's necessary to support separate namespaces and each namespace
can have it's own user defined prefix. So my goal now is to parse an MXML
document and get the correct class for the XML node.

I'm having difficulty with this. Mainly there are four parts that are
interrelated: the prefix, the namespace, the node name and the definition.

I've found a few things to help though. SimpleXMLEncoder, XMLEncoder,
XMLDecoder, SchemaTypeRegistry, SchemaManager. These are all Flex excluded
classes.

I have something working but it's hacky, and it feels like something is
missing so I don't want to start off on that and it's fragile since it
doesn't handle certain scenarios. Before I post any of the code I've been
working on can someone suggest how they'd do it?

Plus, using the classes above, like SchemaManager and SchemaTypeRegistry
etc, it seems they expect an XSD for the object definitions (like Button).
I couldn't find and XSD for the Adobe or Apache Flex component set. Up
until now I've been able to parse MXML using the information in the
metadata of the classes and that seems to work fine for the most part but
again I wouldn't mind hearing suggestions on that as well.

Also, I'm attempting to parse an MXML document at *runtime*, not compile
time.

PS. Some research has lead me to ~FlexSDK/frameworks/flex-config.xml. That
file lists namespaces and manifests that list the classes in those
namespaces.

Reply via email to