Comunidad de diseño web y desarrollo en internet online

XML con html tags en un Tree (no funca, ayuda porfi)

Citar            
MensajeEscrito el 18 Jul 2008 01:38 pm
Hola, quiero que mi componente Tree tome datos de un xml sea cual fuere el tipo de datos.
Éste es mi código:
//El xml:

Código :

<node titulo="Noticias">
        <node titulo="Nodo 1">
            <node titulo="sdfg sdajgl kjghvlady dsfghk ds" texto="sdfhklsdf kjghsdf jkgh dskjfkj gkghdsfjkguiy sdfgasdkjg"/>
        </node>
        <node titulo="Nodo 2">
            <node titulo="cxnvbjhsdt ewtsdf" texto="perity dffa teru u dsfhg hg"/>
        </node>
        <node titulo="Nodo 3">
            <node titulo="dsafgt er ytr adsfhg dfhgae" texto="opiuwes hjgdsfy eert uasdoi dg dge eyut dhfjh aeyjht"/>
        </node>
</node>   


//La aplicación AIR:

Código :

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();" layout="absolute">
<mx:Script>
<![CDATA[
            import mx.events.MenuEvent;
            import mx.controls.Alert;
            import mx.collections.*;
            import mx.events.ItemClickEvent;
            import mx.collections.ArrayCollection;
            import flash.desktop.DockIcon;
            import flash.desktop.InteractiveIcon;
            import flash.desktop.NativeApplication;
            import flash.desktop.SystemTrayIcon;
            import flash.display.Shape;
            import mx.controls.FlexNativeMenu;            
//////////////////////////////TREE////////////////////////////////////////////
            [Bindable]
            public var selectedNode:XML;
            //controlador de eventos del Tree control
            public function treeChanged(event:Event):void {
                selectedNode=Tree(event.target).selectedItem as XML;
            }
////////////////////////////FIN TREE//////////////////////////////////////////
/////////////////////////////XML EXTERNO///////////////////////////////////////        
        private var loader:URLLoader;
            [Bindable]
            private var xml:XML;
            private function init():void{
            var xml:XML = new XML();
            loader = new URLLoader(new URLRequest("xml/prueba_cdata.xml"));
            loader.addEventListener(Event.COMPLETE, handleEvent);
            }
            private function handleEvent(e:Event):void{
            xml = XML(URLLoader(e.target).data);
            }
/////////////////////////////////FIN XML EXTERNO///////////////////////////////////
]]>
</mx:Script>
        <mx:HDividedBox width="100%" height="100%" label="PopUpMenuButton" x="0" y="0">
            <mx:Tree id="myTree" height="100%" width="50%" labelField="@titulo" showRoot="false" dataProvider="{xml}" change="treeChanged(event)"/>            
            <mx:Text height="100%" width="50%" text="{selectedNode.@texto}"/>
        </mx:HDividedBox>
</mx:WindowedApplication>


Funciona si los datos son convencionales, pero si contiene etiquetas html no me levanta ningún dato. Si pongo los nodos entre etiquetas "<![CDATA[ ]]>", me carga incluso los nodos, y no es lo ideal. Por ejemplo:

Código :

<node titulo="Noticias">
<![CDATA[
        <node titulo="Nodo 1">
            <node titulo="<strong>sdfg sdajgl kjghvlady</strong> dsfghk ds" texto="sdfhklsdf kjghsdf jkgh dskjfkj gkghdsfjkguiy sdfgasdkjg"/>
        </node>
]]>
</node>   


Me levanta el nodo entero. Cómo podría hacer para que mi aplicación cargue cualquier tipo de datos? (mas que nada me refiero a que sea compatible con etiquetas html). Denme links o algo de información al respecto por favor,
Gracias.

Por COOKERNATOR

43 de clabLevel



Genero:Masculino  

msie7
Citar            
MensajeEscrito el 18 Jul 2008 01:50 pm
proba de esta manera

Código :

<node titulo="Noticias">

        <node titulo="Nodo 1">
<![CDATA[<strong>sdfg sdajgl kjghvlady</strong> dsfghk ds" texto="sdfhklsdf kjghsdf jkgh dskjfkj gkghdsfjkguiy sdfgasdkjg]]>
        </node>

</node> 


el texto dentro de los <![CDATA[]]> no la estructura XML.

Por phoxer

Claber

827 de clabLevel

4 tutoriales

Genero:Masculino  

Ing en Sistemas

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.