H
homi
Hi All,
I am writing a Java code that uses a XML Config file to configure
itself. Sample of the XML file has shown below. I want to have a peace
of java code to reads that config file and import all the data to a
class structure that I have designed before. In this case I will have
a class name AppGroup and the whole config file will be stored in
array of AppGroup objects. What is the best was of doing such a thing.
I’ve already looked at Castor but seem to complicate to me.
Thanks in advance for your help.
<?xml version="1.0"?>
<FConfig>
<ExtraConf>
<Name>TEST</Name>
<Timeout>100</Timeout>
</ExtraConf>
<AppGroup>
<Other>
<AppName>BILL5</AppName>
<FileSequenceIn>aaabbb</FileSequenceIn>
<TransferAlarm>transAlarmCall</TransferAlarm>
</Other>
<TransConf>
<Direction>INPUT</Direction>
<SourceDir>/client/home/ttt</SourceDir>
<FilePattern>aaavvv</FilePattern>
<TargetDir>/home/rrr</TargetDir>
<StateFile>auditState</StateFile>
</TransConf>
<TransConf>
<Direction>OUTPUT</Direction>
<SourceDir>/client/home/ggg</SourceDir>
<FilePattern>aaaeee</FilePattern>
<TargetDir>/home/yyy</TargetDir>
<StateFile>auditState2</StateFile>
</TransConf>
</AppGroup>
<AppGroup>
………………………..
</AppGroup>
Thanks,
Homer
I am writing a Java code that uses a XML Config file to configure
itself. Sample of the XML file has shown below. I want to have a peace
of java code to reads that config file and import all the data to a
class structure that I have designed before. In this case I will have
a class name AppGroup and the whole config file will be stored in
array of AppGroup objects. What is the best was of doing such a thing.
I’ve already looked at Castor but seem to complicate to me.
Thanks in advance for your help.
<?xml version="1.0"?>
<FConfig>
<ExtraConf>
<Name>TEST</Name>
<Timeout>100</Timeout>
</ExtraConf>
<AppGroup>
<Other>
<AppName>BILL5</AppName>
<FileSequenceIn>aaabbb</FileSequenceIn>
<TransferAlarm>transAlarmCall</TransferAlarm>
</Other>
<TransConf>
<Direction>INPUT</Direction>
<SourceDir>/client/home/ttt</SourceDir>
<FilePattern>aaavvv</FilePattern>
<TargetDir>/home/rrr</TargetDir>
<StateFile>auditState</StateFile>
</TransConf>
<TransConf>
<Direction>OUTPUT</Direction>
<SourceDir>/client/home/ggg</SourceDir>
<FilePattern>aaaeee</FilePattern>
<TargetDir>/home/yyy</TargetDir>
<StateFile>auditState2</StateFile>
</TransConf>
</AppGroup>
<AppGroup>
………………………..
</AppGroup>
Thanks,
Homer