MSXML and Namespaces ... not fully implemented (was RE: Has docum ent(string) in MSXML 3 (July preview) worked for any one?)

Subject: MSXML and Namespaces ... not fully implemented (was RE: Has docum ent(string) in MSXML 3 (July preview) worked for any one?)
From: Eckenberger Axel <Extern.Eckenberger@xxxxxxxx>
Date: Thu, 7 Sep 2000 11:01:20 +0200
Sara, folks,

> -----Original Message-----
> From: sara.mitchell@xxxxxxxxx [mailto:sara.mitchell@xxxxxxxxx]
> Sent: Wednesday, September 06, 2000 6:51 PM
> To: Extern.Eckenberger@xxxxxxxx
> Subject: RE: Has document(string) in MSXML 3 (July preview) worked for
> any one?
> 
> Thanks! It confirms my suspicions which is that the problem 
> is how MSXML is being invoked by the scripting engine. One
> question: did you run the transformation from a command 
> line? or is it being done dynamically from a script|ASP|etc.?

I just opened the document with a double click, so I guess you can say I
used the commandline ... :-). However, looking at your problem I was
thinking that you might be using namespaces and as I just came across a
problem with namespaces in one of my projects and I thought that they might
be conneced. So I ran a few tests in VB with the code and test files are
listed at the bottom of the message. The tests revealed that if namespaces
are included in the source document and/or the inclusion document (Version B
of both) the Processor does return an empty output tree. Transform Node,
however, does return the correct result.

When I had my problem with namespaces I queried MS and got the following
statements, which implies that the namespace implementation of their current
parser has some problems (... lack of implementation ????).

<quote>
	"Glen Braun" <xmlfeedback@xxxxxxxxxxxxx> wrote in message
	news:0#p#6n7BAHA.246@xxxxxxxxxxxxxxxxxxxxxxxxxxxx

	Hi,

	XPath queries using selectNodes, or selectSingleNode will not match
nodes
	with namespace prefixes (with some work arounds).  This
functionality will
	be added in the October release.
	
	You can get around this by using something like this:
	
	XML Data:
	<root xmlns:xyz="goo">
	<xyz:test>test</xyz:test>
	</root>
	
	XPath query:
	var nl = xml.selectNodes("//*[name() = 'xyz:test']");
	
	to match xyz:test
	
	Thanks,
	Glen
</quote>

<quote>
	Subject: 	RE: Re: One works, one doesn't...I don' get it...
	Author: 	xmlfeedback@xxxxxxxxxxxxx (Glen Braun)
	Date: 	8/17/2000 11:11:26 AM

	Hi,

	You will run into the problem with the default namespace as well,
not just 
	namespaces using a prefix.  XPath from XSLT does not have this
problem so 
	you might look at using XSLT if it makes sense for your situation.

	Thanks,
	Glen
</quote>

Hope this clears up things and I guess we'll have to wait for the new
Version of the MS Parser.

Bye,

Axel

PS: I cc'ed it to the list as I think this might be of general interest.

------ sample code -------
<CODE>
    Dim SrcTree As FreeThreadedDOMDocument
    Dim XSLTree As FreeThreadedDOMDocument
    Dim TgtTree As FreeThreadedDOMDocument
    Dim Processor As IXSLProcessor
    Dim Template  As XSLTemplate
    
    Set SrcTree = New FreeThreadedDOMDocument
    SrcTree.setProperty "SelectionLanguage", "XPath"
    
    Set XSLTree = New FreeThreadedDOMDocument
    XSLTree.setProperty "SelectionLanguage", "XPath"
    
    Set TgtTree = New FreeThreadedDOMDocument
    XSLTree.setProperty "SelectionLanguage", "XPath"
    
    Set Template = New XSLTemplate
    
    SrcTree.Load "E:/Test/DocTest.xml"
    XSLTree.Load "E:/Test/DocTest.xsl"
    
    
    If (SrcTree.parseError = 0 And XSLTree.parseError = 0) Then
        Debug.Print SrcTree.transformNode(XSLTree)
        
        Set Template.stylesheet = XSLTree
        Set Processor = Template.createProcessor()
        Processor.input = SrcTree
        Processor.output = TgtTree
        Processor.Transform

        Debug.Print TgtTree.xml
    End If
</Code>

<TestFiles>
	<SourceDoc filename="DocTest.xml" version="A">
		<?xml version='1.0'?>
		<?xml-stylesheet href="DocTest.xsl" type="text/xsl"?>
		<Source id="1"/>
	</SourceDoc>

	<SourceDoc filename="DocTest.xml" version="B">
		<?xml version='1.0'?>
		<?xml-stylesheet href="DocTest.xsl" type="text/xsl"?>
		<Source id="1" xmlns="x-schema:DocTest.xsd"/>
	</SourceDoc>

	<Stylesheet filename="DocTest.xsl">
		<?xml version='1.0'?>
		<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
		
		<xsl:template match="/">
			<Test>
				<xsl:copy-of select="*"/>
				<xsl:copy-of
select="document('TypeLibInfo.xml')/*"/>
			</Test>
		</xsl:template>
	</StyleSheet>

	<InclusionDoc filename="TypeLibInfo.xml" version="A">
		<?xml version="1.0"?>
		<Test>
			<Text>Some Content</Text>
		</Test>
	</InclusionDoc>

	<InclusionDoc filename="TypeLibInfo.xml" version="B">
		<?xml version="1.0"?>
		<Test xmlns="x-schema:SomeNamespace.xsd">
			<Text>Some Content</Text>
		</Test>
	</InclusionDoc>
</TestFiles>

-- 
Axel Eckenberger, BSc
Software Project Mangager
Krauss-Maffei Wegmann GmbH & Co. KG

Tel:         +49 (89) 8140-4408

eMail:
   work:     extern.eckenberger@xxxxxxxx
   private:  ecki@xxxxxxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread