XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 21st, 2001, 04:27 AM
stardotstar stardotstar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Posts: 63 stardotstar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
XML Help Needed

Say I have a simple XML file including this:
Code:
<ProductInfo>The <item>shirt</item> comes in 3 sizes.</ProductInfo>
<Comments>One <item>shirt</item> costs £10</Comments>

I need the XML file to know that the two instances of "shirt" are the same, so something like this:
Code:
<ProductInfo>The <item id="S3"/> comes in 3 sizes.</ProductInfo>
<Comments>One <item id="S3"/> costs £10</Comments>
<item id="S3" name="shirt"/>

...something to that effect, but obviously I'm doing it the wrong way.

What I want to achieve is a document that will look like this:

The shirt comes in 3 sizes.
One shirt costs £10

...so if I change "shirt" to "t-shirt" it will change in both places.

I'm finding it quite difficult to explain, but I hope you understand and can help me.

Thanks.

Reply With Quote
  #2  
Old June 29th, 2001, 12:38 AM
rdominy rdominy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 81 rdominy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via ICQ to rdominy
What are planning to use to generate the resulting document? Because on it's own XML is just a tag language and there are many applications/ways of transforming XML into something viewable.

Also, typically one would not mix data with pseudo-formatted output in the same document. Usuallly you have things broken into data and view transforms.

For example, if you use XML with XSL, you might have the following documents. Your XML document would have the data:

<item type="shirt" cost="10" numsizes="3"/>

And your XSL document would define how to output that into say HTML. Here's an XSL fragment:

<xsl:template match="item">
<p>The <xsl:value-of select="@type"/> comes in <xsl:value-of select="@numsizes"/> sizes.</p>
</xsl:template>

So the key is how do you plan to view your XML?
__________________
Robert Dominy
About Guide for JavaScript
http://javascript.about.com
Software Consulting & Development
http://www.angusog.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XML Help Needed

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap