Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

choosing a high performance DOM parser for large xml files

843834Nov 20 2003 — edited Nov 21 2003
Hi All,

I have below xml file. From this xml, I need extract all <Task> elements and insert them as records into database tables. I already written code using sun JDK1.4 DOM parser (org.w3c.dom) but for large xml file of 17MB or more, I am getting java.lang.OutOfMemoryError error and so I want to know if there is any parser available that has features provided by DOM (org.w3c.dom) but eliminate the memory problems that sun DOM parser cause. I do not want to use SAX as it doesnt provide rich features unlike DOM like navigating the children of a parent etc. etc. and if I use SAX parser then I need to write lots of own logic for capturing the all the <Tasks> children which can be a nightmare work. Please help me.

<?xml version="1.0"?>
<Project>
	<Name>TestMe100Name</Name>
	<Title>TestMe100Title</Title>
	<OutlineCodes/>
	<WBSMasks/>
	<ExtendedAttributes/>
	<Tasks>
		<Task>
			<UID>0</UID>
			<ID>0</ID>
			<Name>Project1</Name>
			<Type>1</Type>
			<IsNull>0</IsNull>
			<CreateDate>2003-06-13T15:01:00</CreateDate>
			<WBS>0</WBS>
		</Task>
		<Task>
			<UID>1</UID>
			<ID>1</ID>
			<Name>Train team in MS Project 2002</Name>
			<Type>1</Type>
			<IsNull>0</IsNull>
		</Task>
		<Task>
			<UID>2</UID>
			<ID>2</ID>
			<Name>Install Project on demo machine</Name>
			<Type>0</Type>
			<IsNull>0</IsNull>
			<CreateDate>2003-06-13T15:03:00</CreateDate>
		</Task>
		<Task>
			<UID>3</UID>
			<ID>3</ID>
			<Name>Make setups</Name>
			<Type>0</Type>
			<IsNull>0</IsNull>
			<CreateDate>2003-06-13T15:03:00</CreateDate>
			<TimephasedData>
				<Type>11</Type>
				<UID>3</UID>
				<Start>2003-06-13T08:00:00</Start>
				<Finish>2003-06-13T12:00:00</Finish>
				<Unit>2</Unit>
				<Value>50</Value>
			</TimephasedData>
		</Task>
		<Task>
			<UID>6</UID>
			<ID>6</ID>
			<Name>Perform demo</Name>
			<Type>0</Type>
			<IsNull>0</IsNull>
			<CreateDate>2003-06-13T15:03:00</CreateDate>
			<PredecessorLink>
				<PredecessorUID>4</PredecessorUID>
				<Type>1</Type>
				<CrossProject>0</CrossProject>
				<LinkLag>1200</LinkLag>
				<LagFormat>5</LagFormat>
			</PredecessorLink>
		</Task>
	</Tasks>
	<Resources>
		<Resource>
			<UID>0</UID>
			<ID>0</ID>
			<Type>1</Type>
			<IsNull>0</IsNull>
			<WorkGroup>0</WorkGroup>
			<MaxUnits>1</MaxUnits>
		</Resource>
		<Resource>
			<UID>1</UID>
			<ID>1</ID>
			<Name>Varma</Name>
			<Type>1</Type>
			<IsNull>0</IsNull>
			<Initials>V</Initials>
			<WorkGroup>0</WorkGroup>
			<MaxUnits>1</MaxUnits>
		</Resource>
	</Resources>
	<Assignments>
		<Assignment>
			<UID>2</UID>
			<TaskUID>2</TaskUID>
			<ResourceUID>1</ResourceUID>
			<PercentWorkComplete>0</PercentWorkComplete>
			<ActualCost>0</ActualCost>
			<TimephasedData>
				<Type>1</Type>
				<UID>2</UID>
				<Start>2003-06-13T08:00:00</Start>
				<Finish>2003-06-13T17:00:00</Finish>
				<Unit>2</Unit>
				<Value>PT8H0M0S</Value>
			</TimephasedData>
		</Assignment>
		<Assignment>
			<UID>3</UID>
			<TaskUID>3</TaskUID>
			<ResourceUID>-65535</ResourceUID>
			<PercentWorkComplete>50</PercentWorkComplete>
			<ActualCost>0</ActualCost>
			<TimephasedData>
				<Type>1</Type>
				<UID>3</UID>
				<Start>2003-06-13T13:00:00</Start>
				<Finish>2003-06-13T17:00:00</Finish>
				<Unit>2</Unit>
				<Value>PT4H0M0S</Value>
			</TimephasedData>
			<TimephasedData>
				<Type>2</Type>
				<UID>3</UID>
				<Start>2003-06-13T08:00:00</Start>
				<Finish>2003-06-13T12:00:00</Finish>
				<Unit>2</Unit>
				<Value>PT4H0M0S</Value>
			</TimephasedData>
		</Assignment>
	</Assignments>
</Project>
Regards,
Kumar.



Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2003
Added on Nov 20 2003
5 comments
495 views