Aide - Type de tout ce qu'il faut de travail...mais bon de ne pas:)

  • playboxdesign
  • Born
  • Born
  • Avatar de l’utilisateur
  • Inscription: Juin 15, 2010
  • Messages: 3
  • Loc: UK
  • Status: Offline

Message Juin 15th, 2010, 3:12 am

Ceci est mon code (il semble plutôt étrange, mais fonctionne en partie):

Code: [ Select ]
UnitdataXML = new XML();
UnitdataXML.ignoreWhite = true;

UnitdataXML.onLoad = myLoad;
UnitdataXML.load("Moodle.xml");

function myLoad(ok) {
    if (ok == true) {
        Publish(this.firstChild);
    }
}

function Publish(UnitdataXMLNode) {
    if (UnitdataXMLNode.nodeName.toUpperCase() == "UNIT") {
        content = "";

        unit_info = UnitdataXMLNode.firstChild;


        while (unit_info != null) {
            if (unit_info.nodeName.toUpperCase() == "UNIT_INFO") {
                uno = "";
                uname = "";
                loutcomes = "";
                pass = "";
                merit = "";
                distinction = "";
            }
            element = unit_info.firstChild;
            //////////////////////////////////////////////////////////////////////////


            while (element != null) {
                if (element.nodeName.toUpperCase() == "UNO") {
                    uno = element.firstChild.nodeValue;
                }
                if (element.nodeName.toUpperCase() == "UNAME") {
                    uname = element.firstChild.nodeValue;
                }
                if (element.nodeName.toUpperCase() == "LOUTCOMES") {
                    loutcomes = element.firstChild.nodeValue;
                }
                if (element.nodeName.toUpperCase() == "PASS") {
                    pass = element.firstChild.nodeValue;
                }
                if (element.nodeName.toUpperCase() == "MERIT") {
                    merit = element.firstChild.nodeValue;
                }
                if (element.nodeName.toUpperCase() == "DISTINCTION") {
                    distinction = element.firstChild.nodeValue;
                }
                element = element.nextSibling;
            }
            unit_info = unit_info.nextSibling;
            //////////////////////////////////////////////////////////////////////
        }
        unitH_txt.htmlText = "<font size='18' color='#00CC00'>"+uno+"</font>";
        unitT_txt.htmlText = "<font size='16'>"+uname+"</font>";


        loutcomes = UnitdataXMLNode.firstChild.childNodes[2].childNodes;
        //trace(loutcomes.length)
        for (i=0; i<loutcomes.length; i++) {
            var num = i+1;
            var info = UnitdataXMLNode.firstChild.childNodes[2].childNodes[i].firstChild.nodeValue;
            Mix += "<LI>"+info+"</LI>";
            //trace("LO"+num+" = "+info+".");
        }
        pass = UnitdataXMLNode.firstChild.childNodes[3].childNodes;
        //trace (pass.length);
        for (j=0; j<pass.length; j++) {
            var num = j+1;
            var info2 = UnitdataXMLNode.firstChild.childNodes[3].childNodes[j].firstChild.nodeValue;
            passInfo += "<LI>"+info2+"</LI>";
            //trace ("P"+num+" = "+info2+".")
        }
        merit = UnitdataXMLNode.firstChild.childNodes[4].childNodes;
        for (k=0; k<merit.length; k++) {
            var num = k+1;
            var info3 = UnitdataXMLNode.firstChild.childNodes[4].childNodes[k].firstChild.nodeValue;
            meritInfo += "<LI>"+info3+"</LI>";
        }
        dist = UnitdataXMLNode.firstChild.childNodes[5].childNodes;
        for (l=0; l<dist.length; l++) {
            var num = l+1;
            var info4 = UnitdataXMLNode.firstChild.childNodes[5].childNodes[l].firstChild.nodeValue;
            distInfo += "<LI>"+info4+"</LI>";
        }
        LO = "<font size='12'><UL>"+Mix+"</UL></font>";
        l1_txt.htmlText = LO;

    }
}
  1. UnitdataXML = new XML();
  2. UnitdataXML.ignoreWhite = true;
  3. UnitdataXML.onLoad = myLoad;
  4. UnitdataXML.load("Moodle.xml");
  5. function myLoad(ok) {
  6.     if (ok == true) {
  7.         Publish(this.firstChild);
  8.     }
  9. }
  10. function Publish(UnitdataXMLNode) {
  11.     if (UnitdataXMLNode.nodeName.toUpperCase() == "UNIT") {
  12.         content = "";
  13.         unit_info = UnitdataXMLNode.firstChild;
  14.         while (unit_info != null) {
  15.             if (unit_info.nodeName.toUpperCase() == "UNIT_INFO") {
  16.                 uno = "";
  17.                 uname = "";
  18.                 loutcomes = "";
  19.                 pass = "";
  20.                 merit = "";
  21.                 distinction = "";
  22.             }
  23.             element = unit_info.firstChild;
  24.             //////////////////////////////////////////////////////////////////////////
  25.             while (element != null) {
  26.                 if (element.nodeName.toUpperCase() == "UNO") {
  27.                     uno = element.firstChild.nodeValue;
  28.                 }
  29.                 if (element.nodeName.toUpperCase() == "UNAME") {
  30.                     uname = element.firstChild.nodeValue;
  31.                 }
  32.                 if (element.nodeName.toUpperCase() == "LOUTCOMES") {
  33.                     loutcomes = element.firstChild.nodeValue;
  34.                 }
  35.                 if (element.nodeName.toUpperCase() == "PASS") {
  36.                     pass = element.firstChild.nodeValue;
  37.                 }
  38.                 if (element.nodeName.toUpperCase() == "MERIT") {
  39.                     merit = element.firstChild.nodeValue;
  40.                 }
  41.                 if (element.nodeName.toUpperCase() == "DISTINCTION") {
  42.                     distinction = element.firstChild.nodeValue;
  43.                 }
  44.                 element = element.nextSibling;
  45.             }
  46.             unit_info = unit_info.nextSibling;
  47.             //////////////////////////////////////////////////////////////////////
  48.         }
  49.         unitH_txt.htmlText = "<font size='18' color='#00CC00'>"+uno+"</font>";
  50.         unitT_txt.htmlText = "<font size='16'>"+uname+"</font>";
  51.         loutcomes = UnitdataXMLNode.firstChild.childNodes[2].childNodes;
  52.         //trace(loutcomes.length)
  53.         for (i=0; i<loutcomes.length; i++) {
  54.             var num = i+1;
  55.             var info = UnitdataXMLNode.firstChild.childNodes[2].childNodes[i].firstChild.nodeValue;
  56.             Mix += "<LI>"+info+"</LI>";
  57.             //trace("LO"+num+" = "+info+".");
  58.         }
  59.         pass = UnitdataXMLNode.firstChild.childNodes[3].childNodes;
  60.         //trace (pass.length);
  61.         for (j=0; j<pass.length; j++) {
  62.             var num = j+1;
  63.             var info2 = UnitdataXMLNode.firstChild.childNodes[3].childNodes[j].firstChild.nodeValue;
  64.             passInfo += "<LI>"+info2+"</LI>";
  65.             //trace ("P"+num+" = "+info2+".")
  66.         }
  67.         merit = UnitdataXMLNode.firstChild.childNodes[4].childNodes;
  68.         for (k=0; k<merit.length; k++) {
  69.             var num = k+1;
  70.             var info3 = UnitdataXMLNode.firstChild.childNodes[4].childNodes[k].firstChild.nodeValue;
  71.             meritInfo += "<LI>"+info3+"</LI>";
  72.         }
  73.         dist = UnitdataXMLNode.firstChild.childNodes[5].childNodes;
  74.         for (l=0; l<dist.length; l++) {
  75.             var num = l+1;
  76.             var info4 = UnitdataXMLNode.firstChild.childNodes[5].childNodes[l].firstChild.nodeValue;
  77.             distInfo += "<LI>"+info4+"</LI>";
  78.         }
  79.         LO = "<font size='12'><UL>"+Mix+"</UL></font>";
  80.         l1_txt.htmlText = LO;
  81.     }
  82. }


