subclassing xmlReader issues
- From: wejiv <wejiv@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 2 Sep 2008 05:34:00 -0700
I have created a subclass of xmlReader and was passing that in to
XPathDocument and using that XPathDocument instance in my
xslCompiledTransform transform() method. Something about my reader causes
the xslCompiledTransform to behave differently in reading xml attributes
depending on whether I am debugging the xsl or not.
I declared all of abstract methods and I don't get any errors building
my new xmlReader class. I get no exceptions when using it to parse my xml
document and while debugging I can see my xml attributes. But when I try to
use it with or without visual studio and XslCompiledTransform(false) I get
no values returned for my xml attributes.
When I step through the xsl file:
=================================================
1 xmlReader = New XmlData2010SASDataReader(FilePath)
2
3 doc = New XPathDocument(xmlReader)
4 XMLNavigator = doc.CreateNavigator
5 xslDoc = New XslCompiledTransform(false)
6 xslDoc.Load(xslPath)
7 xslDoc.Transform(doc, New XsltArgumentList(), Response.Output)
==================================================
In Visual Studio line 3 does all of the activity of reading the xmlReader
and going through it's methods and getting correct values for elements and
attributes but I get no activity for reading xmlReader in line 7.
I am using a SortedDictionary object to store my attributes while on an
element. The element and attributes are encapsulated in another state
object
that the xmlReader subclass (XmlData2010SASDataReader) uses in all of the
overridden abstract methods of XMLReader superclass (GetAttribute(string),
MoveToFirstAttribute(), etc).
My getAttribute(int) transports all my key/value pairs to an array so
that I can present the relevant attribute.
I have recompiled my custom XMLReader class twice:
1) I put a lock on the sortedDictionary object in the various methods that
utilizes it.
2) I put a lock on the custom class that XmlData2010SASDataReader uses for
element information within XmlData2010SASDataReader's accessor methods.
Neither changed the behavior.
Maybe the SortDictionary object is not safe for this kind of setting.
Any ideas or thoughts? How I can trace back to my problem?
below is a sample snippet of what I am trying to do:
<xsl:variable nme="aname">
<xsl:for-each select="/Root/test">
<xsl:sort select="@attr1" />
<xsl:copy-of select="." />
</xsl:for-each >
</xsl:variable>
In this case it would just build the collection in the same order as the
original children set because it doesn't actually see the attribute values.
So for this xml:
<Root>
<test attr1="avalue" />
<test attr1="anothervalue" />
</Root>
I get this sorted set:
<test attr1="avalue" />
<test attr1="anothervalue" />
Which is not really sorted.
For more background please see the posting in the XSL group posted on
8/26/2008 title " Different XPath testing behavior when using
xslCompiledTransform(t in XSL" .
.
- Follow-Ups:
- Re: subclassing xmlReader issues
- From: Pavel Minaev
- Re: subclassing xmlReader issues
- Prev by Date: XML Data islands
- Next by Date: Re: subclassing xmlReader issues
- Previous by thread: XML Data islands
- Next by thread: Re: subclassing xmlReader issues
- Index(es):
Relevant Pages
|