Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Unknown Error in DOM when setting node.prefix or node.namespaceURI

Gesperrt Unknown Error in DOM when setting node.prefix or node.namespaceURI

Gesperrt

  • 18 ตุลาคม 2548 22:48
     
     

    For an InfoPath form, I am trying to add non-blank values from a list in the default view to a repeating field for a bulleted list on another view. I am getting stuck trying to add the new nodes but I keep getting an error message that simply says "Unkown Exception".

    Here is my code:


    function XDocument::OnSwitchView(eventObj)

    {
    var symptomNode;
    var symptomsNode = XDocument.DOM.selectSingleNode ("//my:Symptoms");
    var
    symptomTextNodes = XDocument.DOM.selectNodes
      (
    "//my:SymptomText/*[text()!='']");

    symptomTextNodes.reset();
    while ((productNode = symptomTextNodes.nextNode()) != null)
    {
        symptomNode = XDocument.DOM.createElement(
    "Symptom");
       
    symptomNode.namespaceURI =  
    "http://schemas.microsoft.com/office/infopath/2003/myXSD/2000-09-05T22:16:04"; // UNKOWN EXCEPTION??? 

        symptomsNode.appendChild(symptomNode);
        symptomNode.text = productNode.text;
    }
    }


     


    Thots?

ตอบทั้งหมด

  • 19 ตุลาคม 2548 3:30
     
     คำตอบ
    Hi,

    Try to replace:
    symptomNode = XDocument.DOM.createElement("Symptom");
       
    symptomNode.namespaceURI =  
    "http://schemas.microsoft.com/office/infopath/2003/myXSD/2000-09-05T22:16:04";

    By:
    symptomNode = XDocument.DOM.createNode (1, "Symptom", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2000-09-05T22:16:04");

    Regards,

    Franck Dauché
  • 19 ตุลาคม 2548 17:29
     
     
    Using:
    symptomNode = XDocument.DOM.createNode (1, "Symptom", "
    http://schemas.microsoft.com/office/infopath/2003/myXSD/2000-09-05T22:16:04");

    "Microsoft JScript runtime error: Wrong number of arguments or invalid property assignment"

  • 20 ตุลาคม 2548 7:02
     
     
    Weird.  Let's do something here:
    Please open a new blank IP form and drop one repeating section (with 1 textboxes), you will have the following schema:
    myFields
      group1
        group2
           field1

    Add a button, and put the following code behind:
    var xmlParent = XDocument.DOM.selectSingleNode("/my:myFields/my:group1");
    var newNode = XDocument.DOM.createNode (1, "group2", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-10-19T03:11:22");
    xmlParent.appendChild(newNode);
    (replacing 2005-10-19T03:11:22 by yours)
    Run and click on the button.
    Do you get the same error?

    Regards,

    Franck Dauché
  • 20 ตุลาคม 2548 14:57
     
     
    Hi Franck,

    My apologies, it was a typo on my part. Your original solution worked.

    Thanks,

    pjp
  • 20 ตุลาคม 2548 15:03
     
     
    Great!  Glad I could help.

    Good luck.

    Regards,

    Franck Dauché