Connecting Tech Pros Worldwide Help | Site Map

parsing the XML file

Newbie
 
Join Date: Apr 2009
Posts: 4
#1: Apr 8 '09
Hi, All:

I am quite new to the XML and have the following problem:

I have the sample xml to read.

Expand|Select|Wrap|Line Numbers
  1. <lr:LogRecordBody>
  2.      <lr:EventID>9</lr:EventID>
  3.       <lr:EventSubType scope="http://www.smpte-ra.org/430-5/2007/SecurityLog/#EventTypes">CPLCheck</lr:EventSubType>          
  4.       <lr:contentId>urn:uuid:4c4d6f56-6734-4f37-94a5-fb93cce15128</lr:contentId>
  5.        <lr:Parameters>
  6.              <dcml:Parameter>
  7.                    <dcml:Name>SignerID</dcml:Name>
  8.                <dcml:Value xsi:type="ds:DigestValueType">BYWKLV0P9zwzo52Mw0ieHlj/9k8=</dcml:Value>
  9.              </dcml:Parameter>
  10.         </lr:Parameters>
  11. </lr:LogRecordBody>

when the program read back the above log, it has the name space associated with it

Expand|Select|Wrap|Line Numbers
  1. <lr:LogRecordBody xmlns:lr="funny">
  2.         <lr:EventID>9</lr:EventID>
  3.         <lr:EventSubType scope="http://www.smpte-ra.org/430-5/2007/SecurityLog/#EventTypes">CPLCheck</lr:EventSubType><lr:contentId>urn:uuid:4c4d6f56-6734-4f37-94a5-fb93cce15128</lr:contentId>
  4.          <lr:Parameters>
  5.                  <dcml:Parameter xmlns:dcml="http://www.smpte-ra.org/schemas/433/2008/dcmlTypes"><lr:LogRecordBody xmlns:lr="funny"><lr:EventID>9</lr:EventID><lr:EventSubType scope="http://www.smpte-ra.org/430-5/2007/SecurityLog/#EventTypes">CPLCheck</lr:EventSubType><lr:contentId>urn:uuid:4c4d6f56-6734-4f37-94a5-fb93cce15128</lr:contentId><lr:Parameters><dcml:Parameter xmlns:dcml="http://www.smpte-ra.org/schemas/433/2008/dcmlTypes"><dcml:Name>SignerID</dcml:Name><dcml:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ds:DigestValueType">BYWKLV0P9zwzo52Mw0ieHlj/9k8=</dcml:Value></dcml:Parameter></lr:Parameters></lr:LogRecordBody>
  6.                        <dcml:Name>SignerID</dcml:Name>
  7.                         <dcml:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ds:DigestValueType">BYWKLV0P9zwzo52Mw0ieHlj/9k8=</dcml:Value>
  8.                 </dcml:Parameter>
  9.               </lr:Parameters>
  10.           </lr:LogRecordBody>
what attribute to set for the XercesDOMParser so that the namespace is not automatically append while parsing?
Moderator
 
Join Date: Mar 2006
Posts: 1,103
#2: Apr 8 '09

re: parsing the XML file


I don't think it works like that.

Can you change either:
1. Your input data to not have this namespace, or
2. The code that handles this output?

Further,
3. is there any reason you're using a DOM Parser to get this xml info?
4. Do you want to remove all namespaces (including dmcl), or just the main one?
Newbie
 
Join Date: Apr 2009
Posts: 4
#3: Apr 9 '09

re: parsing the XML file


I have to use the namespace...now checking the Xerces source code to see what happens
Reply