Results 1 to 2 of 2
Thread: Socket XML Parser
- 02-04-2010, 03:22 AM #1
Socket XML Parser
Hi,
I need to be able to parse XML recieved from a socket. Every socket.readLine makes a complete XML (document?) (A sample is provided below).
All the XML parsers I've found so far seem to be for reading XML files with close document tags etc.
Im new to java and XML so if you could explain it simply for me, Id much appreciate it. Failing that, could you point me in the direction of a decent tutorial for beginners, all the ones i've googled have gone straight over my head :$
Thanks in advance!
<ns0:DBGMMessage xmlns:ns1="DbGMLCashflowCollection/Party" SchemaVersion="1.0">
<BusinessHdr><ns4:BusObjectType xmlns:ns4="DbGMLCashflowCollection/BusHdr">CASHF
LOWCOLLECTION/VALUETODAY</ns4:BusObjectType><ns4:BusObjectId xmlns:ns4="DbGMLCas
hflowCollection/BusHdr">20091224ET041299</ns4:BusObjectId><ns4:BusEventTimeStamp
xmlns:ns4="DbGMLCashflowCollection/BusHdr">2009-04-20T00:24:06.038+01:00</ns4:B
usEventTimeStamp><ns4:SchemaVersion xmlns:ns4="DbGMLCashflowCollection/BusHdr">1
.0</ns4:SchemaVersion></BusinessHdr><CashflowCollection><CashflowCollectio nId>ET
041299/2009-06-22/JPY</CashflowCollectionId><CashflowCollectionVersion>1</Cashfl
owCollectionVersion><Parties><LegalEntity>ENTITY</LegalEntity><BusinessGroup>OTC
_TOK</BusinessGroup><GsdId>GREENSECUTOK</GsdId></Parties><Cashflow><CashflowId>7
</CashflowId><CashflowVersion>1</CashflowVersion><ValueDate>2</ValueDate><Notion
al><Currency>KRW</Currency><Amount>5650000</Amount></Notional><Amount><Currency>
KRW</Currency><Amount>-1441000</Amount></Amount><CashflowType>COUPON</CashflowTy
pe><FeeType>OTHER</FeeType><RateIndex><IndexName>LIBOR</IndexName><IndexTenor>A3
60</IndexTenor></RateIndex><StreamId>0</StreamId><RefixDate>2008-12-18Z</RefixDa
te><RefixRate>1.0425</RefixRate></Cashflow><Cashflow><CashflowId>7</CashflowId><
CashflowVersion>1</CashflowVersion><ValueDate>2</ValueDate><Notional><Currency>K
RW</Currency><Amount>5650000</Amount></Notional><Amount><Currency>KRW</Currency>
<Amount>1249000</Amount></Amount><CashflowType>COUPON</CashflowType><FeeType>OTH
ER</FeeType><RateIndex><IndexName>FIXED</IndexName><IndexTenor>A360</IndexTenor>
</RateIndex><StreamId>0</StreamId><RefixDate>2008-12-18Z</RefixDate><RefixRate>1
.04</RefixRate></Cashflow><Context><BusinessObjId>T182478L</BusinessObjId><Produ
ct><ProductGroup>SWAP</ProductGroup><ProductType>SWAP</ProductType><Features>VAN
ILLA</Features></Product><BookId>YAG_SWAPS</BookId><TradeDate>2004-06-18</TradeD
ate><MaturityDate>2024-06-24</MaturityDate><EffectiveDate>2009-12-24</EffectiveD
ate><TradeId>ET041299</TradeId></Context></CashflowCollection></ns0:DBGMMessage>
- 02-04-2010, 09:04 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,479
- Rep Power
- 16
Just a quick format of that:
Have a look at w3schools for a tutorial on XML. But that there is valid XML, except I would ask what ns0 is, and why ns1 is declared but not used?Java Code:<ns0:DBGMMessage xmlns:ns1="DbGMLCashflowCollection/Party" SchemaVersion="1.0"> <BusinessHdr> <ns4:BusObjectType xmlns:ns4="DbGMLCashflowCollection/BusHdr">CASHFLOWCOLLECTION/VALUETODAY</ns4:BusObjectType> <ns4:BusObjectId xmlns:ns4="DbGMLCashflowCollection/BusHdr">20091224ET041299</ns4:BusObjectId> <ns4:BusEventTimeStamp xmlns:ns4="DbGMLCashflowCollection/BusHdr">2009-04-20T00:24:06.038+01:00</ns4:BusEventTimeStamp> <ns4:SchemaVersion xmlns:ns4="DbGMLCashflowCollection/BusHdr">1.0</ns4:SchemaVersion> </BusinessHdr> <CashflowCollection> <CashflowCollectionId>ET041299/2009-06-22/JPY</CashflowCollectionId> <CashflowCollectionVersion>1</CashflowCollectionVersion> <Parties> <LegalEntity>ENTITY</LegalEntity> <BusinessGroup>OTC_TOK</BusinessGroup> <GsdId>GREENSECUTOK</GsdId> </Parties> <Cashflow> <CashflowId>7</CashflowId> <CashflowVersion>1</CashflowVersion> <ValueDate>2</ValueDate> <Notional> <Currency>KRW</Currency> <Amount>5650000</Amount> </Notional> <Amount> <Currency>KRW</Currency> <Amount>-1441000</Amount> </Amount> <CashflowType>COUPON</CashflowType> <FeeType>OTHER</FeeType> <RateIndex> <IndexName>LIBOR</IndexName> <IndexTenor>A360</IndexTenor> </RateIndex> <StreamId>0</StreamId> <RefixDate>2008-12-18Z</RefixDate> <RefixRate>1.0425</RefixRate> </Cashflow> <Cashflow> <CashflowId>7</CashflowId> <CashflowVersion>1</CashflowVersion> <ValueDate>2</ValueDate> <Notional> <Currency>KRW</Currency> <Amount>5650000</Amount> </Notional> <Amount> <Currency>KRW</Currency> <Amount>1249000</Amount> </Amount> <CashflowType>COUPON</CashflowType> <FeeType>OTHER</FeeType> <RateIndex> <IndexName>FIXED</IndexName> <IndexTenor>A360</IndexTenor> </RateIndex> <StreamId>0</StreamId> <RefixDate>2008-12-18Z</RefixDate> <RefixRate>1.04</RefixRate> </Cashflow> <Context> <BusinessObjId>T182478L</BusinessObjId> <Product> <ProductGroup>SWAP</ProductGroup> <ProductType>SWAP</ProductType> <Features>VANILLA</Features> </Product> <BookId>YAG_SWAPS</BookId> <TradeDate>2004-06-18</TradeDate> <MaturityDate>2024-06-24</MaturityDate> <EffectiveDate>2009-12-24</EffectiveDate> <TradeId>ET041299</TradeId> </Context> </CashflowCollection> </ns0:DBGMMessage>
Similar Threads
-
append response to the request from Socket and write to another socket
By vaibhav_singh_vs@yahoo.co in forum NetworkingReplies: 3Last Post: 04-17-2009, 07:02 PM -
Parser API
By sruti_mohan in forum Advanced JavaReplies: 0Last Post: 06-09-2008, 07:23 AM -
JSP Parser????
By chathu03j in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 04-10-2008, 12:08 PM -
DNS name parser 1.2.1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 07-14-2007, 08:21 PM -
Parser
By Peter in forum Advanced JavaReplies: 2Last Post: 07-04-2007, 07:08 AM


LinkBack URL
About LinkBacks

Bookmarks