|
Thx!
Just what I was looking for!
Thomas Andersson
|
|
|
|
|
Hmm...
Mayby I was a bit to fast.....sure I do find the XmlNode I´m looking for, but
since the XmlTextReader is a read-only class it doesn´t seem to be a way to
get the actual XmlNode? Any sugestions?
Thomas Andersson
|
|
|
|
|
U can use Document Object Model for This .Create an Object of Xml DOM and take the reference and then use the Method GetNodeByName .
It's Jeet
|
|
|
|
|
This is exactly what he does not want to do.
using dom would require loading the whole document first.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Well, since XML is tree-based, you have to somehow traverse the document, starting at the root, even if youre talking about an XPath location. If you don't read in the entire document, there would technically be no way to get to that node you require. Also, if your xml file is really that huge, use a stream reader. Although, you won't have capability to access the document randomly, it would be forward-only, but you would be saving a bunch on memory. Therefore, if you know where the node is exactly and it wouldn't change position, you can hard-code a solution.
|
|
|
|
|
XPathDocument is the simple solution. It is a lightweight version of XmlDocument designed for searching for specific nodes.
It is not a 100% fit, because it *does* load the whole document into memory, but it is much better than XmlDocument, because it does not have the same processing overhead.
If you absolutely do not want the whole document in memory, then you can use an XmlReader. If you are already familiar with SAX, there is a comparison of SAX and XmlReader in the framework documentation. They take different, but (InMyOpinion) equal approaches in terms of efficiency.
|
|
|
|
|
I am trying to transform xml doc to reformat, but only i got is the title i've specified in xsl file and no match element dispalyed in result.
Is there something i missing here?
set xml = Server.CreateObject( "Microsoft.XMLDOM" )
xml.async = FALSE
xml.load( Server.MapPath("orders.asp") )
set xsl = Server.CreateObject( "Microsoft.XMLDOM" )
xsl.async = FALSE
xsl.load( Server.MapPath("orders.xsl") )
Response.Write(xml.transformNode(xsl))
thanks
|
|
|
|
|
we need to see the xsl and xml...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
One thing that always helps me when working with XML transformations is to load the XML and XSL pages in IE. If there are formatting issues IE will point them out. When working with them a lot, you can sometimes forget a few small things.
Another thing you could do, is use a client-side tester. JavaScript points out errors better than ASP, in my experience. Then again, I haven't done a lot of ASP XML. Here's some JavaScript to do that:
<script type="text/javascript">
var xml = new ActiveXObject('Microsoft.XMLDOM');
xml.async = false;
xml.load('CSDHD-IS Architecture.mof.xml');
var xsl = new ActiveXObject('Microsoft.XMLDOM');
xsl.async = false;
xsl.load('MofToCSharp.xsl');
document.write(xml.transformNode(xsl));
</script> Michael Flanakin
Web Log
|
|
|
|
|
I've got a big and deep XML file I want to extract values from. My webservice is currently entirely in C#.
I thought to use SAX because I just want to build up a two-column dataset from my XML file: the PATH and the TEXT VALUE.
E.g.:
/root=
/root/node=2
/root/node/sub=SomeText
/root/node2=3
/root/node2/sub=Some More Text
Since I've used SAX before to easily build up the "path" part, I searched for a SAX parser in .NET and on the net and am VERY surprised that I can't find one!!
Anyways, I'm new to XSLT et. al. and suspect there's a quick way for me to do what I want there (e.g. to build up this two column file WITHOUT knowing the names of the nodes). Can anyone suggest how, or even a small stylesheet to do this??
Thanks for any [good] advice!
|
|
|
|
|
in xslt use the name() function, and to get paths just use the parent axis..
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I'd have to think about it a bit, but my guy tells me what you're looking for is to subclass XmlReader, which is basically a SAX parser that doesn't toss events; it's all manual.
If I think of anything better, I'll add to this...
Jeremy Kimball
|
|
|
|
|
Has anyone embedded an ASP .Net user control into an XSLT file successfully? I have had a go and also seen some examples on the internet but nothin seems to work. Any working examples will be greatly appreciated.![D'Oh! | :doh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_doh.gif)
|
|
|
|
|
I am parsing an XML document in a VB Activex Dll and then saving the xml document by calling DOMDocument.save. After this, if I try to edit the .xml file from the source folder, my explorer is hanging. What is the problem?
Shenthil
|
|
|
|
|
I want to use xsl file as resource . so there is no need to supply it externaly .how can i send a xml file path to xsl file at runtime?
|
|
|
|
|
You can specifiy an XSLT file within your XML document using <xsl:stylesheet>, which can be handy for debugging your XML document outside of your normal code-base.
If you are talking about parameters, then you can use <xsl:param> within your XSLT, which you then setup when creating your XML parser object (such as MSXML or the System.Xml) by passing in variables from your code.
Hope this helps,
Lee.
Lee H Fuller
lee@fullerdata.com
|
|
|
|
|
I am using Xml file as database. I am using xsl to trasform it. I am calling these files from vc++. it works fine on winxp . but it doesnt work on win2000. it will simply show the tables,text etc.but doesnt show any value from xml. when i tried to trasform using javascript its working fine. but i have to do it from my vc++ code.. please help.. is there any problem in win2000? b'coz sometimes it works fine.
|
|
|
|
|
I need to use XSLT to display meanigful information from my XML file .
My XML file is such that i just have elements <A> and <B> with the condition that <B> is always below <A>
<A Name="Main" >
<B Project="1101" />
<A Section="A" >
<B Size="1"/>
<B Data="Data1"/>
</A>
<A Section="B" >
<B Size="1"/>
<B Data="Data2"/>
</A>
</A>
you will find that I have no Data but all information is stored in attributes .
How do i use the "template match" and the
"value-of select" with attributes
I need output like this
My Project
Name : Main
Project : 1101
Section :A
Size: 1
Data:Data1
Section :B
Size: 1
Data:Data2
|
|
|
|
|
I have found that a lot of XSLT beginners have this same question. You need the "@" symbol (get it? "at"-symbol for "attributes"??).
eg:
<br />
<xsl:template match="A"><br />
Section: <xsl:value-of select="@Section" /><br />
Size: <xsl:value-of select="B/@Size" /><br />
Data: <xsl:value-of select="B/@Data" /><br />
</xsl:template><br />
youngpup.net
|
|
|
|
|
U can use xsl for Loop
Jeet
|
|
|
|
|
Does anyone know Xslt debugger tool that can recognize and debugge the
<msxsl:script> element and the embedded script inside it?
I used some debuggers like XMLSPY, but it consider a call to function
defined in embedded script like "<xsl:value-of
select='udf:somefunction();'>", it consider it as a not valid XPath
or variable.
I already know that <msxsl:script> element is Microsoft extension to
Xslt standards so its not expected to find alot -if not at all- of
debuggers dealing with such element, but maybe someone can guide me
here.
Thanx in advance.
|
|
|
|
|
Hi,
i have a html'ish xml that i want to transform into real html . like this:
"some plain text <bold>somebold <italic>some bold-italic text</italic> more bold </bold> more plain text"
i want to output that to html like this:
"some plain text <b>somebold <i>some bold-italic text</i> more bold </b> more plain text"
how do i do this?
ive created an xslt file that contains a match tag for each of my custom tags.
like this:
<xsl:template match="italic"><br />
<i>***<br />
<xsl:value-of select="*"/> <br />
<xsl:apply-templates select="*"/><br />
***</i><br />
</xsl:template>
the problem is that i dont know how to output the text inside the tags in a good way..
take the following sample
"<bold>hello<italic>this</italic>is a <italic>test</italic>blabla</bold>"
how can i do to make "hello","is a","blabla" to be outputted as bold text?
if i do as above with the value-of , it just outputs the whole innertext as a single string and then applies the templates..
//Roger
|
|
|
|
|
don't use value-of , get rid of that line and chage you apply-templates to select="*|text()"
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
How can I test whether a variable is a hash, array, or scalar?
I've got this complicated tree structure made up of hashes arrays and scalars, and I want to recursively print out every element.
Why is the phrase "It's none of my business" always followed by "BUT..." ![Poke tongue | ;-P](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_tongue.gif)
|
|
|
|
|
In Perl the type of a variable is known at compile time (as indicated by the $ or @ or % prefix). Or did you mean the type of data that a reference is pointing to? In that case, use the ref function.
And BTW look at the Data::Dumper module, it might already do what you want.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
"Just because the box has 2 gigabytes of memory doesn't mean you get to use it all!"
-- Rico Mariani, CLR perf guy
|
|
|
|