Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Corejava boy on Jan 15, 2008 20:16
open dhtmlx forum
loads in mozilla but not IE

I am working on tree, The page open in mozilla but in IE it gives error,
I am loading xml with string

I get the syntax error at this line

tree.loadXMLString(<%= resultString %>);

Corejavaboy
Answer posted by Support on Jan 16, 2008 07:16
IE XML engini has limitation, it can parse only UTF based XML from string, so you can't use loadXMLString command with custom encoded XML.
If problem occurs with UTF encoded XML - please provide exact XML value.
Answer posted by corejavaboy on Jan 16, 2008 09:45

I am using XSLT to generate the xml , the result xml from xsl is loaded to tree. I want the output xml to load to tree directly as a string (or stream).

I am loading to tree as follows, but in IE it gives syntax error at  tree.loadXMLString(<%= resultString %>);

Can you suggest any other method to load the xml directly

<%

XslTransformer xslTrans = new XslTransformer();

String resultString = xslTrans.XsTransformer();

resultString = resultString.substring(resultString.indexOf("<tree"));

System.out.println("the result xml in string format is"+resultString);

%>

tree.loadXMLString(<%= resultString %>);

 

the xml that is loaded to tree is

 

<tree id="0">

<item text="template" id="template~nextAddress~46">

<item text="no service udp-small-servers" id="nonEditableCommand~address~1" child="0">

<userdata name="nonEditableCommand">no service udp-small-servers</userdata>

</item>

<item text="!" id="nonEditableCommand~address~2" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="hostname&#10; &#10; uxx123456&#10; &#10; " id="template~nextAddress~2~address~address" child="1">

<userdata name="editableCommand">

uxx123456

</userdata>

<item text="hostname" id="nonEditableCommand~address~3" child="0">

<userdata name="nonEditableField"/>

</item>

<item text="&#10; &#10; uxx123456&#10; &#10; " id="nonEditableCommand~address~3" child="0">

<userdata name="editableField"/>

</item>

</item>

<item text="!" id="nonEditableCommand~address~4" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="!" id="nonEditableCommand~address~5" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="no ip domain-lookup" id="nonEditableCommand~address~6" child="0">

<userdata name="nonEditableCommand">no ip domain-lookup</userdata>

</item>

<item text="no service config" id="nonEditableCommand~address~7" child="0">

<userdata name="nonEditableCommand">no service config</userdata>

</item>

<item text="no ip finger" id="nonEditableCommand~address~8" child="0">

<userdata name="nonEditableCommand">no ip finger</userdata>

</item>

<item text="no ip http server" id="nonEditableCommand~address~9" child="0">

<userdata name="nonEditableCommand">no ip http server</userdata>

</item>

<item text="no snmp-server" id="nonEditableCommand~address~10" child="0">

<userdata name="nonEditableCommand">no snmp-server</userdata>

</item>

<item text="!" id="nonEditableCommand~address~11" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="ip subnet-zero" id="nonEditableCommand~address~12" child="0">

<userdata name="nonEditableCommand">ip subnet-zero</userdata>

</item>

<item text="!" id="nonEditableCommand~address~13" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="ip routing" id="nonEditableCommand~address~14" child="0">

<userdata name="nonEditableCommand">ip routing</userdata>

</item>

<item text="no ip source-route" id="nonEditableCommand~address~15" child="0">

<userdata name="nonEditableCommand">no ip source-route</userdata>

</item>

<item text="ip classless" id="nonEditableCommand~address~16" child="0">

<userdata name="nonEditableCommand">ip classless</userdata>

</item>

<item text="!" id="nonEditableCommand~address~17" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="no ip http server" id="nonEditableCommand~address~18" child="0">

<userdata name="nonEditableCommand">no ip http server</userdata>

</item>

<item text="!" id="nonEditableCommand~address~19" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="logging facility local4" id="nonEditableCommand~address~20" child="0">

<userdata name="nonEditableCommand">logging facility local4</userdata>

</item>

<item text="logging 193.67.79.190" id="nonEditableCommand~address~21" child="0">

<userdata name="nonEditableCommand">logging 193.67.79.190</userdata>

</item>

<item text="!" id="nonEditableCommand~address~22" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="no cdp run" id="nonEditableCommand~address~23" child="0">

<userdata name="nonEditableCommand">no cdp run</userdata>

</item>

<item text="!" id="nonEditableCommand~address~24" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="line con 0" id="nonEditableCommand~address~25" child="0">