et mon XML:

Code: [ Select ]
<UNIT>
 <UNIT__INFO>
  <UNO>Unit 8:</UNO>
  <UNAME>Design and Principles in Art and Design</UNAME>
  <LOUTCOMES>
   <LO1>Understand how form relates to function in their own work</LO1>
   <LO2>Be able to use appropriate materials in own work</LO2>
   <LO3>Know how cultural associations affect their own work</LO3>
   <LO4>Understand design for need and the repsonsibilities of designners</LO4>
  </LOUTCOMES>
  <PASS>
   <P1>Explain how form relates to function in their own work</P1>
   <P2>Use appropriate materials in their own design work</P2>
   <P3>Explain how cultural associations affect their own work</P3>
   <P4>Explain design for need and the responsibilities of the designer</P4>
  </PASS>
  <MERIT>
   <M1>Demonstrate skills and understanding in applying aesthetic considerations to functional requirements in their finished design work</M1>
   <M2>Show an effective and considered understanding of applying design principles when producing their own work</M2>
  </MERIT>
  <DISTINCTION>
   <D1>Show an independent approach to research and the application of innovative design ideas.</D1>
   <D2>Show how the evaluation undertaken in the designs stages has been applied to the development and production of exciting, coherent and individual design work.</D2>
  </DISTINCTION>
 </UNIT_INFO>
