This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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
Author

What is this XML information and how to get it?

steve garrison
Greenhorn

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...

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


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

Joined: Mar 22, 2000
Posts: 12792
    
    5
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.

Bill
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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.
 
GeeCON Prague 2014
 
subject: What is this XML information and how to get it?