|
Miguel Lopes wrote:
-XML adds a lot of overhead, means bigger DB
Have you ever zipped/compressed an XML file?
Man, I grinned from ear to ear when I saw the compression ratio. Zip loves all those repetitive tags.
So for transfer it is not as big a problem as some people make out. Of course when you are working with the XML it has to be unzipped and then the size can be a pain.
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
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
The problem is when you are working with a speed-demanding DB system, when the client workstations need almost real time feedback from the DB. If i want to conduct a search inside each XML string (if you treat it as a stream) for each row in a DB table, and you also have to unzip it first, the overall system performance is heavly reduced.
For transfers, no problem. I agree with you.
Best Regards
|
|
|
|
|
Hello;
I want to update my XML file by XSXML40. But i have no idea how can i do that. The main problem is, i don't want to save (or write) whole file after update a record.
How can i update a record in XML file (I don't want to use DOM).
Thank you...
Ahmet Orkun GEDiK
|
|
|
|
|
SAX.
Alice thought that running very fast for a long time would get you to somewhere else. " A very slow kind of country!" said the queen. "Now, here , you see, it takes all the running you can do, to keep in the same place".
|
|
|
|
|
how do we display the selected value in select box(drop down) in xsl & xml. All the values for drop down are selected thru' xml file.
|
|
|
|
|
Just to be clear: do you want to use XML/XSL to do something to your select boxes in response to a client-side event?
|
|
|
|
|
yes. I want to use XML/XSL for onChange javascript event.
|
|
|
|
|
You don't really need XSL for client-side processing (unless you want a client-side event to write a lot of HTML). XSL is a transformation language, not a programming language. It can be used to write HTML elements, but doesn't respond to them.
Is this for an intranet application, or an internet application? (I.e. can you control which browser your users have?) What exactly should happen in the SELECT element's onChange event?
|
|
|
|
|
Is this for browser-based client side?
If so, why not do the following:
when event happens send x info to the server using XMLHTTP and use the resulting XML to populate the combo using JScript.
XSL doesn't really fit in here.
Cheers,
Simon
"Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond
|
|
|
|
|
|
|
Has anyone taken the time to create some schemas for validating SQLXML documents? For example, I'd like to be able to validate an updategram before posting it to my server. Also, the cool intellisense features of having an associated schema would be nice...
Sooner or later, I'll probably take the time to hammer one out, myself, but I thought I'd save the time and effort if someone else has already done this...
Surely Microsoft has just such schemas internally, I wonder why they don't release them. (I've asked a couple times and never gotten a response...)
Thanks!
|
|
|
|
|
I thikn I saw something about that in the Extreme XML column on the MSDN site.
Alice thought that running very fast for a long time would get you to somewhere else. " A very slow kind of country!" said the queen. "Now, here , you see, it takes all the running you can do, to keep in the same place".
|
|
|
|
|
OK, I've got my source document, right? And it uses two different namespaces, my custom one and the XHTML one. The contents of it are a mix of XHTML and my own markup. So the header on that looks like this:
<Page xmlns="/PageWriter/TemplateSchema.xsd" xmlns:XHTML="http://www.w3.org/1999/xhtml">
Now, I've got my XSL stylesheet, right? And it's used to take the source document and transform it into pure XHTML. So I've figured out that I need to do this in my header, I think:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:MHC="/PageWriter/TemplateSchema.xsd">
<xsl:output encoding="utf-8"
indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
And thereafter all references in my <xsl:...> tags that refer to my own custom elements use the prefix MHC: , like so:
<title>MadHamster Creations - <xsl:value-of select="MHC:Page/MHC:Head/MHC:Title" /></title>
BUT! The problem is now that I have a few weird output issues. The first of all, and this one is really bad because it makes my documents not validate as XHTML, is that my <html> tag now looks like this:
<html xml:lang="en-US" lang="en-US" xmlns:MHC="/PageWriter/TemplateSchema.xsd" xmlns="http://www.w3.org/1999/xhtml">
Not like this, which is how it's supposed to look but doesn't:
<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
The other weird thing occurs only when I call a template from inside my main template, like so:
<xsl:apply-templates select="MHC:Page/MHC:Body" />
The header for the other template is:
<xsl:template match="MHC:Page/MHC:Body" name="ProcessBody">
Inside the main template, everything works fine. But when I call this other template, all of my XHTML elements generated inside that template have this extra attribute in them. The attribute is xmlns="" , which is needless to say redundant, although it doesn't make the document invalid.
Why? How can I stop it?
Anyone who wants more in-depth information can get my source files and a .NET utility to transform them, by e-mailing me. Think of it as an interesting intellectual challenge! Yeah, that's it! A challenge! Come and fix it, smart people.
Well, thanks in advance.
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
Heya,
to get rid of the unnecessary XSL/XML info in your ouptut data then put the attribute 'exclude-result-prefixes' in the xsl:stylesheet node, like this:
<xsl:stylesheet
="" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mhc="/PageWriter/TemplateSchema.xsd" exclude-result-prefixes="MHC">
Just space-separate all the namespace prefixes you do not want in the result.
I also set the 'omit-xml-declaration' to "yes" in the xsl:output element to get rid of the XML declaration.
/WW
|
|
|
|
|
Thanks a ton for the response! I was beginning to think nobody knew...
Anyways, the exclude-result-prefixes works great to get rid of the extra xmlns:MHC="..." in my <html> tag. I need to keep the XML declaration for valid XHTML however, but thanks for the help anyways.
So, any ideas on the empty xmlns="" attribute that pops up in those elements? Rather weird...
Thanks again, it's really reat to have someone who knows this stuff!
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
Okay - I am fairly new to XSL and am trying to embed some JavaScript into an existing XSL stylesheet. The JS is to prevent the refresh from blinking. This is a really long post - just a warning!!
This is a sample of the XSL where I need to embed the script:
<xsl:template name="coursestats">
<xsl:param name="Round"/>
<xsl:variable name="CourseAcronym" select="@CourseAcronym"/>
<table border="0" cellpadding="0" cellspacing="0" background="/images/mybg.gif" width="642">
<tr>
<td width="1" bgcolor="Olive"> </td>
<td width="34" height="14" class="titClass">Hole</td>
<td width="1" bgcolor="Olive"> </td>
<td width="30" height="14" class="titClass">Par</td>
<td width="1" bgcolor="Olive"> </td>
<td width="54" height="14" class="titClass">Yardage</td>
<td width="1" bgcolor="Olive"> </td>
<td width="74" height="14" class="titClass">Scoring Avg</td>
<td width="1" bgcolor="Olive"> </td>
<td width="34" height="14" class="titClass">Rank</td>
<td width="1" bgcolor="Olive"> </td>
<td width="106" height="14" class="titClass">Avg Over/Under Par</td>
<td width="1" bgcolor="Olive"> </td>
<td width="40" height="14" class="titClass">Eagles</td>
<td width="1" bgcolor="Olive"> </td>
<td width="42" height="14" class="titClass">Birdies</td>
<td width="1" bgcolor="Olive"> </td>
<td width="38" height="14" class="titClass">Pars</td>
<td width="1" bgcolor="Olive"> </td>
<td width="54" height="14" class="titClass">Bogeys</td>
<td width="1" bgcolor="Olive"> </td>
<td width="82" height="14" class="titClass">Double Bogeys</td>
<td width="1" bgcolor="Olive"> </td>
<td width="54" height="14" class="titClass">Other</td>
<td width="1" bgcolor="Olive"> </td>
</tr>
<xsl:for-each select="Hole">
<xsl:sort select="@HoleNumber" order="ascending" data-type="number"/>
<tr> <td width="1" bgcolor="Olive"> </td>
<td width="34" height="14" class="txtClass"><xsl:value-of select="@HoleNumber"/></td> <td width="1" bgcolor="Olive"> </td>
<td width="30" height="14" class="txtClass"><xsl:value-of select="@Par"/></td> <td width="1" bgcolor="Olive"> </td>
<td width="54" height="14" class="txtClass"><xsl:value-of select="@PublishedYardage"/></td> <td width="1" bgcolor="Olive"> </td>
<xsl:variable name="numerand" select="Round[@Number = $Round]/ScoreN"/>
<xsl:variable name="operand" select="Round[@Number = $Round]/ScoreO"/>
<td width="74" height="14" class="txtClass">
<xsl:if test="$numerand != 0"><xsl:value-of select="format-number($operand div $numerand, '0.000')"/></xsl:if>
</td> <td width="1" bgcolor="Olive"> </td>
This is the start of the JS that I am using - it works in my HTML but when I try to embed into the XSL I only get the opening and closing JS tags for output:
<html><head>
<script language="JavaScript"> <!--
function makeChange() {
var newData = '';
// START DATA
newData += '<table border=0 cellpadding=0 cellspacing=0 background="/images/mybg.gif" width="642">';
newData += '<tr>';
newData += ' <td width="1" bgcolor="Olive"> </td>';
newData += ' <td width="34" height="14" class=titClass>Hole</td>';
newData += ' <td width="1" bgcolor="Olive"> </td>';
newData += ' <td width="30" height="14" class=titClass>Par</td>';
newData += ' <td width="1" bgcolor="Olive"> </td>';
newData += ' <td width="54" height="14" class=titClass>Yardage</td>';
newData += ' <td width="1" bgcolor="Olive"> </td>';
newData += ' <td width="74" height="14" class=titClass>Scoring Avg</td>';
newData += ' <td width="1" bgcolor="Olive"> </td>';
newData += ' <td width="34" height="14" class=titClass>Rank</td>';
newData += ' <td width="1" bgcolor="Olive"> </td>';
newData += ' <td width="106" height="14" class=titClass>Avg Over/Under Par</td>';
newData += ' <td width="1" bgcolor="Olive"> </td>';
I don't know if my problem is the newData+=' '.
Can anyone shed some light?
THANKS!
Julia
|
|
|
|
|
Simple - here's how you can embed JavaScript into an XSL document...
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
...
<xsl:text disable-output-escaping="yes">
<![CDATA[
<script>
// your code goes here
</script>
]]>
</xsl:text>
...
</xsl:stylesheet>
HTH!
Essam - Author, JScript .NET Programming
...and a bunch of articles around the Web
|
|
|
|
|
Thanks - I'll give it a try.
Julia
|
|
|
|
|
I've been givin the task of developing a schema for some message formats. The formats are in XML and they all use common elements except for one. The group element is different for each of the messages. one message it may be of type lineGroup of another bitGroup. My question is how can I make my schema take either type group? I've found that one element name with 2 types does not work. So what is the work around? I'm new to this so if there is something I'm missing please fill me in. TIA.
example of the xml file (the <> were intentionally left out)
in one file...
group type="lineGroup"
name message1 /name
.
.
.
/group
In the other file
group type="bitGroup"
name message2 /name
.
.
.
/group
nay
|
|
|
|
|
This schema allows the attribute of the Group element names Type to be either LineGroup or BitGroup.
<?xml version = "1.0" encoding = "UTF-8"?>
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
<xsd:element name = "Group">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref = "Name"/>
</xsd:sequence>
<xsd:attribute name = "Type" use = "required">
<xsd:simpleType>
<xsd:restriction base = "xsd:string">
<xsd:enumeration value = "LineGroup"/>
<xsd:enumeration value = "BitGroup"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name = "Name" type = "xsd:string"/>
</xsd:schema>
To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
|
|
|
|
|
OK, this is probably me being stupid, but there are two things I want to do, and I can't seem to get them working:
- Insert special characters with the DOM
Some Unicode characters don't get encoded properly by the DOM. I've set the encoding to UTF-8, but when I set the Text property of a node to a string containing Unicode characters, they get replaced with "?". I've tried replacing them with the relevant "Π" , but that gets encoded as "&#x03A0;" ! Has anyone found a way to do this with the MSXML parser, or the .Net framework? - Query the default namespace with XPath
If I have an XML document with no namespace:
<?xml version='1.0'?>
<root>
<someNode>Item 1</someNode>
<someNode>Item 2</someNode>
<someNode>Etc...</someNode>
<root>
I can use oNode.selectNodes("//someNode") to select the "someNode" nodes.
If I have a namespace with a prefix:
<?xml version='1.0'?>
<trinet:root xmlns:trinet='http://www.trinet.co.uk/xml/Test.xsd'>
<trinet:someNode>Item 1</trinet:someNode>
<trinet:someNode>Item 2</trinet:someNode>
<trinet:someNode>Etc...</trinet:someNode>
<trinet:root>
I can use oNode.selectNodes("//trinet:someNode") .
But, if I have a default namespace:
<?xml version='1.0'?>
<root xmlns='http://www.trinet.co.uk/xml/Test.xsd'>
<someNode>Item 1</someNode>
<someNode>Item 2</someNode>
<someNode>Etc...</someNode>
<root>
oNode.selectNodes(""//someNode") returns nothing!
So far, the only solution I have found (in .Net) is to create an XMLNamespaceManager , add the default namespace as a namespace with a prefix, and then modify the XPath query to use the prefix, passing the XMLNamespaceManager object to every call to selectNodes or selectSingleNode .
Has anyone found a way to make the XPath query recognize the default namespace?
Thanks in advance.
Richard
|
|
|
|
|
Richard_D wrote:
Insert special characters with the DOM
There's something wrong on your system since XML supports Unicode characters. Make sure that your system supports the unicode characters you're inserting into the document. Assuming that you read the document into an editor to see the '?' marks in place of your unicode characters, make sure that the editor you use supports unicode files - Notepad on Windows 9x does not support Unicode whereas Notepad on Windows 2000 and XP supports it. If you're using 9x, open the file using something like XML Spy, which supports Unicode directly.
Richard_D wrote:
Query the default namespace with XPath
You've run into a very common problem with XPath 1.0. The specification is very confusing with regards to how vendors should handle the default namespace; as a result, vendors implement it differenly. The next incarnation of XPath is epxected address the problem.
In the mean time, your best option is to use a prefix as you did in your message's second listing. I suggest that you try to stick to that method since Microsoft could change their mind and cause your app to break when the next incarnation of XPath becomes a standard. Using namespace prefixes takes advantage of a standard, whereas the method you use (using the XMLNamespaceManager) is specific to Microsoft's XML parser and may not work in the future based on the direction of the wind and the state of evolving standards.
Essam - Author, JScript .NET Programming
...and a bunch of articles around the Web
|
|
|
|
|
Thanks for replying. I think I've solved the first problem - I needed to set the encoding to "ISO-8859-1" instead of "UTF-8". Now the only problem is to get the XMLHTTP object to recognize the correct code-page for non-XML documents.
As for XPath, I kind of suspected that this was the case. The other solution I found, which will only work for some XML documents, is to use the DataSet object to load the XML. Hopefully, this will continue to be supported as .Net evolves, regardless of the standards implemented.
Cheers,
Richard
|
|
|
|
|
Hi,
I have 2 very simple XML files. How would I compare them?
Thanks,
Vance
|
|
|
|