473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Convert XML files

I need to convert following huge xml file like this
-----------------------
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <nodeset>
  3.    <option value="132.146.3.231" label="132.146.3.231"></option>
  4.    <option value="122.333.4.444" label="122.333.4.444"></option>
  5. </nodeset>
-----------------------
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2.  
  3. <nodeSet>
  4.     <node  name="21cnedc23" host="132.146.3.231" port="20014" />
  5.     <node name="sjs005a002" host="10.189.33.42" port="60012" />
  6.      <node name="sjs005w001" host="10.189.60.6" port="60012" />
  7.     <node name="cbu072a013" host="10.24.80.130" port="20014" />
  8.     <node name="cbu072a014" host="10.24.80.133" port="20014" />
  9.     <node name="hwdust01" host="147.149.178.23" port="62004" />
  10.  
  11.     <node name="hwdusa31.devenv1.bt.co.uk" host="147.149.178.8" port="62004" />
  12.     <node name="orpg-d" host="hwdusa31.devenv1.bt.co.uk" port="62004" />
  13.     <node name="orpgs-2" host="hwdusa31.devenv1.bt.co.uk" port="62004" />
  14.     <node name="orpg-i" host="hwdusa31.devenv1.bt.co.uk" port="62004" />
  15.     <node name="hwdusa26.devenv1.bt.co.uk" host="147.149.178.240" port="62004"/>
  16.     <node name="iwod.devenv1.bt.co.uk" host="hwdusa31.devenv1.bt.co.uk" port="62004"/>
  17.  
  18.     <node name="marsweb" host="efsnapp30.empft.openreach.co.uk" port="61001"/>
  19.     <node name="marsapp" host="efsnapp27.empft.openreach.co.uk" port="61001"/>
  20.  
  21.     <node name="cbpweb01" host="10.24.85.145" port="60012"/>
  22.     <node name="cbpweb02" host="10.24.85.146" port="60012"/>
  23.     <node name="cbpweb03" host="10.24.85.155" port="60012"/>
  24.     <node name="cbpweb04" host="10.24.85.156" port="60012"/>
  25.  
  26.     <node name="cbpapp05" host="cbpapp05.infra.openreach.co.uk" port="60012"/>
  27.     <node name="cbpapp06" host="cbpapp06.infra.openreach.co.uk" port="60012"/>
  28.  
  29.     <node name="cbrweb01" host="10.24.85.147" port="60012"/>
  30.     <node name="cbrweb02" host="10.24.85.148" port="60012"/>
  31.  
  32.     <node name="cbrweb03" host="cbrweb03.infra.openreach.co.uk" port="60012"/>
  33.     <node name="cbrweb04" host="cbrweb04.infra.openreach.co.uk" port="60012"/>
  34.     <node name="cbrapp04" host="cbrapp04.infra.openreach.co.uk" port="60012"/>
  35.     <node name="cbpapp04" host="cbpapp04.infra.openreach.co.uk" port="60012"/>
  36.     <node name="cbrapp05" host="cbrapp05.infra.openreach.co.uk" port="60012"/>
  37.     <node name="cbrapp06" host="cbrapp06.infra.openreach.co.uk" port="60012"/>
  38.     <node name="plutoapp" host="efsnapp26.empft.openreach.co.uk" port="20014"/>
  39.     <node name="plutoweb" host="efsnapp29.empft.openreach.co.uk" port="60012"/>
  40.     <replicationFarmSet>
  41.         <replicationFarm name="MYFARMNAME">
  42.             <nodeRef useNode="MyLocalHost"/>
  43.         </replicationFarm>
  44.     </replicationFarmSet>
  45. </nodeSet>
  46.  
Nov 13 '08 #1
3 2254
Dormilich
8,658 Expert Mod 8TB
please specify the question. what needs to be converted to what? what means do you use? what do you have accomplished so far?

make sure to wrap code/markup in [code] tags (or use the # button).

regards
Nov 13 '08 #2
I need to convert this segment

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<nodeSet>
<node name="21cnedc23" host="132.146.3.231" port="20014" />
<node name="sjs005a002" host="10.189.33.42" port="60012" />
<node name="sjs005w001" host="10.189.60.6" port="60012" />
<node name="cbu072a013" host="10.24.80.130" port="20014" />
</nodeSet>

to this simlest model

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<nodeSet>
<option value="132.146.3.231" label="132.146.3.231"/>
<option value="10.189.33.42" label="10.189.33.42"/>
</nodeset>

** Java script code / perl module or is there a way of doing this

regards
gayan
Nov 14 '08 #3
Dormilich
8,658 Expert Mod 8TB
once again - please use [code] tags or the # button when posting code.

there are several ways
- do an xsl transformation, any decent server script language should provide methods for that
- use DOM, any decent server script language should provide methods for that. javascript can do that as well.
- use XML methods (of PHP I know you could use SimpleXML, maybe there's something similar in Perl)

regards
Nov 14 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Swarup | last post by:
I am reading a file (txt, xml, gif, ico, bmp etc) byte by byte and filling it into a byte arry. Now i have to convert it into a string to store it in the database. I use...
5
by: bbb | last post by:
Hi, I need to convert XML files from Japanese encoding to UTF-8. I was using the following code: using ( FileStream fs = File.OpenRead(fromFile) ) { int fileSize = (int)fs.Length; int buffer...
3
by: GM | last post by:
Dear all, Could you all give me some guide on how to convert my big5 string to unicode using python? I already knew that I might use cjkcodecs or python 2.4 but I still don't have idea on what...
2
by: Craig | last post by:
Hi there, I'm trying to convert some PNG files to bitmap files which can then be converted to X11 bitmaps using the im.tobitmap() function. But the error I get when using the im.tobitmap()...
10
by: gokul | last post by:
Hi, Before i convert .doc binary format files to .txt files and i added some content to .txt files. Now i again convert back to .doc binary format. Pls Help Me How to Convert .txt files to...
6
by: leonel.gayard | last post by:
Hi, Does anyone know a good python library to convert a RTF file into PDF ? This should be done automaticaly: I have a web page that takes some values and inserts them into a RTF template,...
1
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
2
by: edw | last post by:
I want to convert rfc822 (.eml) files to MAPI (.msg) files. I do not need to log in to Outlook to retrieve the messages, since the messages have all been downloaded from the exchange server and...
3
by: Sun | last post by:
Hi everyone . I have two files named a.txt and b.txt. I open a.txt with ultraeditor.exe. here is the first row of the file: neu für then I switch to the HEX mode: 00000000h: FF FE 6E 00 65...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...

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.