473,511 Members | 16,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1864
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
5921
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
1957
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
5452
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
13734
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
2681
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
3694
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
5519
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
1639
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
1815
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...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.