delphi - MSXML - Namespaces info not persisting -


i using msxml 6.0 perform transform of own xml xml format. not sure if maybe don't understand how msxml works, believe have noticed strange behaviour it....

i adding in namespaces xml doc using setproperty method e.g.

xmldocument.setproperty('selectionnamespaces', ' xmlns:ms=''http://mydomain.com/2010/myschema'''); 

then building xml using own custom serializer in memory (not saving disk). once serialized load in xslt file , perform transformation using transformnodetoobject e.g.

appxmldoc.transformnodetoobject(xslxmldoc, astreamfortransformedxml); 

the problem transform working none of specific template matching xpath have in is. eliminated problems xslt file running test data through visual studio , worked expected. assumed must have been encoding issue made sure documents involved being read/written out utf-8....still no luck.

here example of transform looks like:

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:ms="http://mydomain.com/2010/myschema" exclude-result-prefixes="ms"> <xsl:template match="/"> <aroot>         <head>     <xsl:apply-templates select="ms:element/ms:subelement" />   </head>   <body>     <xsl:apply-templates select="ms:element/ms:differentsubelement" />   </body> </aroot> 

so result of transform when run through msxml brings on basic structure not include of template data. after testing discovered way work in following steps:

  1. create new xml doc
  2. set namespace info using setproperty
  3. serialize xml , save disk.
  4. close document - extra step
  5. create new xml doc - extra step
  6. reload document - extra step
  7. re-set namespace info - extra step
  8. perform transform.

so appears msxml loses track of namespace information @ somepoint. makes more weird if reset namespace info (after serializing) , try transform still doesn't work! seem work if save document, close , recreate new xml document , load in (which consequence need reset namespaces).

anyone have thoughts/ideas on this?

the selectionnamespace property used xpath selectnodes , selectsinglenode methods, not xslt or other purposes. not sure why set , expect not seem use selectnodes or selectsinglenode. want achieve msxml 6? if want create msxml dom documents elements and/or attributes in namespaces make sure use createnode namespace aware method in msxml's api.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -