|
Dave,
I think you are well along the right path. Good luck
David Chamberlain wrote:
Apparently, the preserve white space option is on by default.
Dave,
As I said earlier my code worked differently awhile back. I now have MSXML4 installed that the default appears to not include the white spaces. So I would go ahead and add that line in unless your memeory is much better than mine.
And go with what works. In COM you have interfaces. So a pointer to an interface is not the same thing as an interface to a pointer to XYZ. Don't we love this.
I needed a little refresher especially with what I learned for differences between 3 and 4.
Take Care and have a nice day. Mike
Good ideas are not adopted automatically.
They must be driven into practice with courageous patients. -Admiral Rickover. ...
|
|
|
|
|
I have 18000 items and it takes about 10 minutes to parse my xml-file, but only a few seconds if I comment out line 6.
What I'm doing wrong? How can speed-up the following?
1. Set oXMLNodeList = oXMLElement.selectNodes("data/item")
2. Put #fTestFile, , "Count: " & oXMLNodeList.Length & vbCrLf
3. For Each oItemY In oXMLNodeList
4. Put #fTestFile, , vbCrLf
5. For Each oItemX In oItemY.childNodes
6. Put #fTestFile, , " ;" & oItemX.nodeTypedValue
7. Next oItemY
8. Next oItemY
|
|
|
|
|
I do not work with VB so this is somewhat of an outside observation and could be a worthless comment but:
I would have added a line 4.5
Set oYList = oItemY.childNodes assuming this is valid in VB.
Potentially you may be copying the data over and over, I have seen this impact.
Then line 5 would be For Each oItemX in OYList
Line 7 should be Next oItemX
by commenting out line 6 you are never actually addressing the data.
Good ideas are not adopted automatically.
They must be driven into practice with courageous patients. -Admiral Rickover. ...
|
|
|
|
|
I found this page a few days ago and feel it is an interesting example that shows transformations without usage of what I see (and use) typically employing the
|
|
|
|
|
Given the following xml:
<para>The <link url="earth.htm">earth</link> rotates.</para>
Is there a way to use XSLT to write the content of the <para> element like this:
<p>The <a href="earth.htm">earth</a> rotates.</p>
|
|
|
|
|
Something along the lines of:
<xsl:template match="link">
<a>
<xsl:attribute name="href"><xsl:value-of select="@url" /></xsl:attribute>
<xsl:value-of select="."/>
</a>
</xsl:template>
I think. Its been a while since I have done XSLT.
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
That part works if you only want to show links. What I was wondering was if there was a simple way to put the link inside the rest of the text, i.e. in my example the result I wanted was The earth rotates.
|
|
|
|
|
MarSCoZa wrote:
<para>The earth rotates.
Technically that kind of XML is not really valid.
e.g.
<para>
The
<link url="earth.htm">earth</link>
rotates.
</para>
The The and Rotates PCDATA sections are "floating".
The reason being that an element can either only contain PCDATA or child-elements. It cannot contain both. Think about creating a DTD which defines that... You cannot really. The DTD element definition cannot contain PCDATA and an elements name.
However XML is quite forgiving in this case (which is strange considering it's normally very unforgiving nature) and you can use the following XSL to transform it.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="link">
<a>
<xsl:attribute name="href">
<xsl:value-of select="@url" />
</xsl:attribute>
<xsl:value-of select="."/>
</a>
</xsl:template>
</xsl:stylesheet>
The key is templates . I used to hate them and thought they were these daft, never used bits of XSL. Until I figured out how they worked and went "oooohh yes!"
Enjoy!
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
|
|
|
|
|
Paul Watson wrote:
The key is templates. I used to hate them and thought they were these daft, never used bits of XSL. Until I figured out how they worked and went "oooohh yes!"
I've never used XSLT for XML->HTML, but with XML->XML, templates are the god you bow down to and pray. It boggles my mind the thought of NOT using template matching in XSLT.
|
|
|
|
|
I have an XML document which I need to turn into a new format, where a small portion of it gets put in <static> tags, the rest does not. There is a LOT of XML on this page.
I've got the first half done, easy enough. Now I want to write a filter which, instead of saying 'include these tags and children', I want to say 'EXCLUDE these tages and children, include everything else'. How do I do that ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - <b>Martin Marvinski, 6/3/2002</b>
|
|
|
|
|
Which language and parser are you using to process the XML?
|
|
|
|
|
I'm using XSL, I got it working this afternoon - thanks.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Christian Graus wrote:
I got it working this afternoon - thanks.
How did you do it? I might run into that problem one day and need to know how, thanks
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
Sonork ID: 100.9903 Stormfront
|
|
|
|
|
My first pass would have been to use the count(tag) function and only processed if it returned 0.
Good ideas are not adopted automatically.
They must be driven into practice with courageous patients. -Admiral Rickover. ...
|
|
|
|
|
The trick is that a more generic filter will only include items that were not included in a more specific filter. I wrote specific filters for the tages I needed, then a generic filter, and it excluded all the items that the specific tags caught.
If that's not clear LMK, I can post the code from work tomorrow.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Anybody know how to use Voice XML ?
What do I need, how do I set it up ?
Any info would be useful.
Users.
Can't live with 'em, can't kill em!
|
|
|
|
|
VoiceXML is just a standard. Go here and grab the specs. Then, grab the parser ang language of your choice and start writing a processor.
Of course, there might be ones out there. I'm going by the work we did about a year ago for a copy that used VoiceXML. We had to write our own processor.
J
|
|
|
|
|
I need to validate an XML document against a schema, but I'm not having much luck finding a complete example in MSDN.
This is the pseudo code of what I want to do:
<br />
XMLValidater xVal = new XMLValidater("my dtd, etc...");<br />
XMLDocument xDoc = new XMLDocument("my XML doc");<br />
if (xVal.Validate(xDoc))<br />
Help would be cool.
Cheers,
Simon
X-5 452 rules.
|
|
|
|
|
I haven't looked at it but isn't XmlValidatingReader what you need?
|
|
|
|
|
Something very basic must be alluding me because this seems like an obvious thing that people would want to do in XSL, but for the life of me I cannot figure out how to do it.
I have one XML file with some content in it. I then have a master XSL file which transforms the XML into nice HTML for the browser.
However that XSL file needs to be a combination of other XSL files. i.e. It is a normal ASP with include statements idea.
So I need to know how to import sections of XSL into another XSL document.
dankie shan.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
Sonork ID: 100.9903 Stormfront
|
|
|
|
|
Have you tried using <xsl:import> or <xsl:include>? Works for me.
|
|
|
|
|
MarSCoZa wrote:
Have you tried using <xsl:import> or <xsl:include>? Works for me.
Yup, I, or rather my co-worker, used that but could not figure out how to actually apply the included templates at the spots she wanted. I found the xsl:call-template element and that worked perfectly.
Thanks for the input
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
Sonork ID: 100.9903 Stormfront
|
|
|
|
|
I figured it out. It was actually a problem a co-worker had and I had not sat down and tried anything until last night, it came relatively easy once I got stuck in.
The way to do it is using the <xsl:include href="file to include" /> and then the <xsl:call-template name="template name to call" /> elements.
If anyone wants an actual code example then please just ask.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
Sonork ID: 100.9903 Stormfront
|
|
|
|
|
Quick backstory: I have an app that has a customizable menu, controlled by an XML file. The format looks like:
<menuitem id="foo" url="blah" icon="somefile.ico" /> The weirdness is, two of my partners are seeing a bug where if the same icon value is in multiple <menuitem> tags, those (and only those) attributes can't be read. MSXML returns an empty string instead. I cannot reproduce this myself. Any ideas on WTF is going on here?
--Mike--
Rollin' in my 5.0
With the rag-top down so my hair can blow.
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Michael Dunn wrote:
Any ideas on WTF is going on here?
Simple: they are insane.
Crivo
Automated Credit Assessment
|
|
|
|