I'm having a similar problem in IE. However, my code looks like this
(using your syntax for creating the XML document):
var hiNode = $("hi", xml);
hiNode.text("foo");
When I run this in Firefox, the hi node in the XML document gets a
text node with a value of "foo" appended to it. However, I get a type
mismatch error in IE.
I can use the .text() function to retrieve text nodes from XML
documents - can I also use it to set text nodes?
Any help is appreciated!
On Jul 3, 9:09 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi... First post, so be gentle...
>
> I am trying to append a new entry into anXMLdocument. This works
> fine in FF but fails with a 'Type mismatch' error (line 170) in IE.
>
> By using the .toXML() plugin, the output is '<hi><DIV
> class="group">xxx</DIV><BUDGET _moz-userdefined=""><CAT _moz-
> userdefined="">xxx</CAT></BUDGET></hi>'
>
> I have tried in 1.1.3 & 1.1.2, both give the same error in IE.
>
> function loadXML(text) {
> var xmlDoc = "";
> // code for IE
> if (window.ActiveXObject) {
> xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
> xmlDoc.async="false";
> xmlDoc.loadXML(text);
> }
> // code for Mozilla, Firefox, Opera, etc.
> else if (document.implementation &&
> document.implementation.createDocument) {
> var parser=new DOMParser();
> var xmlDoc=parser.parseFromString(text,"text/xml");
> }
> else {
> alert('Your browser cannot handle this script');
> }
> return xmlDoc;
>
> }
>
> $(document).ready(function(){
> var fred="<hi></hi>";
> console.log(fred);
> // Push throughXMLprocessor
> xml= loadXML(fred);
>
> var b = $("hi:first",xml);
> var node = $("<div class='group' >xxx</div>");
> node.appendTo(b);
>
> });