|
Is there a nice way to do this?
For instance, if I have the following two DOMS:
<document>
<collection>
<book>First</book>
<book>Second</book>
</collection>
</document>
and
<document>
<collection>
<book>Third</book>
<book>Fourth</book>
</collection>
</document>
I would like to end up with the following:
<document>
<collection>
<book>First</book>
<book>Second</book>
<book>Third</book>
<book>Fourth</book>
</collection>
</document>
I know I can do it programmatically, but I'd love to find a way to merge it for free. I haven't found a method to do it... Will I have to use XSL?
J
<small><center>May the bear never have cause to eat you.</center></small>
|
|
|
|
|
At the KB article below, some VB is shown that can merge two XML documents. You could modify it so it would run in a .vbs file (instead of a VB project I think?), but that would take all of two minutes.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q286817[^]
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Right. I had found that one. I was hoping somebody would point out the magical-yet-hidden "merge" method on the IXMLDOMNode interface.
I guess I'm going to have to do it by hand.
J
May the bear never have cause to eat you.
|
|
|
|
|
I am looking into XForms. Anybody out there who can share some experience? How steep is the learning curve? What rendering engine do people use? Does it do what it's supposed to do? That kind of stuff...
I am in particular interested in using XForms not for web forms, but for data-driven application development similar to what mozilla.org does with XUL.
TIA,
Bernd
|
|
|
|
|
|
Thanks for the link. Sadly, all alternatives to XForms I have seen, including XUL and the stuff you suggest, are nowhere close to what XForm promises (and nowhere close to the level of standardazation XForms have).
It remains to be seen if XForms can deliver what I need (still several hundreds of pages of W3C doc to go through), but the technology certainly is superior to what Rusan proposes. Rusan, basically, converts an .RC file into XML (well - sort of, as a short summary). On top of that, XForms offer restrictions, event handling, correlations and relations between elements, a submission protocol, ...
Bernd
|
|
|
|
|
I have read a little on XUL, but not on XForms. I'm also working on a very simply App that uses MSHTML for part of it's GUI, including live data editing. I'm very impressed with this approach at implementing GUI's for certain (simple) types of applications.
Are there any Windows GUI XForms implementations around?
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Try google. There are a couple of implementations, including IE plug-ins. I haven't tried any yet. In howfar any of these implementations allow for XForm-driven standard Windows dialogs (as opposed to browser-based forms) remains to be seen. I am interested in that, too.
What makes XForms superior to approaches like XUL is that no or little scripting is required. XUL, appart from being tied to Gecko, still requires JavaScript for event handling and inter-control dependencies. Having just said that; W3C specifications are a dull reading and I have another ~200 pages to go on the XForms 1.0 spec.
Bernd
|
|
|
|
|
Does anyone have a comprehensive list of reserved XML words such as "child" which can't be used to defined a field?
Thanks
Allan
|
|
|
|
|
There is no reserved keyword in Xml. "child" is ok.
|
|
|
|
|
Surely if setting an xpath you can't apply the word "child"?
|
|
|
|
|
Sure you can. It is all in is it placed appropriately in the correct syntax. Not private words like a programming language.
"I will find a new sig someday."
|
|
|
|
|
Thanks for the feedback.
Cheers
Allan
|
|
|
|
|
How could an if statment comes true if there is a child node of current node. It must be general,
<xsl:if test="?">
...
and recursion works in <xsl:apply-template>.
karanba
|
|
|
|
|
XSL has a function called count. So you need to ask if a count of the child nodes is greater than 0.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I have got one more question for you Christian. Here it is :
Thanks.
|
|
|
|
|
and if that doesn't work
.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
------------------------------
function Go(node){
var str = new String();
str+=node.nodeName+" ";
if(node.hasChildNodes()){
for(i=0;i
|
|
|
|
|
karanba wrote:
for(i=0;i {
that's never going to do anything. Ah - you've put < and > without ticking 'display this message as-is'. If you try again, I'd be happy to have a look at it when I can see it all.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
------------------------------
function Go(node){
var str = new String();
str+=node.nodeName+"
";
if(node.hasChildNodes()){
for(i=0;i
|
|
|
|
|
Either your compiler is broken or you did not follow my instructions and tick the box that says 'Display this message as-is (no HTML)'. I suspect the latter. The < in your for loop is finding a > to turn into a tag, and it's being stripped.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hi All
I have an xml which is passed thru a sytlesheet and in the resultant file, two tags IDValue and IDScheme are not properly output.
Could you please help me out !
Thanks
<b>Enclosed - Source XML </b>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="C:\ExpressPrototypes\Chi Interface Prototype 2\XMLFiles\RegisterPatientResponse.xsl"?>
<gen:RegisterPatientResponse xmlns:gen="http://www.show.scot.nhs.uk/isd/General" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- xsi:schemaLocation="http://www.show.scot.nhs.uk/isd/General CHIRegisterPatientResponse.xsd" -->
<!-- Contains standard patient response header and a patient body which contains the CHI Number -->
<gen:StandardPatientResponseHeader>
<gen:ReturnCode>SUCCESS</gen:ReturnCode>
<gen:ErrorCode>0001</gen:ErrorCode>
<gen:ErrorText/>
</gen:StandardPatientResponseHeader>
<!-- Standard patient response body containing the CHI Number -->
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>1601025017</gen:IdValue>
<gen:IdScheme>CHI</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
</gen:RegisterPatientResponse>
<b>Enclosed Source XSL</b>
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gen="http://www.show.scot.nhs.uk/isd/General" xmlns:req="http://www.isoftplc.com/Express/Chi/RegisterPatientResponse" xmlns:hdr="http://www.isoftplc.com/Express/Chi/Header" exclude-result-prefixes="gen hdr">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()|@*"/>
<xsl:template match="gen:RegisterPatientResponse">
<gen:RegisterPatientResponse>
<xsl:apply-templates/>
</gen:RegisterPatientResponse>
</xsl:template>
<xsl:template match="gen:StandardPatientResponseHeader">
<gen:StandardPatientResponseHeader>
<gen:ReturnCode>
<xsl:value-of select="./gen:ReturnCode"/>
</gen:ReturnCode>
<gen:ErrorCode>
<xsl:value-of select="./gen:ErrorCode"/>
</gen:ErrorCode>
<gen:ErrorText>
<xsl:value-of select="./gen:ErrorText"/>
</gen:ErrorText>
</gen:StandardPatientResponseHeader>
</xsl:template>
<xsl:template match="gen:StandardRegisterPatientResponseBody">
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>
<xsl:value-of select="./gen:IdValue"/>
</gen:IdValue>
<gen:IdScheme>
<xsl:value-of select="/gen:IdScheme"/>
</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
</xsl:template>
</xsl:stylesheet>
The values IDValue and IDScheme are not properly output
|
|
|
|
|
Heya,
either change the XSL to:
...
<xsl:template match="gen:StandardRegisterPatientResponseBody">
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>
<xsl:value-of select="gen:PatientDetails/gen:PatientId/gen:IdValue"/>
</gen:IdValue>
<gen:IdScheme>
<xsl:value-of select="gen:PatientDetails/gen:PatientId/gen:IdScheme"/>
</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
...
or, since you seems to make a copy of the stuff use the xsl:copy-of element.
Cheers
/WW
|
|
|
|
|
Hi folks, I have been hearing how good XML is when it comes to creating structured documents. My question is: I have tons of documents (text form), how do I port over to XML in the shortest time?
And, after porting, how do I update, edit it? It's not like SQL which I can code some interface (mainly in browser) to deal with it. I've been wondering this, can any kind soul answer me? Thanks.
--
Wei-Hui
|
|
|
|
|
Lim Wei-Hui wrote:
tons of documents (text form)
I presume there is a standard format that all your txt docs use? Like delimitors for different sections?
Lim Wei-Hui wrote:
how do I update, edit it?
It is actually pretty easy to update XML documents, so I don't think this is an issue.
All you'll need to do is:
load xml file into xmldom
manipulate nodes and or their values
save the xmldom back to the file
Can you perhaps post a snipett from the doc. and also explain a bit more about this application?
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
my svg article
|
|
|
|