delphi - Create XML element without namespace -


i want create element outputpath text. want:

  <propertygroup condition=" '$(configuration)' == 'debug' ">     <outputpath>text</outputpath>   </propertygroup> 

and get:

  <propertygroup condition=" '$(configuration)' == 'debug' ">     <outputpath xmlns="">text</outputpath>   </propertygroup> 

everything when create element keeps adding xmlns="" it.

and error: error msb4097: element beneath element may not have custom xml namespace.

    // load project (.innoproj or .nsisproj file)     xmldoc := nil;     currentconfigurationnode := nil;     xmldoc := createoleobject('microsoft.xmldom') ixmldomdocument2;     xmldoc.async := false;     //xmldoc.setproperty('selectionnamespaces', 'xmlns="http://schemas.microsoft.com/developer/msbuild/2003"'); << line nothing     xmldoc.load(projpath);     if xmldoc.parseerror.errorcode <> 0     begin       xmldoc := nil;       currentconfigurationnode := nil;       raise exception.create('cannot not load project file! details: ' + xmldoc.parseerror.reason);     end;      // find appropriate element , it's value     { <?xml><project><propertygroup condition=" '$(configuration)' == 'xxx' "> }     propertygroup := xmldoc.selectnodes('/project/propertygroup');     := 0 propertygroup.length - 1     begin       node := propertygroup[i];       if (node.attributes.length > 0)       begin         temp := string(node.attributes.getnameditem('condition').text);         if(temp.contains('$(configuration)') , temp.contains(projconfiguration))         begin           // operations on node           currentconfigurationnode := propertygroup[i];           break;         end;       end;     end;      result := true;   except     on exception       result := false;   end; 

creating (new) node:

  // correct node selected configuration   node := currentconfigurationnode.selectsinglenode(pped^.xmltag);   if(node <> nil)     if(pped^.value <> '')     begin       elementnode := currentconfigurationnode.appendchild(xmldoc.createelement(pped^.xmltag));       elementnode.text := putsymbol(pped^.strip, pped^.value); << adds xmls="" element     end; 

pass in root element's namespace when creating element:

xmldoc.createelement(pped^.xmltag, rootelementnamespace); 

i don't know root element's namespace is, presumably do. document has information expect can write:

xmldoc.documentelement.namespaceuri 

for root element namespace.

i guess question should considered dupe of this: how prevent blank xmlns attributes in output .net's xmldocument? didn't close such because mods in delphi tag tend dislike closing against questions non-delphi tags.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -