Hi,
I have read this topic:
http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=313I want to add a attribute optionnal but define by my custom schema!
My Code:
IXMLDOMElement oElement = (IXMLDOMElement)NewMut;
IXMLDOMAttribute Aenderung = (IXMLDOMAttribute)NewMut.ownerDocument.createNode((int)DOMNodeType.NODE_ATTRIBUTE, "Aenderung", "http://zefix.powernet.ch/Schema/HRG.xsd");
Aenderung.text = "1";
oElement.setAttributeNode(Aenderung);
But he say that is not declared to in the namespace:
quote:
System.Runtime.InteropServices.COMException
The attribute 'http://zefix.powernet.ch/Schema/HRG.xsd}Aenderung' on the element 'Person' is not defined in the DTD/Schema.
at Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMElement.setAttributeNode(IXMLDOMAttribute DOMAttribute)
at Microsoft.Office.Interop.InfoPath.SemiTrust.DOMNodeWrapper.setAttributeNode(IXMLDOMAttribute attribute)
at Microsoft.Office.Interop.InfoPath.SemiTrust.DOMNodeWrapper.setAttributeNode(IXMLDOMAttribute attribute)
at Req2.Req2.MutPers_OnClick(DocActionEvent e) in c:\documents and settings\tc\bureau\st gallen\visual studio projects\req2\formcode.cs:line 144
at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)
In my schema there are an Aenderung attribute optionnal :
http://zefix.powernet.ch/infopath/schema.jpgSo What is the namespace that I need to declare? For that work
Thanks for your help!
++
Thierry
Every moment hesitated is a moment gone for life!!! Think about it
Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
merci de lire ceci