error while processing Main xml script in JScript - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

error while processing Main xml script in JScript

Last post 01-28-2010 04:38 AM by vikas_chess. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-28-2010 03:19 AM

    error while processing Main xml script in JScript

    i am writing a simple code in JScript to update Main xml schema.

     structure of my Main data source schema is as shown below:

    myFields -> Company -> Name

    where myFields is the default root element in the Main data source. Company is a simple group and Name is text string.

    Now, below is the simple JSript code to update the Main xml schema:

     

    function load::OnClick(eventObj)

    {

    var mainRoot = XDocument.DOM.selectSingleNode("/my:myFields");

    var myXML = "<my:Company xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-28T10:22:49'>"

    + "<my:Name>HCL</my:Name>"

    + "</my:Company>";

    var domNewRow = XDocument.CreateDOM();

    domNewRow.validateOnParse = false;

    domNewRow.async = false;

    domNewRow.loadXML(myXML);

    domNewRow.setProperty("SelectionNamespaces", 'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-28T10:22:49"');

    mainRoot.appendChild(domNewRow.selectSingleNode("my:Company"));

    }

     

    The following error occurred on previewing the form:

    Element '{http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-28T10:22:49}Company' is unexpected according to content model of parent element '{http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-28T10:22:49}myFields'.

    please help me out in resolving the issue.

  • 01-28-2010 04:38 AM In reply to

    Re: error while processing Main xml script in JScript

    i resolved the issue. I need to make Company element as repeating because we are appending child to it.

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.