vba >> Element is unexpected according to content model of parent element

by TmVoYQ » Mon, 25 May 2009 12:25:02 GMT

I was trying to create a node under myFields node of a infopath form
programatically. The code for the same is:
public partial class ThisAddIn
{
private Microsoft.Office.Interop.InfoPath._Application3 App; void
ThisAddIn_Startup(object sender, System.EventArgs e)
{
App = (Microsoft.Office.Interop.InfoPath._Application3)this.Application;
Microsoft.Office.Interop.InfoPath._XDocument3 doc =
(Microsoft.Office.Interop.InfoPath._XDocument3)App.XDocuments.NewFromSolution(@"C:\Documents and Settings\neha.mittal\Desktop\BlankTemplate.xsn");

try{
IXMLDOMNode nodeEntry = tempDom.childNodes[3]; // returns myFields Node
IXMLDOMDocument2 tempDom = (IXMLDOMDocument2)doc.DOM;
private Microsoft.Office.Interop.InfoPath.Xml.IXMLDOMNode childNode =
nodeEntry.ownerDocument.createNode("element", "myFields:Designation",
nodeEntry.namespaceURI);
nodeEntry.appendChild(childNode);catch (Exception ex) {}
}
}

But when i try to Append() my childNode in Parent Node(nodeEntry) it gives
following rumtime error:

Element
'{http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-18T12:29:35}Designation'
is unexpected according to content model of parent element
'{http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-18T12:29:35}myFields'.

Please suggest some work arround for the above problem.


vba >> RE: Element is unexpected according to content model of parent element

by TWFyeQ » Fri, 07 Aug 2009 10:03:01 GMT


I'm gettting the same type of message... and I'm mystified. And I don't code

Similar Threads

1. Rules for element-by-element product in array multiplication - Excel

2. Excel2000: Replace array element with element from another array

You could hard code using index and match

=INDEX({"Primary";"Basic";"Basic+Vocational";"Secondary";"Secondary+Vocation
al";"University"},MATCH(D1,{1;2;21;3;31;4},0))

where D1 would be the lookup cell.
Of course you could hard code a vlookup as well


=VLOOKUP(D1,{1,"Primary";2,"Basic";21,"Basic+Vocational";3,"Secondary";31,"S
econdary+Vocational";4,"University"},2,0)

or

=CHOOSE(MATCH(D1,{1;2;21;3;31;4},0),"Primary","Basic","Basic+Vocational","Se
condary","Secondary+Vocational","University")


-- 

Regards,

Peo Sjoblom


"Arvi Laanemets" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
> Hi
>
> In a column I have some numeric values, like 1, 2, 21, 3, 31, 4 or 5. In
> another column, I need to display text strings according to values in
first
> column, like 'Primary', 'Basic', 'Basic+Vocational', 'Secondary',
> 'Secondary+Vocational' and 'University'. I can do it easily using lookup
> tables and VLOOKUP(), but is there a way for it without any lookup table?
>
>
> Thanks in advance
> Arvi Laanemets
>
>
>


3. Excel 2007 addin - An unexpected element "description" was found

4. need a root element, can't have a root element

Greetings.  Word 2007 insists I use a root element, which is fine with me.  
But I am trying to tag SOME text inside a table, but not ALL text inside a 
table.  For example, maybe I want to tag some text in column 1, skip columns 
2 & 3, and tag a portion of the text in column 4.

If I apply the root element to the table, then some text is within that 
element, and because the root element says I cannot have text inside of it, I 
get confused.

Does anyone know how to deal with tagging some text but not all text?  It 
seems that having a root element means you will be tagging text that you 
don't necessarily want.

5. Getting elements within an element... - VB.Net

6. Read contents of XML element

I have an XML document that looks like

<request>
 <login>
  <username>myuser</username>
  <password>mypass</password>
 </login>
</request>

How do I get the values of username and password into a string?

I know how to do this if there are multiple <login></login> parts:
im Files As New ArrayList
        Dim nodelist As XmlNodeList
        Dim node As XmlNode

        nodelist = xmldoc.SelectNodes("/REQUEST/IMPORT/DOCUMENT/FIELD")
        For Each node In nodelist
            If node.Attributes.GetNamedItem("CODE").Value = "BASE64" Then
                Dim Filename As String = node.Item("DATA").InnerText()
                If File.Exists(Filename) Then
                    Files.Add(Filename)
                End If
            End If
        Next

When I try:

Dim nodelist As XmlNodeList
        Dim node As XmlNode
        node = xmldoc.SelectSingleNode("/REQUEST/LOGIN")


        Dim login() As String
        nodelist = xmldoc.SelectNodes("/REQUEST/LOGIN")
        
        login(0) = node.Item("USERNAME").Value
        login(1) = node.Item("PASSWORD").Value

node.item("USERNAME").value  and node.item("PASSWORD").value are nothig and 
I get a null reference error.


7. I am having trouble registering elements of the Office XP package - Microsoft Office

8. copying form element content to clipboard in access xp

Hi

Im trying copy the content of one of my form elements (me!productnumber) to
the clipboard. I have tried almost everything but nothing seems to work.

If I search google i only get hits that work in access 95/97.

Plz help.