PureMVC
Home
About
Code
Docs
FAQ
Forums
News
Showcase
Contact
Jobs
Welcome,
Guest
. Please
login
or
register
.
May 18, 2013, 04:59:25 PM
News:
ATTENTION: Spambots must die! Humans must visit
http://contact.futurescale.com
to request forum access.
PureMVC Architects Lounge
Announcements and General Discussion
Architecture
XML content docking proxy solution
Pages: [
1
]
« previous
next »
Author
Topic: XML content docking proxy solution (Read 2238 times)
uncleunvoid
Full Member
Posts: 27
XML content docking proxy solution
«
on:
November 27, 2009, 09:39:12 AM »
here is what I started implementing:
a collection of 'docked' xml files that describe my content (pages.xml, layouts.xml, colors.xml, etc.)
i want to put them in separate xmlfilecontent proxies and then have search functions that retrieve the data when necessary.
problem is: some objects described in the xml have IDs instead of values. e.g. an element in the layout had the color 0xff0000. in the xml of layout.xml there is a subnode with <color>myred</color>. The actual color value is in the color.xml as a color node.
how do I stitch that data together, so that I can use a complete layout object in flash without coupling those proxies too much?
Logged
puremvc
Global Moderator
Hero Member
Posts: 2790
Re: XML content docking proxy solution
«
Reply #1 on:
November 27, 2009, 11:57:46 AM »
If you are working in AIR, you might want to look at the XMLDatabaseProxy Utility.
Otherwise, I'd look at doing a 'smart VO' that wraps the XML and can be smart about things like whether the field has a hex number or a text description.
See an example of a 'Smart VO' here:
http://forums.puremvc.org/index.php?topic=1293.msg5973#msg5973
-=Cliff>
Logged
uncleunvoid
Full Member
Posts: 27
Re: XML content docking proxy solution
«
Reply #2 on:
November 27, 2009, 03:47:57 PM »
that example is part of what I am looking for , yet the bigger question is two-fold , so lets just start with teh first:
if the color is in another VO (because it comes from another xml) who do I infuse the color into the VO that only carries the indentifier of the color?
Logged
puremvc
Global Moderator
Hero Member
Posts: 2790
Re: XML content docking proxy solution
«
Reply #3 on:
November 28, 2009, 02:02:37 AM »
I guess I don't really understand what it is you're trying to do. Perhaps if you could elaborate a bit more...
Logged
uncleunvoid
Full Member
Posts: 27
Re: XML content docking proxy solution
«
Reply #4 on:
November 28, 2009, 07:53:19 AM »
certainly:
I am using VOs to describe textformats, etc. by xml. At some point I then only have to use the data of the VO to populate the textformat's properties.
In the case of color, I use a either a String Id (e.g. 'darkGrey') to indicate the color value. The color value is stored on another object (on a VO) withe the Id 'darkGrey. This let's me store some kind of color palette for my projects.
Now when I populate the textformat, then I need to use the numeric value. So how best and when would I get the color value through the VO that holds the actual value. How do I merge the two VOs (textformat description and color description) to end up with a complete textformat description and with leaving the original VOs intact as much as possible.
Logged
puremvc
Global Moderator
Hero Member
Posts: 2790
Re: XML content docking proxy solution
«
Reply #5 on:
November 29, 2009, 08:07:51 AM »
So in at least one of these xml files you must have the color name and hex code stored together. Somewhere for lookup, you must have a tag with both attributes. I'll assume this is a color vo. Then you have another xml file with references to color names, but at runtime, you want that color name expanded to a color vo. One proxy fetchs the color xml and holds the color vos, while other reads in the xml that has the color references by name. This other vo should have a color vo for a property. When its proxy is assembling the vos, it should retrieve the color proxy and request the color vo for the color name and set it (or a copy) on the new other vo. It uses the color proxy as a lookup.
-=Cliff>
Logged
uncleunvoid
Full Member
Posts: 27
Re: XML content docking proxy solution
«
Reply #6 on:
November 30, 2009, 02:53:11 AM »
yes cliff, thats exactly what I need, or basically , How i have it for now, yet I would like to maintain the IDs for later saving of the xmls (where the IDs shoudl be used again, not the values)
a probably simple way would be to have a switch function that switches IDs to values and back, but then again there might be two different IDs using the same value. (as we will have external users and internal default palettes, this is a possible scenario)
So the aim is to build a getter setter system that can deliver the right values without changing the ID on the VO's data source.
Donno if that might be over-complicating things.
Maybe I should just go with the switch solution till I run into problems.
Logged
puremvc
Global Moderator
Hero Member
Posts: 2790
Re: XML content docking proxy solution
«
Reply #7 on:
November 30, 2009, 01:30:40 PM »
This doesn't return color vos or anything, but just quickly, if you had:
Code:
<colors>
<color name="green" value="0x00FF00" />
<color name="grass" value="0x00FF00" />
<color name="red" value="0xFF0000"/>
</colors>
You could support lookup of color name to value and visaversa and still have multiple color names pointing to the same color value by doing something like this:
Code:
public class ColorProxy extends Proxy
{
public static const NAME:String = "ColorProxy";
public function ColorProxy( xml:XML )
{
super ( NAME, xml );
}
// get the color value associated with the given color name
public function getColorValueByName( name:String ):String
{
var elements:XMLList = xml..color.[@name==name];
return (elements.length > 0)?elements[0].@value.toString():'';
}
// get the first color name associated with the given color value
public function getColorNameByValue( value:String ):String
{
var elements:XMLList = xml..color.[@value==value];
return (elements.length > 0)?elements[0].@name.toString():'';
}
protected function get xml():XML
{
return data as XML;
}
}
}
-=Cliff>
Logged
uncleunvoid
Full Member
Posts: 27
Re: XML content docking proxy solution
«
Reply #8 on:
December 01, 2009, 02:44:44 AM »
wow,
thanks for that reply.
I will have a thorough look at it, but this looks fairly feasible.
Some of the docked xml are a bit more complex, but this solution should bring me a good step ahead.
thanks a lot.
Logged
Pages: [
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Announcements and General Discussion
-----------------------------
=> General Discussion
=> Getting Started
=> Architecture
=> Public Demos, Tools and Applications
===> Fabrication
-----------------------------
PureMVC Manifold
-----------------------------
=> Port Authority
===> Contributor Central
===> Client Side
===> Server Side
=> Port to AS2
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to AS3
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to ColdFusion
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to C++
===> MultiCore Version
=====> Demos and Utils
=====> Bug Report
=> Port to CSharp
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to Dart
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to Haxe
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to Java
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to JavaScript
===> Demos and Utils
===> Native JS Branch
=====> Bug Report
===> PrototypeJS Branch
=====> Bug Report
===> Objs Branch
=====> Bug Report
===> MooTools Branch
=====> Bug Report
===> ExtJS Branch
=====> Bug Report
=> Port to Objective C
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to Perl
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to PHP
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to Python
===> Standard Version
=====> Bug Report
=====> Demos and Utils
===> MultiCore Version
=====> Bug Report
=====> Demos and Utils
=> Port to Ruby
===> Standard Version
=====> Bug Report
=====> Demos and Utils
=> Port to TypeScript
===> Standard Version
=====> Bug Report
=====> Demos and Utilities
===> MultiCore Version
=====> Bug Report
=====> Demos and Utilities
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Powered by SMF 1.1.11
|
SMF © 2006-2007, Simple Machines LLC
Loading...
Copyright © 2006-2008 Futurescale, Inc.