</UNIT>
  1. <UNIT>
  2.  <UNIT__INFO>
  3.   <UNO>Unit 8:</UNO>
  4.   <UNAME>Design and Principles in Art and Design</UNAME>
  5.   <LOUTCOMES>
  6.    <LO1>Understand how form relates to function in their own work</LO1>
  7.    <LO2>Be able to use appropriate materials in own work</LO2>
  8.    <LO3>Know how cultural associations affect their own work</LO3>
  9.    <LO4>Understand design for need and the repsonsibilities of designners</LO4>
  10.   </LOUTCOMES>
  11.   <PASS>
  12.    <P1>Explain how form relates to function in their own work</P1>
  13.    <P2>Use appropriate materials in their own design work</P2>
  14.    <P3>Explain how cultural associations affect their own work</P3>
  15.    <P4>Explain design for need and the responsibilities of the designer</P4>
  16.   </PASS>
  17.   <MERIT>
  18.    <M1>Demonstrate skills and understanding in applying aesthetic considerations to functional requirements in their finished design work</M1>
  19.    <M2>Show an effective and considered understanding of applying design principles when producing their own work</M2>
  20.   </MERIT>
  21.   <DISTINCTION>
  22.    <D1>Show an independent approach to research and the application of innovative design ideas.</D1>
  23.    <D2>Show how the evaluation undertaken in the designs stages has been applied to the development and production of exciting, coherent and individual design work.</D2>
  24.   </DISTINCTION>
  25.  </UNIT_INFO>
  26. </UNIT>


Toute conseils sur ce que je peux faire pour ranger It Up s'il vous plaît????
Attachments:
FlaFile.zip

(85.09 Kio) Téléchargé 174 fois

Attachments:
FlaFile.zip

(85.09 Kio) Téléchargé 174 fois

  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Juin 15th, 2010, 3:12 am

  • graphixboy
  • Control + Z
  • Mastermind
  • Avatar de l’utilisateur
  • Inscription: Juil 11, 2005
  • Messages: 1828
  • Loc: In the Great White North
  • Status: Offline

Message Juin 18th, 2010, 9:05 am

Whats-il censé faire, elle ne le fait pas?
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • playboxdesign
  • Born
  • Born
  • Avatar de l’utilisateur
  • Inscription: Juin 15, 2010
  • Messages: 3
  • Loc: UK
  • Status: Offline

Message Juin 18th, 2010, 9:59 am

Il est le "undefined" lorsque vous appuyez sur le PM et D boutons. L'information vient mais je pense que c'est le nœud principal à savoir la

noeud Pass - qui n'est pas défini
alors que les 4 nœuds à l'intérieur il ya autorisé.

J'ai bidouillé genre de morceaux de code à partir d'un couple de tutoriels.

Je ne voulais pas codées en dur, j'ai voulu charger le xml et la boucle à travers les nœuds, les nœuds enfants et leurs enfants en utilisant les noeuds. longueur etc

Donc, je veux 3 boucles imbriquées -, mais je devenais alors confondue avec la syntaxe pour les nœuds. Je voudrais vraiment quelque ordre non le code codées en dur. J'allais commencer dans le code pseudo pour essayer de travailler tout ça à partir de là...genre de perdu un peu de vapeur d'eau en ce moment, il faisait mon mal à la tête :)
  • playboxdesign
  • Born
  • Born
  • Avatar de l’utilisateur
  • Inscription: Juin 15, 2010
  • Messages: 3
  • Loc: UK
  • Status: Offline

Message Juin 18th, 2010, 10:09 am

ps. voulaient utiliser des "matrices" ne peuvent tout simplement ne pas fonctionner si j'ai besoin de 3 pour les boucles imbriquées 3 ou quoi.

Tout conseil serait très apprécié Graphixboy, je vous remercie

Afficher de l'information

  • Total des messages de ce sujet: 4 messages
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 55 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC