XML Assistance Please and Thank You!
              in 
             Programming Questions 
              •  
              1 year ago    
            
 
           
             Hello everyone,
            
             
            
            
             
            
            
             
            
            
             
            
            
             
              
             
             
                
             
             
                
             
             
                
             
             
              
             
             
                
             
             
              
             
             
                 
             
             
                
             
             
            
             
            
            
             
            
            
             
            
            
             
            
            
             
            
             
            
            
             
            
            
             
            
            
             
             
           
 
            
           
             I am having a hard time getting my text to appear from my XML file onto the screen; I have no idea where I went wrong, but I have tried nearly everything to fix this. Here is my code.
            
            
             --------------------------------------------------------------------------------------------------------------------------------------------
            
            
              XMLElement xml;//enables xml to be used.
             
             
              //BrownBlock myBrownBlock;//object 1
             
             
              //BrownBlock myBrownBlock2;//object 2
             
             
              void setup() {//initial setup of sketch.
             
             
                size(screen.width, screen.height);//actual size of the window  at school is 1920 by 1200.
             
             
                background(113, 105, 58);//color of background.
             
             
                smooth();//antialiasing on.
             
             
                noStroke();//no stroke will be given.
             
             
                PFont  font;//calling the font function and calling the font "font".
             
             
                PImage img2;//calling second image.
             
             
                PImage img;//calling the image function and calling it "img".
             
             
                PImage img3;//calling third image.
             
             
                PImage img4;//calling fourth image.
             
             
                PImage img5;//calling fifth image.
             
             
                PImage img6;//calling sixth image.
             
             
                PImage img7;//calling seventh image.
             
             
                PImage img8;//calling eighth image.
             
             
                img = loadImage("mmnhLogo.png");//loading my image in.
             
             
                image(img, 80, 70);//naming the image specifically with the variable name "img" and positioning it.
             
             
                img2 = loadImage("wolf1.png");//loading image number 2 in.
             
             
                img3 = loadImage("wolf2.png");//loading in image number 3.
             
             
                img4 = loadImage("wolf3.png");//loading in image 4.
             
             
                img5 = loadImage("caribou1.png");//loading in image 5.
             
             
                img6 = loadImage("caribou2.png");//loading in sixth image.
             
             
                img7 = loadImage("muskOx1.png");//loading in seventh image.
             
             
                img8 = loadImage("muskOx2.png");//loading in eighth image.
             
             
                font = loadFont("FelixTitlingMT-30.vlw");//loading in the font I desire.
             
             
                textFont(font);//calling in the font I am actually going to be using; "font"
             
             
                fill(245, 239, 215);//the fill of the text.
             
             
                text("Midwest Museum of Natural History", 210, 125);//text and their coordinates.
             
             
                font = loadFont("FelixTitlingMT-80.vlw");//loading a different font into the sketch.
             
             
                textFont(font);//calling it "font".
             
             
                text("Ice Age", 210, 240);//more text and coordinates.
             
             
                  image(img2,610,400);//coordinates of the second image.
             
             
                  image(img3,800,400);//coordinates of the third image.
             
             
                  image(img4,990,400);//coordinates of the fourth image.
             
             
                  image(img5,740,560);//coordinates for the fifth image.
             
             
                  image(img6, 890,560);//coordinates for the sixth image.
             
             
                  image(img7,740,200);//coordinates for the seventh image.
             
             
                  image(img8,890,200);//coordinates of the eighth image.
             
             
              }
             
             
              void draw() {
             
             
                xml = new XMLElement (this, "museumHomeText.xml");//xml being called.
             
             
                int numHomeText = xml.getChildCount();
             
             
                for (int i = 0; i <numHomeText; i++){
             
             
                  XMLElement kid = xml.getChild(i);
             
             
                  int homeText = kid.getInt("homeText");
             
             
                  String datahomeText = kid.getString("homeText");
             
             
                  String mainhomeText = kid.getContent();
             
             
                }
             
             
              }
             
            
             --------------------------------------------------------------------------------------------------------------
            
            
             The highlighted area is my problem spot in this situation; here is my XML I am loading from.
            
            
             ------------------------------------------------------------------------------------------------------------------
            
            
              <?xml version='1.0'?>
             
             
              <museumText>
             
             
              <data homeText= "During the last Ice Age, the Sycamore region lay at the edge of a mile thick sheet of ice. 
             
             
              Running along one blue ice ridge, across DeKalb County, thick-skinned and rough-haired Mastodons lumbered through the landscape. 
             
             
              The Ice Age display at the Midwest Museum of Natural History features a diorama depicting a portion of this scene designed to illustrate life and change in the Midwest region beginning 12,000 years ago." />
             
             
              </museumText>
             
            
             -----------------------------------------------------------------------------------------------------------------------------------------------------------------
            
            
             I have been following the XML example on the Processing website and trying to substitute my corresponding values in, but I get stuck when I get to the string part of the code because I don't know what to call my string. Any help would be wonderful thank you.
            
             
              
              1  
            
 
            