XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Closed Thread
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 September 14th, 2004, 05:57 PM
jkmyoung jkmyoung is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 505 jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 5 h 22 m 53 sec
Reputation Power: 53
Need advice on splitting xml data

Hi, I have an xml file which I need split into two files due to a change in our implementation for a newer version.

Basically I've got something like this:
<store>
<inventory>
<item name="a" price="1" stock="9"/>
<item name="b" price="2" stock="8"/>
<item name="c" price="1" stock="7"/>
</inventory>
<inventory>
<item name="d" price="3" stock="6"/>
<item name="e" price="5" stock="0"/>
</inventory>
</store>

and using xslt I want to split it into two files like this:
File A:
<store>
<item id="1" stock="9"/>
<item id="2" stock="8"/>
<item id="3" stock="7"/>
<item id="4" stock="6"/>
<item id="5" stock="0"/>
</store>

File B:
<items>
<item id="1" name="a" price="1"/>
<item id="2" name="b" price="2"/>
<item id="3" name="c" price="1"/>
<item id="4" name="d" price="3"/>
<item id="5" name="e" price="5"/>
</items>

Should I generate one of the files first and then generate the 2nd file by getting the 1st as an external document? Seems like a little bit of a hassle; I'd like to find a simpler way if possible. Also, is there any easy way to get a random unique id #?

Thanks

Joseph

Reply With Quote
  #2  
Old September 15th, 2004, 11:52 AM
jkmyoung jkmyoung is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 505 jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level)jkmyoung User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 5 h 22 m 53 sec
Reputation Power: 53
ah, never mind was making this problem a lot more complicated than it had to be. Friend gave me a solution to create a secondary xml file:
<inventory>
<item name="a" price="1" stock="9"/>
<item name="b" price="2" stock="8"/>
<item name="c" price="1" stock="7"/>
<item name="d" price="3" stock="6"/>
<item name="e" price="5" stock="0"/>
</inventory>
and use the position function to create the other 2 with linked ids. thanks anyways

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Need advice on splitting xml data


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

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT