Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
| Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 19th, 2013, 02:34 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default how awrite an rule using xml

Hello Every body,

Can any one please help me in writing an rule in xml.

for example:

sample.txt is my input file

sample.txt :

186886ITANALYST10000
198806COSULTANT20000


This is the sample data from my upstream.


Now i have sample rules like first 6 characters are unique employee number
and next 9 characters are designation and next 5 characters are salary. now i have to send a different format to my downstream. i.e my sample file will be

18688610,000$
19880620,000$

Can i achieve this by using xml rules or is there any other method. I am using java. i have to write java code to read the xml and apply the rule on each record and prepare the sample output which needs to be sent to down streams.

I have used xslt to transform one xml to other xml but i exactly do not know about doing some transformations on the data in text file and send the output in text file as well.

ManyThanks
Sarayu
  #2 (permalink)  
Old April 21st, 2013, 01:33 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Any Suggestions please.


Regards
Sarayu
  #3 (permalink)  
Old April 21st, 2013, 04:57 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Define 'XML rules'. XML is just a descriptive way of storing data - you can define your own 'schema' that means the XML can be interpreted as a series of rules for processing text, but how you do that is up to you - I'm not aware of any standard method.

You would then need something that understood your XML to process it, and the input to produce the output.

If you are using XSLT 2.0 then you can write XSLT to process text, usually using the unparsed-text() function to read the incoming text, but you either end up with a number of regular expression instructions, or loads of substring function calls etc.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making the horizontal rule a picture - possible or not? andypandyrox456 BOOK: Beginning HTML, XHTML, CSS, and JavaScript 4 April 7th, 2010 12:26 PM
Relationships between the Tables - Delete rule yevi BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 May 1st, 2009 09:44 AM
Need help with a validation rule Hliu Access VBA 1 September 3rd, 2008 09:42 AM
Create a validation rule sheregardner Access 1 October 24th, 2006 07:00 AM
Writing Rule Problem gaurav_jain2403 SQL Server 2000 5 August 3rd, 2006 12:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.