I have this xml file, for a storyboard program.
First I retrieve the general info about the storyboard, such as number of pads, size etc.
Then I retrieve the storyboard folder. Here I keep pixmaps in the folder 'sc1', but they are created at runtime, and not saved.
Number of pads in this example are 4. Each pad starts with an entry with timing and count, and inside this tag, you'll find points and pen color for drawing lines on a QGraphicsScene.
Qt Code:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project>
  3. <info project_name="matt2" project_path="C:/Users/david/matt2" pad_count="4" pad_width="800" pad_height="600"/>
  4. <storyboard folder="sc1">
  5. <0 timing="50" count="36">
  6. <0 p1x="285" p1y="79" p2x="286" p2y="79" rgb="4293958640"/>
  7. ...
  8. <35 p1x="326" p1y="175" p2x="326" p2y="175" rgb="4293958640"/>
  9. </0>
  10. <1 timing="75" count="30">
  11. <0 p1x="319" p1y="95" p2x="320" p2y="95" rgb="4293958640"/>
  12. ...
  13. <29 p1x="292" p1y="113" p2x="292" p2y="113" rgb="4287102865"/>
  14. </1>
  15. <2 timing="50" count="26">
  16. <0 p1x="170" p1y="53" p2x="175" p2y="53" rgb="4287102865"/>
  17. ...
  18. <25 p1x="299" p1y="65" p2x="299" p2y="65" rgb="4291326770"/>
  19. </2>
  20. <3 timing="50" count="12">
  21. <0 p1x="298" p1y="43" p2x="298" p2y="44" rgb="4291326770"/>
  22. ...
  23. <11 p1x="269" p1y="73" p2x="269" p2y="73" rgb="4291326770"/>
  24. </3>
  25. </storyboard>
  26. </project>
To copy to clipboard, switch view to plain text mode 
After opening the file I have this code, that works
Qt Code:
  1. doc.setContent(&file);
  2. file.close();
  3. QDomElement root = doc.documentElement();
  4.  
  5. QDomNode n = root.firstChild();
  6. if (n.nodeName() == "info")
  7. {
  8. QDomElement e = n.toElement();
To copy to clipboard, switch view to plain text mode 
Here comes the part where it goes wrong.
I can get the folder of the storyboard, but when I write: "QDomNode pad = n.firstChild();", pad is NULL. I can't get to the actual pad information.
Qt Code:
  1. // now load Storyboards...
  2. n = n.nextSibling();
  3. while (!n.isNull())
  4. {
  5. QDomElement s1 = n.toElement();
  6. if (n.nodeName() == "storyboard")
  7. {
  8. mActiveStoryboard = s1.attribute("folder", "");
  9. qDebug() << "storyboard: " << mActiveStoryboard;
  10. QDomNode pad = n.firstChild();
  11. while (!pad.isNull())
  12. {
  13. QDomElement s2 = pad.toElement();
  14. qDebug() << "pad: " << pad.nodeName();
  15. pad = pad.nextSibling();
To copy to clipboard, switch view to plain text mode 
Can anyone please help me retrive "<0 timing="50" count="36">"?
I feel I have tried everything, and it must be n.firstChild(), or...? Please enlighten me