parsing the XML file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gdczinan
    New Member
    • Apr 2009
    • 4

    parsing the XML file

    Hi, All:

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

    I have the sample xml to read.

    Code:
    <lr:LogRecordBody>
         <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>
                       <dcml:Name>SignerID</dcml:Name>
                   <dcml:Value xsi:type="ds:DigestValueType">BYWKLV0P9zwzo52Mw0ieHlj/9k8=</dcml:Value>
                 </dcml:Parameter>
            </lr:Parameters>
    </lr:LogRecordBody>

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

    Code:
    <lr:LogRecordBody [I]xmlns:lr="funny">[/I]
            <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"><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>
                           <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>
    what attribute to set for the XercesDOMParser so that the namespace is not automatically append while parsing?
    Last edited by Dormilich; Apr 8 '09, 09:14 AM. Reason: added [code] tags
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    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?

    Comment

    • gdczinan
      New Member
      • Apr 2009
      • 4

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

      Comment

      Working...