C# XML attribute being created improperly -


i'm creating node programmatically, 1 of attributes comes out differently specified in code:

                xmlnode xresource = docxmlfile.createnode(xmlnodetype.element, "resource", docxmlfile.documentelement.namespaceuri);                 xmlattribute xrefidentifier = docxmlfile.createattribute("identifier");                 xmlattribute xrefadlcp = docxmlfile.createattribute("adlcp:scormtype");                 xmlattribute xrefhref = docxmlfile.createattribute("href");                 xmlattribute xreftype = docxmlfile.createattribute("type");                 xrefidentifier.value = "res-" + strres;                 xrefadlcp.value = "sco";                 xrefhref.value = datarow["launch_url"].tostring().tolower();                 xreftype.value = "webcontent";                  xresource.attributes.append(xrefidentifier);                 xresource.attributes.append(xrefadlcp);                 xresource.attributes.append(xrefhref);                 xresource.attributes.append(xreftype); 

this ends creating line following. note 'adlcp:scormtype' has morphed 'scormtype' not specified. ideas how show put in createattribute?

 <resource identifier="res-cda68f64b849460b93bf2840a9487358" scormtype="sco" href="start.html" type="webcontent" /> 

this expected behavior of override createattribute combined saving document:

the namespaceuri remains empty unless prefix recognized built-in prefix such xmlns. in case namespaceuri has value of http://www.w3.org/2000/xmlns/.

use override xmldocument.createattribute specify namespace , prefix:

xmlattribute xrefadlcp = docxmlfile.createattribute(      "adlcp","scormtype", "correct-namespace-here"); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -