My Oracle Support Banner

How to Update an Attribute Inside an XML Tag from an XML Document (Doc ID 2445174.1)

Last updated on APRIL 17, 2023

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.4 and later
Information in this document applies to any platform.

Goal

How to correct a recurring issue of an attribute being NULL / or not present. Consider the following sample document:
==========
<?xml version="1.0" encoding="WINDOWS-1252"?>
<pcc pcc-type="" xmlns="urn:oma:xml:cab:pcc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <person-details index="gt4fd890bu8">
   <name index="fg4fd890der">
     <name-entry index="dslkhdskj" pref="1" xml:lang="en" name-type="LegalName">
        <middle display-order="1">T.</middle>    
       </name-entry>
     <name-entry index="riuetutl" pref="2" xml:lang="en" name-type="KnownAs">
       <given display-order="1">Balaji</given>
       </name-entry>
   </name>
 </person-details>
</pcc>
=============


Case 1. <pcc pcc-type="" >;update to individual
whenever the  pcc-type is null/empty , it should update it to identifier as "individual".

Case 2. pcc-type itself is missing:-

  Whenever the pcc-type is missing like below:
a)<pcc xmlns="urn:oma:xml:cab:pcc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  pcc-type=individual should be added in tag like below:-
b)<pcc pcc-type="individual"  xmlns="urn:oma:xml:cab:pcc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.