cancel
Showing results for 
Search instead for 
Did you mean: 

How to write XML Parser??

Former Member
0 Kudos

Hi all,

i have an XML file and its structure is like this and i have to write a parser to get the details from this XML and put it in the nodes.

Please help me out in the procedure and code


<?xml version="1.0" encoding="UTF-8" ?> 
- <GAEB xmlns="http://xxxxxxx_XML/200407">
- <GAEBInfo>
  <Version>3.1</Version> 
  <VersDate>2007-06</VersDate> 
  <Date>2009-02-15</Date> 
  <Time>15:11:12</Time> 
  <ProgSystem /> 
  <ProgName>CONSTRUCTION_SUITE V12.4.342</ProgName> 
  </GAEBInfo>
- <PrjInfo>
  <NamePrj>SAP2</NamePrj> 
  <LblPrj>The Pad on Plot No.BB.B01.061 at Business Bay</LblPrj> 
  <Cur>ser</Cur> 
  <CurLbl>trt</CurLbl> 
  <AlterBidPerm>Yes</AlterBidPerm> 
  </PrjInfo>
- <Award>
  <DP>81</DP> 
- <AwardInfo>
  <Cur>ser</Cur> 
  <CurLbl>trt</CurLbl> 
  </AwardInfo>
- <OWN>
  <Address /> 
  </OWN>
- <BoQ ID="DAODAAAA">
- <BoQInfo>
  <Name>02</Name> 
  <LblBoQ>Bill NO.2 - Site Work</LblBoQ> 
  <Date>2008-07-02</Date> 
  <OutlCompl>AllTxt</OutlCompl> 
- <BoQBkdn>
  <Type>BoQLevel</Type> 
  <LblBoQBkdn>Division</LblBoQBkdn> 
  <Length>2</Length> 
  <Num>Yes</Num> 
  </BoQBkdn>
- <BoQBkdn>
  <Type>Item</Type> 
  <Length>1</Length> 
  <Num>No</Num> 
  <Alignment>left</Alignment> 
  </BoQBkdn>
- <BoQBkdn>
  <Type>Index</Type> 
  <Length>1</Length> 
  <Num>No</Num> 
  <Alignment>left</Alignment> 
  </BoQBkdn>
  </BoQInfo>
- <BoQBody>
- <BoQCtgy ID="DBAHAAAA" RNoPart="1">
- <LblTx>
- <p>
  <span>Page No.2/1</span> 
  </p>
  </LblTx>
- <BoQBody>
- <Itemlist>
- <Remark ID="DBAHADGA">
- <Description>
- <CompleteText>
- <DetailTxt>
- <Text>
- <p style="text-align:left;">
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">SITE WORKS</span> 
  <br /> 
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">EARTH WORKS</span> 
  <br /> 
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">Excavate in any material from reduced level (-7.6</span> 
  <br /> 
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">DMD) including levelling and compacting the bottom</span> 
  <br /> 
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">of excavation as specified in stages as necessary</span> 
  </p>
  </Text>
  </DetailTxt>
- <OutlineText>
- <OutlTxt>
- <TextOutlTxt>
- <p>
  <span>SITE WORKS</span> 
  <br /> 
  <span>EARTH WORKS</span> 
  <br /> 
  <span>Excavate in any material from reduced level (-7.6</span> 
  <br /> 
  <span>DMD) including levelling and compacting the bottom</span> 
  <br /> 
  <span>of excavation as specified in stages as necessary</span> 
  </p>
  </TextOutlTxt>
  </OutlTxt>
  </OutlineText>
  </CompleteText>
  </Description>
  </Remark>
- <Item ID="DBAHAEOA" RNoPart="A">
  <Qty>8738.000</Qty> 
  <pre><code>8738.000</code></pre> 
  <QU>m3</QU> 
- <Description>
- <CompleteText>
- <DetailTxt>
- <Text>
- <p style="text-align:left;">
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">Excavation to raft foundation</span> 
  </p>
  </Text>
  </DetailTxt>
- <OutlineText>
- <OutlTxt>
- <TextOutlTxt>
- <p>
  <span>Excavation to raft foundation</span> 
  </p>
  </TextOutlTxt>
  </OutlTxt>
  </OutlineText>
  </CompleteText>
  </Description>
  </Item>
- <Remark ID="DBAHAHJI">
- <Description>
- <CompleteText>
- <DetailTxt>
- <Text>
- <p style="text-align:left;">
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">Disposal</span> 
  </p>
  </Text>
  </DetailTxt>
- <OutlineText>
- <OutlTxt>
- <TextOutlTxt>
- <p>
  <span>Disposal</span> 
  </p>
  </TextOutlTxt>
  </OutlTxt>
  </OutlineText>
  </CompleteText>
  </Description>
  </Remark>
- <Item ID="DBAHAJBI" RNoPart="B">
  <Qty>8738.000</Qty> 
  <pre><code>8738.000</code></pre> 
  <QU>m3</QU> 
- <Description>
- <CompleteText>
- <DetailTxt>
- <Text>
- <p style="text-align:left;">
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">Disposal of excavated materials, away from site to</span> 
  <br /> 
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">approved tips as directed by the Engineer</span> 
  </p>
  </Text>
  </DetailTxt>
- <OutlineText>
- <OutlTxt>
- <TextOutlTxt>
- <p>
  <span>Disposal of excavated materials, away from site to</span> 
  <br /> 
  <span>approved tips as directed by the Engineer</span> 
  </p>
  </TextOutlTxt>
  </OutlTxt>
  </OutlineText>
  </CompleteText>
  </Description>
  </Item>
    </Itemlist>
  </BoQBody>
  </BoQCtgy>
  </BoQBody>
  </BoQ>
  </Award>
  </GAEB>

Thanks,

Suresh

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Good example

[http://developerlife.com/tutorials/?p=25|http://developerlife.com/tutorials/?p=25]

Good luck

Former Member
0 Kudos

Hi,

Following are some of them DOM,SAX ...

http://www.devx.com/xml/Article/16921

Regards

Ayyapparaj