472,796 Members | 1,507 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 software developers and data experts.

Help with passing xml tags within an xml file

Let's say I have the following tags in an xml:
<World>
<Country>Canada</Country>
<Hemisphere>North</Hemisphere>
<Weather climate="cold" forecast="snow">
<CommandAction>$(HOME)\calculate.py Canada North
snow</CommandAction>
</Weather>
</World>

The CommandAction tag will invoke some python script which takes
Country Hemisphere and forecast as parameters. Is there a way to
generalize the CommandAction tag so that it can look something like the
following:

<CommandAction>$(HOME)\calculate.py <Country> <Hemisphere>
<forecast></CommandAction>

I'm not very experienced with xml and I would like to know if the above
is a proper way of doing what I want. Any help please?

Thanks
Thierry

Feb 14 '06 #1
5 1818
Thierry wrote:
Let's say I have the following tags in an xml:
<World>
<Country>Canada</Country>
<Hemisphere>North</Hemisphere>
<Weather climate="cold" forecast="snow">
<CommandAction>$(HOME)\calculate.py Canada North
snow</CommandAction>
</Weather>
</World>

The CommandAction tag will invoke some python script which takes
Country Hemisphere and forecast as parameters. Is there a way to
generalize the CommandAction tag so that it can look something like the
following:

<CommandAction>$(HOME)\calculate.py <Country> <Hemisphere>
<forecast></CommandAction>

I'm not very experienced with xml and I would like to know if the above
is a proper way of doing what I want. Any help please?


A more manipulable construction might look something like:

<World>
<Country>Canada</Country>
<Hemisphere>North</Hemisphere>
<Weather climate="cold" forecast="snow">
<CommandAction location="home">
<script>calculate.py</script>
<param value="Country"/>
<param value="Hemisphere"/>
<param value="Weather/@forecast"/>
</CommandAction>
</Weather>
</World>

Then you can write some XSLT to create output which some processor
(Python) can execute. XML itself can't run programs, because it is
not itself a programming language.

(In fact, you'd need to write XSLT to write XSLT. The double
indirection is needed because XSLT is not dynamic and cannot re-rig
itself internally during execution to reflect a value it has only
just come across (like the XPath syntax implied in my <param>
elements.)

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Feb 15 '06 #2
Peter Flynn wrote:
Thierry wrote:
Let's say I have the following tags in an xml:
<World>
<Country>Canada</Country>
<Hemisphere>North</Hemisphere>
<Weather climate="cold" forecast="snow">
<CommandAction>$(HOME)\calculate.py Canada North
snow</CommandAction>
</Weather>
</World>

The CommandAction tag will invoke some python script which takes
Country Hemisphere and forecast as parameters. Is there a way to
generalize the CommandAction tag so that it can look something like the
following:

<CommandAction>$(HOME)\calculate.py <Country> <Hemisphere>
<forecast></CommandAction>

I'm not very experienced with xml and I would like to know if the above
is a proper way of doing what I want. Any help please?

A more manipulable construction might look something like:

<World>
<Country>Canada</Country>
<Hemisphere>North</Hemisphere>
<Weather climate="cold" forecast="snow">
<CommandAction location="home">
<script>calculate.py</script>
<param value="Country"/>
<param value="Hemisphere"/>
<param value="Weather/@forecast"/>
</CommandAction>
</Weather>
</World>

Then you can write some XSLT to create output which some processor
(Python) can execute. XML itself can't run programs, because it is
not itself a programming language.


XML is used for anything, it can be used like a programming language as well

-don't you think that XSLT is itself a kind of programming language ?
(it reads an input, processes it, and produces an output, even if the
input must be XML)

-I designed myself a general purpose language :)
have a look here :
http://disc.inria.fr/perso/philippe....l/active-tags/
and here :
http://reflex.gforge.inria.fr/
(this is the engine that implement all that stuff)

a nice toy ;)

(In fact, you'd need to write XSLT to write XSLT. The double
indirection is needed because XSLT is not dynamic and cannot re-rig
itself internally during execution to reflect a value it has only
just come across (like the XPath syntax implied in my <param>
elements.)

///Peter

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !
Feb 15 '06 #3
Philippe Poulard wrote:
XML is used for anything, it can be used like a programming language as
well
Not exactly. XML itself is pure syntax. You can use that syntax to
express any kind of data, including program stucture. Think of XML as a
toolkit for writing languages.
-don't you think that XSLT is itself a kind of programming language ?


XSLT is very explicitly a nonprocedural rule-based programming language.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Feb 15 '06 #4
Joseph Kesselman wrote:
Philippe Poulard wrote:
XML is used for anything, it can be used like a programming language
as well

Not exactly. XML itself is pure syntax. You can use that syntax to
express any kind of data, including program stucture. Think of XML as a
toolkit for writing languages.


This is exactly what I meant
-don't you think that XSLT is itself a kind of programming language ?

XSLT is very explicitly a nonprocedural rule-based programming language.


You said it ;)

No comment about Active Tags ?

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !
Feb 15 '06 #5
Philippe Poulard wrote:
Peter Flynn wrote:

[...]
XML itself can't run programs, because it is
not itself a programming language.


XML is used for anything, it can be used like a programming language as
well


Read what I wrote. Yes of course XML syntax can be used to represent
programming language constructs -- as you say, XSLT is a programming
language -- but XML *itself* is not a programming language: it's just
a specification for a markup syntax that can be used to identify lots
of different things.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Feb 15 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chaduke | last post by:
I wrote a simple client/server chat program and the client runs as an activex control within an asp page. I have the users logging into the page using widows authentication and I'm using...
2
by: \ | last post by:
Hi...I found your group on the search engine...First you have to know that I'm on a webtv unit.....I am really desperate.. I'm not much on tech terms as most of my pages are found and reworked...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
4
by: Pushkar Pradhan | last post by:
I need to pass a struct by reference to a function: The struct: typedef struct tifftags { uint32 imageWidth, ...; ... } TIFFTAGS; typedef TIFFTAGS * TIFFTAGS_PTR; main() { .....
10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
3
by: Rob | last post by:
Hi, I've written a small VB application that parses an HTML document and removes code I don't need and re-writes the file. I'm looking for the regex pattern that will remove the following code: ...
2
by: deshg | last post by:
Hey everyone, I am a php programmer originally and am just helping a friend of mine update their website that they paid a designer (well that's what he called himself!) to do ages ago. I have...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.