|
Christian - use xsl:param as a direct child of the xsl:stylesheet root element. You can then access the parameter in any XPath expression as $param-name.
The parameters can be added using the addParameter of IXSLProcessor if you're accessing MSXML programmatically. If you're using a command-line tool, obviously, it depends, but MSXSL (Microsofts c-line XSL tool) has a "param=value" syntax.
HTH
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Wow - that is EXACTLY what I was looking for, thanks.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Hi,
I am working on a C++ application using MSXML 4.0. I have a update function that need to update a node of the XML document. The function only receives a XML string that contains the new XML string corresponding to the node. How can I copy the XML string into the node?
Thank you.
|
|
|
|
|
Sascha wrote:
How can I copy the XML string into the node?
I did it in my CP+ article.
|
|
|
|
|
If I am not mistaking you are using the .NET Framework. I need to do the same whiteout the framework and use directly the MSXML.dll
|
|
|
|
|
|
How can i make IE 6.0 to validate an xml based on a Schema? Is it possible?
It seems to ignore the xsd file.
rechi
|
|
|
|
|
If I recall correctly, IE does not try to validate XML documents. You need to write a bit of code that sets the DOM's validateOnParse property to true and then loads the XML document into the DOM. Here's a JavaScript sample from the MSXML 4.0 SDK:
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");<br />
xmlDoc.async = false;<br />
xmlDoc.validateOnParse = true;<br />
xmlDoc.load("books.xml");
Erik Westermann
Author, Learn XML In A Weekend (October 2002)
|
|
|
|
|
You're right, IE doesn't validate the xml s. But you're code is missing the XMLSchemaCache part...
Anyway, you still deserve a !
rechi
|
|
|
|
|
Clearly I'm relatively new to authoring xml documents.
If I have an elment eg CarEngineCompnent and this element can have more CarEngineComponent within it, how do I represent this in an XML Schema? I'm confused as to what the schema should look like.
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
Senkwe Chanda wrote:
how do I represent this in an XML Schema?
...like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="CarEngineComponent">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="CarEngineComponent"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Although technically allowed, having a structure like this undermines one of the the benefits that an XSD (XML Schema) provides, namely, strong types. What this schema essentially says is that a CarEngineComponent is a mixed type element that can contain a value and another element. Although there's noting wrong with that from a purely structural point of view, most XML documents don't use that structure prefering instead ot have elements that contain data or other elements.
A bettter structure could be to have <CarEngineComponents> (note the plural form of the word) that contain one or more <CarEngineComponent> types. The naming convention makes it clear that <CarEngineComponents> is a container for something else.
Erik Westermann
Author, Learn XML In A Weekend (October 2002)
|
|
|
|
|
Thanks Erik. I'm trying to setup a schema for a situation where the level of containment is unknown and/or variable. For example, that CarEngineComponent could have a CarEngineComponent that itself contains another CarEngineComponent.
I'm getting the feeling that perhaps I'm not thinking in an XML-like way (which I've surprisingly found is not as sraight forward as I'd thought)
Thanks again, I'll go and rethink my document.
Regards
Senkwe
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
I have an XML file that need to be shown as a table.
I know that I can do it by XslTransform, but I need to let the user to edit the data and save it in the XML file.
How can I do it using C# in ASP.NET?
Thank you
Chagit
|
|
|
|
|
I believe the DataGrid (or something similar ) provided by WebForms can be bound to an XML source and is editable.
But I'm just startng with this stuff, so I'm not sure.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Chagit wrote:
How can I do it using C# in ASP.NET?
There are many ways, both conventional and unconventional.
As Christian mentioned you can use the power of the DataGrid to do most of the grunt work for you. This article explains how it is done.
You can also do it manually by having a master/detail setup as you would have had in ASP with a SQL data source. Remember XML is just a data source really, not a full query/input technology. You still need processing from ASP or ASP.NET or some other language to get data into an XML source.
So for example you would use XSL to output the HTML which included a FORM element back to a handling ASP page which goes through the FORM child-input-elements writing the changed data back into the XML file.
|
|
|
|
|
Hi there,
I m working on a application that is supposed to get a lot of info thru the web and it s calling a dll on server side thru SOAP..
1)it s working on several server but on one of them it s saying 'Class not registered"(dcom called dirrectly works fine but not soap)
2) when 2 client are accessingin the same times a big piece of work for the server it says send the 5300 error message which mean bad connection.. but it works fine if only one does that job
Anyone has a idea?
Thx
__________________
|
|
|
|
|
I was wondering if anyone has found an elegant solution to find if an xml node (of any XmlNodeType) is a child of another xml node using .NET?
Lol! - and I can't just use (node.Parent == parent) because it may not be a direct desendant
The code I came up with is:
private bool IsChild(XmlNode parent, XmlNode child, bool directDescendantsOnly) {
return ((child.ParentNode == parent)?
(true):
(directDescendantsOnly?
(false):
(((child.ParentNode == child.OwnerDocument)?
(false):
IsChild(parent, child.ParentNode, directDescendantsOnly)))
));
}
But it fails when you query NameSpace nodes, etc. It seems to be getting more and more special case, which is annoying...so please, if anyone has already tackled this one, can you let me know?
Many thankyous,
Ben
|
|
|
|
|
Would recursing though the children work better ( although it would take longer ) ?
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
hm - it might work (it should in theroy), but this code is quite core to the project I'm doing, so it's worth getting it to run as fast as possible. Admittedly getting it to run in the first place is always a good plan, but I think working backwards from the child, rather than forwards from the suggested parent, is a better plan.
Thanks for your help anyway!
Ben
|
|
|
|
|
I'm spending a lot of time with XML nowadays and I'm interested to know if anyone actually uses XSD's in their work situation ?
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Yes, we use it as the offical schema format.
"If I won't be myself, who will?" Alfred Hitchcock
|
|
|
|
|
Is your schema exposed externally ? I'm just curious because XSD's seem quite complex, the XSD for our format would surely take at least a day to write and I'm not sure I see the benefits for our application.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Christian Graus wrote:
Is your schema exposed externally ?
Not to be to evasive but I could answer this either way. For the matter of this discussion yes it is exposed. I.E. an authorized customer or supplier company can (when we open the server access) access the schemas to validate the data as well as us use it to validate what is submited to us.
Christian Graus wrote:
I'm just curious because XSD's seem quite complex, the XSD for our format would surely take at least a day to write and I'm not sure I see the benefits for our application.
Yes any schema will take some time. Especially since you seldom get it right the first time (i.e. do you really cover all of the options you are expecting to. However I think XSD's ar better than DTD's.
So the question is do you need a schema? I strongly recommend doing so if just for documenting your work. If this is all you need using one of the generation tools is good. I am using Authority from Tibco (formerly Extensibility). I think is you just get the schema tool it is only $100 US and is well worth the money. I have the TurboXML suite.
If all of your data transmitals are internal this is not as important as you can include testing to ensure compatiblity. But once you transmite or recieve data from other this is beyond your internal testing limits.
REF: http://www.tibco.com/solutions/products/extensibility/turbo_xml.jsp
I did not see authority listed by itself but you may want to check it out. The one big negative is it is java based so a little slow.
"If I won't be myself, who will?" Alfred Hitchcock
|
|
|
|
|
Michael A. Barnhart wrote:
However I think XSD's ar better than DTD's.
Yes, they appear to be. Internally, for documentation, we just create an empty XML document.
Michael A. Barnhart wrote:
I am using Authority from Tibco (formerly Extensibility).
How do these tools handle things like multiple nodes and minimum/maximum value/counts ? Do they take a number of documents to validate against ?
Michael A. Barnhart wrote:
If all of your data transmitals are internal this is not as important as you can include testing to ensure compatiblity. But once you transmite or recieve data from other this is beyond your internal testing limits.
Yes, that's basically what I thought. I'm asking from the perspective of writing a wrapper for XML in C#, and an editor for XML/XSL and XSD's, and I just wondered how useful they are in the 'real' world.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Christian Graus wrote:
How do these tools handle things like multiple nodes and minimum/maximum value/counts ?
Very easy. You just edit the general properties (i.e. required, optional, repeatable and then switch to a source mode where you can edit the individual values for min and max occurance (default is unbounded for max and 0 for min if optional and repeatable are set.
Christian Graus wrote:
Do they take a number of documents to validate against ?
I am not sure I am understanding this question. This generates the schemas. It does not do the validation. The validating parser would do this step.
Christian Graus wrote:
I'm asking from the perspective of writing a wrapper for XML in C#, and an editor for XML/XSL and XSD's, and I just wondered how useful they are in the 'real' world.
Yes they are useful in the real world. This will grow in the next several years. Right now the user authorization and validation for things like Web Services needs to be handled. At that point the need for these tools will grow as these services grow to be more than just demos (or in closed access as mine are).
You have to ask your self how much is this going to cost vs buying what is available. For me the tools were to cheap to keep updating our work.
"If I won't be myself, who will?" Alfred Hitchcock
|
|
|
|