• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Related String

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one xml file, this is a data file. The file content below:

<PSCDR><sgsnMM>1</sgsnMM><sgsnMM>2</sgsnMM><sgsnMM>3</sgsnMM><sgsnMM>4</sgsnMM><sgsnMM>5</sgsnMM><sgsnMM>6</sgsnMM></PSCDR>


I would like distribute about this:

<PSCDR><sgsnMM>1</sgsnMM><sgsnMM>2</sgsnMM></PSCDR> <-------xxx001.xml
<PSCDR><sgsnMM>3</sgsnMM><sgsnMM>4</sgsnMM></PSCDR> <-------xxx002.xml
.. ..
.. ..

Please help me to do condition.!!!
I need for help
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
what is the technology you are using to parse this xml file?
If you give us a hint of that then it will help posting an appropriate reply.
 
Hugo Leung
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry i have forgot to attach my incomplete file.

/**************************

import java.io.*;
import java.util.*;
public class GenXML
{
public static void main(String args[]) throws IOException
{
String path = "";
String export ="";
File xmlLoc= new File("Config.xml");
FileOutputStream xmlOs = null;
FileInputStream xmlIn = null;
Properties prop = new Properties() ;
try
{
if(!xmlLoc.exists())
{
xmlOs = new FileOutputStream(xmlLoc);

prop.put("Path","C:\\Export\\data.ini");
prop.put("Export","C:\\Export");
prop.storeToXML(xmlOs,"Config","UTF-8");
xmlOs.close();
}
//Load from XML
xmlIn = new FileInputStream(xmlLoc);
prop.loadFromXML(xmlIn);
path= prop.getProperty("Path");
export = prop.getProperty("Export");
xmlIn.close();
}
catch(Exception e)
{
System.out.println("\nAccess Client Config File \" clientConfig.xml \"Error , Please Check Access Right or Have enought space\n");
e.printStackTrace();
}

String location = path;
File inFile = new File(location);
FileInputStream in = null;
try
{
in= new FileInputStream(inFile);
}catch (IOException IOex)
{
IOex.printStackTrace();
System.out.println("Access File Error");
}
BufferedReader din = new BufferedReader(new InputStreamReader(in));
String temp = din.readLine();
String name = "";
....
....
....
....
}}

/************
I only do that ,please help me to see. Thank you for your help
 
Hugo Leung
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The xml data is about this:
<PSCDR><sgsnMM><recordType>20</recordType><servedIMSI>454195000044897</servedIMSI><servedIMEI>3594440000795800</servedIMEI><sgsnAddress><iPBinV4Address>CA04C60E</iPBinV4Address></sgsnAddress><msNetworkCapability>E540</msNetworkCapability><routingArea>40</routingArea><locationAreaCode>4000</locationAreaCode><cellIdentifier>8E1E</cellIdentifier><recordOpeningTime>2007012922 4
529+0800</recordOpeningTime><duration>900</duration><causeForRecClosing>17</causeForRecClosing><recordSequenceNumber>10</reco
rdSequenceNumber><nodeID>invalid value</nodeID><localSequenceNumber>468008905</localSequenceNumber><servedMSISDN>85266236067<
/servedMSISDN><chargingCharacteristics>0800</chargingCharacteristics><systemType>1</systemType><chChSelectionMode>3</chChSele
ctionMode></sgsnMM><sgsnMM><recordType>20</recordType><servedIMSI>454195000034631</servedIMSI><servedIMEI>3563870003639300</s
ervedIMEI><sgsnAddress><iPBinV4Address>CA04C60E</iPBinV4Address></sgsnAddress><msNetworkCapability>E540</msNetworkCapability>
<routingArea>40</routingArea><locationAreaCode>4000</locationAreaCode><cellIdentifier>D495</cellIdentifier><recordOpeningTime
>20070129224529+0800</recordOpeningTime><duration>900</duration><causeForRecClosing>17</causeForRecClosing><recordSequenceNum
ber>12</recordSequenceNumber><nodeID>invalid value</nodeID><localSequenceNumber>468008906</localSequenceNumber><servedMSISDN>
85292823114</servedMSISDN><chargingCharacteristics>0800</chargingCharacteristics><systemType>1</systemType><chChSelectionMode
>3</chChSelectionMode></sgsnMM><sgsnMM><recordType>20</recordType><servedIMSI>454195020057629</servedIMSI><servedIMEI>3517080
111172508</servedIMEI><sgsnAddress><iPBinV4Address>CA04C60E</iPBinV4Address></sgsnAddress><msNetworkCapability>F5C0</msNetwor
kCapability><routingArea>40</routingArea><locationAreaCode>4000</locationAreaCode><cellIdentifier>8CC9</cellIdentifier><recor
dOpeningTime>20070129224528+0800</recordOpeningTime><duration>900</duration><causeForRecClosing>17</causeForRecClosing><recor
dSequenceNumber>7</recordSequenceNumber><nodeID>invalid value</nodeID><localSequenceNumber>468008907</localSequenceNumber><se
rvedMSISDN>85295326568</servedMSISDN><chargingCharacteristics>0800</chargingCharacteristics><systemType>1</systemType><chChSe
lectionMode>3</chChSelectionMode></sgsnMM><sgsnMM><recordType>20</recordType><servedIMSI>454195000022508</servedIMSI><servedI
MEI>3594440000956300</servedIMEI><sgsnAddress><iPBinV4Address>CA04C60E</iPBinV4Address></sgsnAddress><msNetworkCapability>E54
0</msNetworkCapability><routingArea>40</routingArea><locationAreaCode>4000</locationAreaCode><cellIdentifier>CB99</cellIdenti
fier><recordOpeningTime>20070129224531+0800</recordOpeningTime><duration>900</duration><causeForRecClosing>17</causeForRecClo
sing><recordSequenceNumber>61</recordSequenceNumber><nodeID>invalid value</nodeID><localSequenceNumber>468008908</localSequen
ceNumber><servedMSISDN>85266217029</servedMSISDN><chargingCharacteristics>0800</chargingCharacteristics><systemType>1</system
Type><chChSelectionMode>3</chChSelectionMode></sgsnMM><sgsnMM><recordType>20</recordType><servedIMSI>454195012011713</servedI
MSI><servedIMEI>3594440001077300</servedIMEI><sgsnAddress><iPBinV4Address>CA04C60E</iPBinV4Address></sgsnAddress><msNetworkCa
pability>E540</msNetworkCapability><routingArea>90</routingArea><locationAreaCode>9000</locationAreaCode><cellIdentifier>DAD6
</cellIdentifier><recordOpeningTime>20070129224529+0800</recordOpeningTime><duration>900</duration><causeForRecClosing>17</ca
useForRecClosing><recordSequenceNumber>7</recordSequenceNumber><nodeID>invalid value</nodeID><localSequenceNumber>468008909</
localSequenceNumber><servedMSISDN>85266236216</servedMSISDN><chargingCharacteristics>0800</chargingCharacteristics><systemTyp
e>1</systemType><chChSelectionMode>3</chChSelectionMode></sgsnMM><sgsnMM><recordType>20</recordType><servedIMSI>4541950200899
91</servedIMSI><servedIMEI>3563850009314010</servedIMEI><sgsnAddress><iPBinV4Address>CA04C60E</iPBinV4Address></sgsnAddress><
msNetworkCapability>E540</msNetworkCapability><routingArea>40</routingArea><locationAreaCode>4000</locationAreaCode><cellIden
tifier>4F3A</cellIdentifier><recordOpeningTime>20070129224532+0800</recordOpeningTime><duration>900</duration><causeForRecClo
sing>17</causeForRecClosing><recordSequenceNumber>65</recordSequenceNumber><nodeID>invalid value</nodeID><localSequenceNumber
>468008910</localSequenceNumber><servedMSISDN>85263898488</servedMSISDN><chargingCharacteristics>0800</chargingCharacteristic
s><systemType>1</systemType><chChSelectionMode>3</chChSelectionMode></sgsnMM><sgsnMM><recordType>20</recordType><servedIMSI>4
54195020137511</servedIMSI><servedIMEI>3517100119418102</servedIMEI><sgsnAddress><iPBinV4Address>CA04C60E</iPBinV4Address></s
gsnAddress><msNetworkCapability>F5C0</msNetworkCapability><routingArea>90</routingArea><locationAreaCode>9000</locationAreaCo
de><cellIdentifier>9C60</cellIdentifier><recordOpeningTime>20070129224530+0800</recordOpeningTime><duration>900</duration><ca
useForRecClosing>17</causeForRecClosing><recordSequenceNumber>59</recordSequenceNumber><nodeID>invalid value</nodeID><localSe
quenceNumber>468008911</localSequenceNumber><servedMSISDN>85291208218</servedMSISDN><chargingCharacteristics>0800</chargingCh
aracteristics><systemType>1</systemType><chChSelectionMode>3</chChSelectionMode></sgsnMM><sgsnMM><recordType>20</recordType><
servedIMSI>454195020101733</servedIMSI><servedIMEI>3563850009793210</servedIMEI><sgsnAddress><iPBinV4Address>CA04C60E</iPBinV
4Address></sgsnAddress><msNetworkCapability>E540</msNetworkCapability><routingArea>40</routingArea><locationAreaCode>4000</lo
cationAreaCode><cellIdentifier>D48C</cellIdentifier><recordOpeningTime>20070129224531+0800</recordOpeningTime><duration>900</
duration><causeForRecClosing>17</causeForRecClosing><recordSequenceNumber>4</recordSequenceNumber><nodeID>invalid value</node
ID><localSequenceNumber>468008912</localSequenceNumber><servedMSISDN>85263869249</servedMSISDN><chargingCharacteristics>0800<
/chargingCharacteristics><systemType>1</systemType><chChSelectionMode>3</chChSelectionMode></sgsnMM></PSCDR>
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think its a good idea to take an open source xml parser and use it to parse the xml. You can download one from:
http://xerces.apache.org/xerces-j/
If you try to parse that on your own you will be dead.
That site also has some basic usage examples.
Hope this helps.
 
Hugo Leung
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Nitesh Kant,

Firstly, Thank you for your reference link, but i think this is too difficult to understand.... Because i am just a beginner....
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are trying to do is parsing an xml file. By parsing i mean that you run through the xml file peeping into elements and then making a decision based on the type of element you encounter.
Now, if you try to do this on your own, you will be re-inventing the wheel as you are not the first person to do the same. For that we have readily available open source parsers. One of those is a xerces parser by apache. This parser implements dom and sax specifications of xml parsing.
Its difficult to explain all this on a post, so i would suggest that you first understand the area of xml parsing before launching in to do what you want to.
 
Hugo Leung
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I SEE

I am hard working now ,

Now i wanna to ask set the path problem

this is for window:
String location = "dump.xml";

for unix:
String location = "???";
 
What a show! What atmosphere! What fun! What a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic