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

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 October 2nd, 2003, 09:18 PM
Dipesh Dipesh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 29 Dipesh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 51 sec
Reputation Power: 0
Implmenting for-each for the algorithm

Hi,

I am having xml like this.
Input xml (File1)
----------
<Root>
<Tables>
<Table Name="T1" Value="tableName1">
<Column Name="col1" Value="colVal1" Datatype="char"/>
<Column Name="col2" Value="colVal2" Datatype="char"/>
<Column Name="col3" Value="colVal3" Datatype="date"/>
<Column Name="col5" Value="colVal5" Datatype="char"/>
</Table>
</Table>
<Root>

===================================================================

I am reding one more xml file for mapping columns. I am reading it using document function. This xml gives me the name of the column for which data is available in the datafile.

Document Mapping xml (File2)
--------------------
<Root>
<FixedTables>
<Table Name="T1">
<Column Name="Col1" />
<Column Name="Col2" />
<Column Name="Col3" />
<Column Name="Col4" />
<Column Name="Col5" />
</Table>
</Root>


I am creating a text file(basically control file which i am feeding to sql loader) out of it and needs output like this. I am showing a part of my desired output.

Desried output (File3)
--------------
INTO TABLE tableName1
(
colVal1,
colVal2,
colVal3 Date "MM/DD/YYYY HH:MI:SS AM",
col4 FILLER char terminated by '`',
colVal5
)

====================================================================

I am able to get the output properly if there is no col4 in the mapping file i.e. file2 then not writing line 5 above in the output.

I want to implement something like
1) Read each column from the File1.
2) Match it will all the columns of File2
3) If name of column is same then get the value of column from file1 and check if datatype attribute is date then output "Date MMD:YYYY HH:MI:SS AM" otherwise don't do anything.
4) If match exit from the for loop (is this possible in xsl)
5) After doing match for all the columns of file1, whichever columns of file2 are not matched shall be written within parenthesis like
"Column@Name (from file2) FILLER char terminated by '`'. As shown in the above desired output col4 came only once in the output for matching all the columns of File1 with that of file2.

I hope i am clear in explaining my problem.
Any help to implement the above logic would be highly appreciated.

Eagerly waiting for reply.

Regards,
Dipesh

Reply With Quote
  #2  
Old October 3rd, 2003, 10:06 AM
Dipesh Dipesh is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 29 Dipesh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 51 sec
Reputation Power: 0
Hi,

The mistake which i was making was reading file1 as main input and reading file2 using document. Actually i have to reverse this and then it will be quite simple.

I have not had good design that why got stucked.

I will change it and then i guess it will be quite easy.

Regards,

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Implmenting for-each for the algorithm


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 5 hosted by Hostway
Stay green...Green IT