Load function not working

Hey, I have an xml file located in my C:\ drive, this xml document is a product of saving the information from the scheduler (scheduler.toXML()), when i try to load it, the data does not appear. why is that?

[code][scheduler.load(“C:\Tasks.xml”, “xml”);/code]

this is my config for my scheduler:

[code]
var engineers = @Html.Raw(Json.Encode(ViewBag.engineers))
scheduler.locale.labels.timeline_tab = “Timeline”;
scheduler.locale.labels.timeline2_tab = “Timeline2”;
scheduler.locale.labels.section_custom = “Section”;
scheduler.config.details_on_create = true;
scheduler.config.details_on_dblclick = true;
scheduler.config.xml_date = “%Y-%m-%d %H:%i”;
scheduler.config.limit_view = false;
scheduler.config.mark_now = false;

        scheduler.createTimelineView({
            name: "timeline",
            x_unit: "minute",
            x_step: 30,
            x_start: 16,
            x_date: "%H:%i",
            x_size: 24,
            x_length: 48,
            y_unit: engineers,
            event_dy: 'full',
            y_property: "engineer_id",
            render: "bar"
        });

        //Days: monday - friday, Zones/Hours: 7pm - 12am
        scheduler.blockTime({
            days: [1, 2, 3, 4, 5],
            zones: [19 * 60, 24 * 60],
            //sections: {
            //    unit: [1, 4]
            //}
        });[/code]

Thanks for your time!

scheduler.load("C:\\Tasks.xml", "xml");

This will not work for modern browsers. Data loading from local filesystem is restricted because of security reasons. You need to use http urls for load command.

Thanks for the reply,
I’m unsure on how to do this.

How do i go about turning a local file into a http url?

Thanks!

You need to run some local web-server - apache, nginx, iis, or some other one.

Hello, So i tried placing my file in the IIS @

scheduler.load("http://localhost/Tasks.xml", "xml");

still no luck, I know the URL is valid, because when I try it on the web, it displays my XML data.
Any suggestions?

perhaps its my xml data? I will post it below

[code]

<start_date>

</start_date>
<end_date>

</end_date>

[/code]

Try to change command as

scheduler.load("/Tasks.xml", “xml”);

The xml data look fine for me.
Try to use code like next on the page ( to check the xml data )

...place xml data here ...

trying scheduler.load("/Tasks.xml", “xml”);
did not work. and I got this response on the FireBug Console:

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

As for your second suggestion im yet to try it. Ill give it a shot now. Just to make sure I understand the solution. I will be writing the xml data on the view page in a textarea and then referencing it by ID.

mind you, eventually there will be a lot of xml data, will this hinder the performance in any way?

unfortunetly, placing the xml data on the page does not seem to be working either.

I’ll post all my code for the scheduler:

<div id='scheduler_here' class="dhx_cal_container" style='width:1130px; height:900px;'>
    <div class="dhx_cal_navline">
        <div class="dhx_cal_prev_button">&nbsp;</div>
        <div class="dhx_cal_next_button">&nbsp;</div>
        <div class="dhx_cal_today_button"></div>
        <input type="button" id="save" value="save" onclick="save()">
        <div class="dhx_cal_date"></div>
        <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
        <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
        <div class="dhx_cal_tab" name="timeline_tab" style="right:280px;"></div>
        <div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
    </div>
    <div class="dhx_cal_header">
    </div>
    <div class="dhx_cal_data">
    </div>
    
    <textarea id="data_here">
        <data>
            <event>
                <start_date>
                    <![CDATA[ 2014-07-15 08:30 ]]>
                </start_date>
                <end_date>
                    <![CDATA[ 2014-07-15 12:15 ]]>
                </end_date>
                <text>
                    <![CDATA[ Task A-12458 ]]>
                </text>
                <engineer_id>
                    <![CDATA[ 020602 ]]>
                </engineer_id>
                <id>
                    <![CDATA[ 1405426499962 ]]>
                </id>
            </event>
            <event>
                <start_date>
                    <![CDATA[ 2014-07-15 12:00 ]]>
                </start_date>
                <end_date>
                    <![CDATA[ 2014-07-15 14:00 ]]>
                </end_date>
                <text>
                    <![CDATA[ Task A-89411 ]]>
                </text>
                <engineer_id>
                    <![CDATA[ 020602 ]]>
                </engineer_id>
                <id>
                    <![CDATA[ 1405426499963 ]]>
                </id>
            </event>
            <event>
                <start_date>
                    <![CDATA[ 2014-07-15 11:00 ]]>
                </start_date>
                <end_date>
                    <![CDATA[ 2014-07-15 14:00 ]]>
                </end_date>
                <text>
                    <![CDATA[ Task A-89411 ]]>
                </text>
                <engineer_id>
                    <![CDATA[ 010201 ]]>
                </engineer_id>
                <id>
                    <![CDATA[ 1405426499964 ]]>
                </id>
            </event>
        </data>
    </textarea>
  
        <script type="text/javascript">

            var engineers =  @Html.Raw(Json.Encode(ViewBag.engineers))

            scheduler.locale.labels.timeline_tab = "Timeline";
            scheduler.locale.labels.timeline2_tab = "Timeline2";
            scheduler.locale.labels.section_custom = "Section";
            scheduler.config.details_on_create = true;
            scheduler.config.details_on_dblclick = true;
            scheduler.config.xml_date = "%Y-%m-%d %H:%i";
            scheduler.config.limit_view = false;
            scheduler.config.mark_now = false;

            scheduler.createTimelineView({
                name: "timeline",
                x_unit: "minute",
                x_step: 30,
                x_start: 16,
                x_date: "%H:%i",
                x_size: 24,
                x_length: 48,
                y_unit: engineers,
                event_dy: 'full',
                y_property: "engineer_id",
                render: "bar"
            });

            //Days: monday - friday, Zones/Hours: 7pm - 12am
            scheduler.blockTime({
                days: [1, 2, 3, 4, 5],
                zones: [19 * 60, 24 * 60],
                //sections: {
                //    unit: [1, 4]
                //}
            });

            scheduler.attachEvent("onAfterLightbox", function () {
                setToolTip();
                //save();
            });

            scheduler.attachEvent("onYScaleClick", function (index, section, e) {
                setToolTip();
            });

            scheduler.attachEvent("onLimitViolation", function (id, obj) {
                alert("This is not a valid time period.")
            });

            scheduler.init('scheduler_here', new Date(), "timeline");
            //scheduler.load("/Tasks.xml", "xml");
            scheduler.parse(document.getElementById("data_here").value, "xml");

            function save() {
                var xml = scheduler.toXML();
                var url = '@Url.Action("Save", "Home")';

                $.ajax({
                    url: url,
                    Type: "POST",
                    dataType: 'json',
                    async: false,
                    data: { xmlString: xml },
                    contentType: 'application/json; charset=utf-8',
                    success: alert("File Saved in C:\\ Drive as Tasks.xml") 
                });
            }
        </script>
