This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

XML Dom Parser Problem tag concatenated ::: distorting element nodes with no element

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys ,

The XML DOM parser is chewing up empty tags .....

What goes in to XML parser :

<TABLE_C>SHR_CPU</TABLE_C>
<IDENTIFICATION_TXT></IDENTIFICATION_TXT>
<UNIT_DESC></UNIT_DESC>


What comes out:

LOGICAL_TABLE_C>SHR_CPU</LOGICAL_TABLE_C>
<IDENTIFICATION_TXT/>
<UNIT_DESC/>


Although generated XML is valid, but still it is reducing the file size by

removing the end tags and combining the empty tags into one tag. For example,

<IDENTIFICATION_TXT></IDENTIFICATION_TXT> modified to <IDENTIFICATION_TXT/> .

This is what I want to prevent exactly

Which is valid as per XML standard but still it appears to the user that XML
Tool is making changes to the without user intervention.

What I want to do is

keep all tags as specified in the original file and not change anything that is not
modified using the DOM Parser. Can anybody suggest APIs or any other solution that can help me for that matter.

Thanks and regards.
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tell me about it!

I can totally see your point about the file size being different.
It sure does throw some "applications" into a crash mode.
When we had one such "application requirement" (pun intended),
we had no choice but to treat an XML file as a binary file, which
prevented the OS from modifying the file size. Our "requirement"
was different from what you mentioned, but just wanted to relate
my experience with what you said re file size.

Back to you point, I would like to push-back really hard on why
the file size change matters so much to the user. I would reiterate
that the content hasn't been modified and that is the important
thing. I would like to question why the user is looking at the file
size on the disk rather than the content inside the XML.

I know this may not help, but thats my very poor two cents on the topic.......

- m
[ November 05, 2004: Message edited by: Madhav Lakkapragada ]
 
Mohan Ganesan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Madhav,

Thanks for the interest shown.

What is the concern for me (and perhaps the enduser too) is that the original XML document is getting changed.

Although again its a valid XML but for the layman enduser we would like to preserve the early status of the tags instead of modyfing the original tags.

Size may mislead the enduser to believe that the file got corrupted or something of that sort. For the same reasons size was brought to notice and nothing else.

Important is that we would like to preserve the status of the XML document.

Thanks and regards....


Originally posted by Madhav Lakkapragada:
Tell me about it!

I can totally see your point about the file size being different.
It sure does throw some "applications" into a crash mode.
When we had one such "application requirement" (pun intended),
we had no choice but to treat an XML file as a binary file, which
prevented the OS from modifying the file size. Our "requirement"
was different from what you mentioned, but just wanted to relate
my experience with what you said re file size.

Back to you point, I would like to push-back really hard on why
the file size change matters so much to the user. I would reiterate
that the content hasn't been modified and that is the important
thing. I would like to question why the user is looking at the file
size on the disk rather than the content inside the XML.

I know this may not help, but thats my very poor two cents on the topic.......

- m

[ November 05, 2004: Message edited by: Madhav Lakkapragada ]

 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Mohan Ganesan:
HI Madhav,

Important is that we would like to preserve the status of the XML document.



As far as I am concerned, the XML document is "preserved", if the only
change in the file is what you just mentioned about the empty elements.
The file size is a misnomer and should be ignored.

What parser implementation are you using ?

- m
 
It will give me the powers of the gods. Not bad for a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!