A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: XML.ignoreWhite

  1. #1
    Junior Member
    Join Date
    Nov 2002
    Posts
    12

    XML.ignoreWhite

    Hi!

    This one is for you XML-gurus out there:

    Ive linked a xml-document (just simple text) to a dynamic textfield.

    The text displays, alright, but somehow the browser or the parser or whatever chooses to display extra break-lines.

    Ive set the dynamic textfield to read html, so it will break when the actionscript outputs a "< br>", for instance.

    Ive read about the XML.ignoreWhite, and drew the conclusion that this might have something to do with the problem. But when I try to put it in my code, the text wont show alltogether.

    Very confusing. Hope somebody can help.

  2. #2
    Junior Member
    Join Date
    Nov 2002
    Posts
    12
    Some more info to help the debug:

    The actionscript:
    ----------------------------------------------------------------------
    XML_var = new XML();

    // now load up the url.
    XML_var.load("xml/Studerande.xml");

    // when xml is loaded call functon displayXML
    XML_var.onLoad = displayXML;

    function displayXML()
    {
    mainTag = new XML;
    elementTag = new XML;
    articleList = new Array;
    elementList = new Array;
    mainTag = this.firstChild.nextSibling;
    articleList = mainTag.childNodes;
    txt = "";

    //loop through xml
    for(i=0;i<=articleList.length;i++)
    {//start for
    elementList = articleList[i].childNodes;
    //start for
    for(j=0;j<=elementList.length;j++)
    {//start for
    elementTag = elementList[j];
    head = elementTag.firstChild.nodeValue;

    //Displays the first
    if(elementTag.nodeName.toLowerCase() == "node_head")
    {txt += head +"" "<br>";}

    //Runs through and displays the rest of the nodes in xml-document
    else {txt += head +"" + "<br>";}

    }//end for
    }//end for
    }
    --------------------------------------------------------------------------------

    Sample XML-file:
    ---------------------------------------------------------------------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <xmltest>
    <parentnode>
    <node_head>Studerande</node_head>
    <node1>Anna Pettersson 1</node1>
    <node2>Lisa Nilsson</node2>
    </parentnode>
    </xmltest>

    ---------------------------------------------------------------------------------

    The result displayed:
    ---------------------------------------------------------------------------------
    <first two blank lines - dont want them>
    Studerande
    <blank line - should only be new line>
    Anna Pettersson 1
    <blank line - should only be new line>
    Lisa Nilsson
    ---------------------------------------------------------------------------------

  3. #3
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    The problem is not really clear. Your code seems to be too complex for the xml file. Unfortunately the tags don't show up. If you place the xml and fla files to download, I can have a look.
    - The right of the People to create Flash movies shall not be infringed. -

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Location
    Holland - Den Haag
    Posts
    131
    i have the same problem.
    but when you make tekst like this

    Code:
    textfield=<br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br><br>text text text</br>
    with HTML line break code ( br and /br (with the < and > but they don't show when you see it on the board)).

    then it works, but i just want to copy past my text when i update it.
    i don't want to make the line break code for every line of text.

    maybe this wil help you a bit.

    grafx

    ps. the ignoreWhite is for the xml file, if you made it like HTML looks then you will need it. if you wrote every thing in one line then you don't need it.
    Last edited by grafx_one; 11-25-2002 at 08:10 AM.

  5. #5
    Senior Member
    Join Date
    Jan 2001
    Location
    Holland - Den Haag
    Posts
    131
    check this txt file.

    grafx
    Attached Files Attached Files

  6. #6
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Are you putting the &lt; br &gt; into the XML? You can't do that. XML doesn't pay attention to tag names.

  7. #7
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Tupps had recently published a way to put html tags into xml some weeks ago in this forum.
    You can also get linebreaks etc, when you put your file as a childnode. Check
    http://can_info_guide.tripod.com/
    special text files.
    - The right of the People to create Flash movies shall not be infringed. -

  8. #8
    Senior Member
    Join Date
    Jan 2001
    Location
    Holland - Den Haag
    Posts
    131
    no, i mean in the *.txt or *.html file you load from the adress stored in the *.xml file. then get the textfield to use the html tags.

    check the *.txt i uploaded before.

    grafx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center