File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes What is this XML information and how to get it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "What is this XML information and how to get it?" Watch "What is this XML information and how to get it?" New topic

What is this XML information and how to get it?

steve garrison

Joined: Sep 25, 2009
Posts: 1
I'm parsing an XML file with Java but there's something in the XML I can't figure out. Not sure if it's an "attribute" or data or an "element", etc. How would a person fetch the 16 digit id values that are listed - starts with "09"? This XML file is well-formed and valid and created by EMC Documentum system. Using DOM parser.

I can parse and display all other data except for the Attachment ones. I get a NULL value for Attachment, even though there is obviously data there. No errors are thrown. See code displayed below

XML file continued above...

<Attachment1 id_type="object_id"><![CDATA[0984598e800302d6]></Attachment1>
<Attachment1 id_type="object_id"><![CDATA[0984598e800302d9]]></Attachment1>
<Attachment1 id_type="object_id"><![CDATA[0984598e800302dc]]></Attachment1>

....snippet of Java class:
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
Isn't that Element child Node an instance of CDATASection?

seems to me that this test will always fail:

As an obvious XML question this should have been posted in the XML forum.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Yeah, it's just CDATA. I don't really want to read all that DOM-bashing code but if you realize that this:
<Attachment1 id_type="object_id"><![CDATA[0984598e800302dc]]></Attachment1>

is exactly the same as this:
<Attachment1 id_type="object_id">0984598e800302dc</Attachment1>

you should be okay. As long as you understand the DOM, that is.
I agree. Here's the link:
subject: What is this XML information and how to get it?
It's not a secret anymore!