<userdata name="nonEditableCommand">line con 0</userdata>

</item>

<item text="login authentication default" id="nonEditableCommand~address~26" child="0">

<userdata name="nonEditableCommand">login authentication default</userdata>

</item>

<item text="exec-timeout 0 0" id="nonEditableCommand~address~27" child="0">

<userdata name="nonEditableCommand">exec-timeout 0 0</userdata>

</item>

<item text="password&#10; randomPass1&#10; RandomPassword&#10; " id="1" child="28" autofillCommand="3">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="line aux 0" id="nonEditableCommand~address~29" child="0">

<userdata name="nonEditableCommand">line aux 0</userdata>

</item>

<item text="login authentication default" id="nonEditableCommand~address~30" child="0">

<userdata name="nonEditableCommand">login authentication default</userdata>

</item>

<item text="exec-timeout 0 0" id="nonEditableCommand~address~31" child="0">

<userdata name="nonEditableCommand">exec-timeout 0 0</userdata>

</item>

<item text="password&#10; randomPass2&#10; RandomPassword&#10; " id="2" child="32" autofillCommand="3">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="transport input all" id="nonEditableCommand~address~33" child="0">

<userdata name="nonEditableCommand">transport input all</userdata>

</item>

<item text="line vty 0 4" id="nonEditableCommand~address~34" child="0">

<userdata name="nonEditableCommand">line vty 0 4</userdata>

</item>

<item text="login authentication default" id="nonEditableCommand~address~35" child="0">

<userdata name="nonEditableCommand">login authentication default</userdata>

</item>

<item text="exec-timeout 0 0" id="nonEditableCommand~address~36" child="0">

<userdata name="nonEditableCommand">exec-timeout 0 0</userdata>

</item>

<item text="password&#10; randomPass3&#10; RandomPassword&#10; " id="3" child="37" autofillCommand="3">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="!" id="nonEditableCommand~address~38" child="0">

<userdata name="nonEditableCommand">!</userdata>

</item>

<item text="" id="nonEditableCommand~address~39" child="0">

<userdata name="nonEditableCommand"/>

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="&#10; module&#10; &#10; ">

<item text="Configure Ethernet&#10; child count&#10; 8" child="1" id="2" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Configure FastEthernet&#10; child count&#10; 9" child="1" id="3" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Configure Serial (V.35 x.21)&#10; child count&#10; 3" child="1" id="4" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Configure E1 Unframed (G.703)&#10; child count&#10; 6" child="1" id="5" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Configure E1 Framed (MFT)&#10; child count&#10; 6" child="1" id="6" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Configure PPP_HDLC&#10; child count&#10; 11" child="1" id="7" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Configure ISDN Backup&#10; child count&#10; 20" child="1" id="8" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<userdata name="nonEditableCommand"/>

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="" id="nonEditableCommand~address~41" child="0">

<userdata name="nonEditableCommand"/>

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="" id="nonEditableCommand~address~42" child="0">

<userdata name="nonEditableCommand"/>

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="" id="nonEditableCommand~address~43" child="0">

<userdata name="nonEditableCommand"/>

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="" id="nonEditableCommand~address~44" child="0">

<userdata name="nonEditableCommand"/>

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="" id="nonEditableCommand~address~45" child="0">

<userdata name="nonEditableCommand"/>

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="" id="nonEditableCommand~address~46" child="0">

<userdata name="nonEditableCommand"/>

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Country Specific NL&#10; child count&#10; 7" child="1" id="1" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Configure Interfaces&#10; child count&#10; 7" child="1" id="2" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Configure Frame&#10; child count&#10; 23" child="1" id="10" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Access_151&#10; child count&#10; 9" child="1" id="11" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Access_152&#10; child count&#10; 2" child="1" id="12" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Access_171&#10; child count&#10; 12" child="1" id="13" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Tacacs&#10; child count&#10; 14" child="1" id="14" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

<item text="Highlight&#10; child count&#10; 3" child="1" id="15" autofillCommand="">

<userdata name="&#10; nonEditableField&#10; "/>

<userdata name="autofillField"/>

</item>

</item></tree>

 

Thanks

 

Answer posted by Support on Jan 17, 2008 03:14
The XML which you output in described scenario corrupt script format , please try the next code

<textarea id="for_xml" style='display:none'><%= resultString %></textarea>

<script>
    tree.loadXMLString(document.getElementById('for_xml').value);
</script>