</div>

I really do appreciate all your help Stanislav!
A big thank you!

Please try to remove whitespaces between CDATA and the parent tag, like next

<data> <event> <start_date><![CDATA[ 2014-07-15 08:30 ]]> </start_date> <end_date><![CDATA[ 2014-07-15 12:15 ]]> </end_date> <text><![CDATA[ Task A-12458 ]]> </text> <engineer_id><![CDATA[ 020602 ]]> </engineer_id> <id><![CDATA[ 1405426499962 ]]> </id> </event>

It solves problem in my case and sample works as expected
Workin sample is attached as well
01_basic_init.zip (1.6 KB)

This is really weird!
but it still does not work after removing the white spaces from the textarea.

In addition, your sample doesn’t not work on my computer as well, (posted a picture for reference)


I’m not exactly sure what the problem is, but there’s definitely something strange about this.

my textarea:

<textarea id="data_here"> <data> <event> <start_date><![CDATA[ 2014-07-16 08:30 ]]> </start_date> <end_date><![CDATA[ 2014-07-16 12:15 ]]> </end_date> <text><![CDATA[ Task A-12458 ]]> </text> <engineer_id><![CDATA[ 020602 ]]> </engineer_id> <id><![CDATA[ 1405426499962 ]]> </id> </event> <event> <start_date><![CDATA[ 2014-07-16 12:00 ]]> </start_date> <end_date><![CDATA[ 2014-07-16 14:00 ]]> </end_date> <text><![CDATA[ Task A-89411 ]]> </text> <engineer_id><![CDATA[ 020602 ]]> </engineer_id> <id><![CDATA[ 1405426499963 ]]> </id> </event> <event> <start_date><![CDATA[ 2014-07-16 11:00 ]]> </start_date> <end_date><![CDATA[ 2014-07-16 14:00 ]]> </end_date> <text><![CDATA[ Task A-89411 ]]> </text> <engineer_id><![CDATA[ 010201 ]]> </engineer_id> <id><![CDATA[ 1405426499964 ]]> </id> </event> </data> </textarea>

I found out that they are still being loaded on the page, because when I save them, they do get written into the xml file.

It appears they are just not being displayed on the page when being parsed.

Somehow I got it to work!!

this was my textarea in the end:

    <textarea id="data">
        <data>
            <event>
                <id><![CDATA[0]]></id>
                <start_date><![CDATA[2014-07-21 08:30]]></start_date>
                <end_date><![CDATA[2014-07-21 12:15]]></end_date>
                <text><![CDATA[Task A-12458]]></text>
                <engineer_id><![CDATA[020602]]></engineer_id>
                <color><![CDATA[undefined]]></color>
            </event>
            <event>
                <id><![CDATA[1]]></id>
                <start_date><![CDATA[2014-07-21 12:00]]></start_date>
                <end_date><![CDATA[2014-07-21 14:00]]></end_date>
                <text><![CDATA[Task A-89411]]></text>
                <engineer_id> <![CDATA[020602]]></engineer_id>
                <color><![CDATA[undefined]]></color>
            </event>
            <event>
                <id><![CDATA[2]]></id>
                <start_date><![CDATA[2014-07-21 11:00]]></start_date>
                <end_date><![CDATA[2014-07-21 14:00]]></end_date>
                <text><![CDATA[Task A-89411]]></text>
                <engineer_id><![CDATA[010201]]></engineer_id>
                <color><![CDATA[red]]></color>
            </event>
            <event>
                <id><![CDATA[3]]></id>
                <start_date><![CDATA[2014-07-21 08:50]]></start_date>
                <end_date><![CDATA[2014-07-21 11:20]]></end_date>
                <text><![CDATA[Task 101]]></text>
                <engineer_id><![CDATA[031113]]></engineer_id>
                <color><![CDATA[DarkGreen]]></color>
            </event>
        </data>
    </textarea>

Thanks for your help Stanislav