Append or remove optional element

Hi!
I have a schema based XMLType table, which has a optional element.
How could I append(or remove) an optional element to(from) a xml instance in the XMLType table?.
I need a help !!!
Thanks.

I have the same problem!My version is 9.2.0.1.I also have searched the whole xml db forum but with no satisfied answer. Hope you can help!

Similar Messages

  • Map optional elements to attributes

    Hi,
    I am mapping 5 optional elements to a element which has 2 attributes.  I simplified my map to only check 1 optional element and then my map looks like below:
    So I check if the element PruchseOrderNumber which is optional exists in the source. If that's true I use 3 value mappings to write the destination fields userfield, id and datatype.
    But when I test the map I get a lot of Output validation errors. They are:
    Output validation error: The required attribute 'id' is missing
    Output validation error: The required attribute 'datatype' is missing
    The output XML looks like below:
    The first instance is created where there is no PurchaseOrderNumber and the second instance is when there is a PurchaseOrderNumber. But the first instance already creates a closed tag userfield. How do I get rid of this tag so my output validations are gone?

    Hi Ronald,
    One way to get rid of the empty nodes in your map by using a custom functoid and use XSLT script mentioned in this article. 
    Remove empty nodes in BizTalk by using XSLT
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • Removing vector elements

    hi there
    i have a vector, that has the contents of a directory as elements. in the post proccessing phase i trie to remove all elements that are .java files or are class files that end with Options.class or Options$1.class.
    i use this code
    for(int i=0; i < plugins.size(); i++) {
       theFilename = plugins.elementAt(i).toString();
       System.out.println("TheFilename: "+theFilename);
       if(theFilename.endsWith(".java") ||
          theFilename.endsWith("Options.class") ||
          theFilename.endsWith("Options$1.class")) {
            System.out.println("Removed: "+theFilename);
               plugins.remove(theFilename);
    }the problem is, that that code always leaves one element in the vector, that should be sorted out by this loop. anyone an idea ?
    - rebel

    Hi jaylogan again,
    i read your second answer. I use the methods of the file-class. So it seems better to paste the whole method in here. note, the for loop, that removes filenames is twice there. after first test i found ou, that the second loop is removing the last filename that should not be in the list. that worked as long i had only one plugin in the plugin directory. when i added a second plugin the double for-loop was not working anymore. there is still an element left that should not be in the list.
    sourcecode:
    public void createPluginList() {
              String theFilename;
              String plugInDir = getCurrDir()+File.separator+"plugins";
              File dir = new File(plugInDir);
              FilenameFilter filter = new FilenameFilter() {
                   public boolean accept(File dir, String theName) {
                        return theName.startsWith("Pi");
             String[] contents = dir.list(filter);
             if (contents == null) {
                   // Either dir does not exist or is not a directory
              } else {
                   for (int i=0; i < contents.length; i++) {
                        plugins.addElement(contents);
              System.out.println("------------");
              for(int i=0; i<plugins.size(); i++) {
                   System.out.println(plugins.elementAt(i).toString());
              System.out.println("------------");
              for(int i=0; i < plugins.size(); i++) {
                   theFilename = plugins.elementAt(i).toString();
                   System.out.println("TheFilename: "+theFilename);
                   if(theFilename.endsWith(".java") ||
                   theFilename.endsWith("ptions.class") ||
                   theFilename.endsWith("ptions$1.class")) {
                        System.out.println("Removed: "+theFilename);
                             plugins.remove(theFilename);
              System.out.println("------------");
              for(int i=0; i < plugins.size(); i++) {          // I dont know why i have to run this
                   theFilename = plugins.elementAt(i).toString(); // a second time, but only then
                   System.out.println("TheFilename: "+theFilename); // it works
                   if(theFilename.endsWith(".java") ||
                   theFilename.endsWith("Options.class") ||
                   theFilename.endsWith("Options$1.class")) {
                             System.out.println("Removed: "+theFilename);
                             plugins.remove(theFilename);
              System.out.println("------------");
              for(int i=0; i<plugins.size(); i++) {
                   System.out.println(plugins.elementAt(i).toString());
    -rebel

  • How to remove options in context menu of the task in UWL.

    Hi,
    How to remove options or customize the context menu of the task in UWL.
    I have 4 options(Edit,Remove,Forward,Resubmit) is appearing in the context menu.
    My requirement is to delete Forward option form the menu list and only 3 options
    should appear in the list.
    Can anybody suggest where to change?
    Thanks,
    Vikas

    Hi vikas,
    Go to System Admin ->System Config->UWL Admin.
    select your system alias.
    Click on Click to Click to Administrate Item Types and View Definitions.
    Select your UWL configuration.
    Download DTD as well as XML file through Download Configuration.
    Then you can edit the xml file using XML spy editor or anyone.
    to upload go back to the same page and select the tab...Upload new configuration.
    Do not forget to clear the cache after upload.
    Hope this helps you.
    Regards
    Atul Shrivastava

  • Time Machine not backing up 2nd external drive, remove option grayed out

    I have two external hard drives, 300gb (firewire) and 500gb (usb). Time Machine is backing up to the 300gb. In Time Machine's options, the 500gb is excluded from being backed up, and the remove option is grayed out.
    The 300gb Time Machine Backup drive is formatted as Mac OS Extended. The 500gb drive is formatted as MS-DOS (FAT32).
    I know the backup drive needs to be formatted as Mac OS Extended, but will it not even back up other drives that are FAT32?

    I am having a similar problem. I initially set it up 3 days ago and had it back up just the iMac to Time Capsule (about 120 GB) which it did no problem (I initially had my LaCie drive excluded). I then un-excluded my other drive, where all my photos and music reside (about 130 GB). Since then, it keeps trying to back up about 102 GB each time. Looking at the list of backups it does not appear that it has ever successfully backed up the LaCie. I am not aware of any error messages, but I have not been home much. I normally shut down the computer at night but I have been leaving it on trying to let Time Machine do its thing. All I can say is that every time I am at the computer TM is running and it always looks like it is in the middle of backing up 102 GB (usually seems to be near the beginning, never seem to see it more than halfway done). Looking at the TM panel it says the latest backup was 2 days ago. I'd appreciate any advice!

  • I can´t remove win from my mac because I can´t select the remove option from boot camp assist. Can anybody help me?

    I can´t remove windows partition from my mac because I´can´t select the remove option from boot camp assit. Can any body help me?

    open disc utility choose the drive you need partitioning highlight the bootcamp partition and click on the minus sign at the bottom left.
    after this manually resize your drive by dragging the partition line all the way down and click on partition.

  • How to develop ALV and select-option element in BSP? Help!

    Hi Experts,
    I have a requirement where I have a selection screen with 3 select-option elements and a search button. On clicking the search button an ALV table report has to be shown.
    The ALV table is used for new row/rows entry, delete row/rows and update row/rows data. This is something like table control in normal ABAP.
    Additionaly, I want the download to Excel, sorting, filtering, column swapping options in ALV.
    How can I achieve this in BSP?
    Is there any existing SElect-option and ALV component in BSP?
    Any code sample will be really helpfull.
    How much development time will it take?
    Please help!
    Thanks
    Gopal

    I think you will find that most of what you are looking for does NOT exist out of the box for BSP.  There is no delivered selection-option or value help.  I ended up creating my own over the years (You can find some versions online here in SDN in my weblogs - however a complete implementation of select-options was only delivered along with the Advanced BSP Programming book). 
    There is no ALV either.  However with the htmlb:tableView, you can acomplish quite a bit.  You may have to learn about table view iterators to get it all done.  Downloading to Excel also isn't delivered.  I developed a reusable BSP Extension element for this as well (can be found on SDN in my weblogs or with the Advanced BSP Programming book).
    If you plan to recreate all these elements by yourself, your project will take some time.  It took a while to build so many complex UI elements. 
    What release are you running on?  In Netweaver04S you have Web Dynpro ABAP.  WDA has delivered components for value help, select-options, and ALV.

  • Removing an element with JDOM

    Using JDOM, does anyone know of a way to remove an element? Thanks,
    chris

    Found the answer. removeChild() gets the job done.

  • Optional elements not supported in XML parser for java

    I am using v2 parser version 2.0.2.8.0 for java. Looks like this parser does not support optional elements.
    My DTD looks like
    <!ELEMENT Graph (Background, ImageSize)?>
    <!ELEMENT ImageSize EMPTY>
    <!ATTLIST ImageSize
    width CDATA #IMPLIED
    height CDATA #IMPLIED >
    <!ELEMENT Background EMPTY>
    <!ATTLIST Background
    fillColor CDATA #IMPLIED>
    If I set the XML following XML
    <?xml version="1.0" ?>
    <Graph>
    <ImageSize width="422" height="477"/>
    </Graph>
    I am getting XMLParseException :Invalid element 'ImageSize' in content of 'Graph', expected elements '[Background]'
    The parser expects all the elements to be present in the XML although the elements are defined as optional in the DTD. It used to work fine until v2 parser version 2.0.2.7.0. Is this a bug?
    null

    The value of JAXP is that it allows one to
    freely switch parsers without changing any code. I have an application that uses the JAXP interfaces to create my DOM parser. I am using the Xerces-J parser now. I wanted to try Oracle's parser to see how it compares. To my great surprise, I found the Oracle DOM parser doesn't support JAXP. Because of this I have to CHANGE my code to user the Oracle DOM parser. Thus defeating the purpose of coding my app to the JAXP interface.
    I have to add that I am surprised to see that a developer of Oracle's XML parser has to even ask what the value of JAXP is. I would think that being a parser developer, you would know and understand the value of JAXP.
    I would like to know why Oracle has chosen not to support JAXP? Or have you just not even thought about whether or not you should support it.
    Thanks,
    Keith Jensen
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    What is the perceived value in implementing the JAXP standard? We already implement SAX, have plans for SAX2, and are working with other XSLT vendors on the TRAX api for XSLT processors.
    If there is strong customer demand, we'll clearly consider it, but at the moment that has not been the case.<HR></BLOCKQUOTE>
    null

  • I am not able to remove an element of my side bar of the finder

    I am not able to remove an element of my side bar of the finder

    Try holding down the COMMAND key while dragging the element to the desktop.

  • Remove blank element in array

    need help how to remove empty elements in an array?

    Hi jeyanthi,
    if you want to delete somthing from a txt file, you have also first to read the data, remove the part you want and to write the new data into the file. So i think you can do it with the array version. For example something like this:
    Mike
    Message Edited by MikeS81 on 06-09-2008 09:32 AM
    Attachments:
    Unbenannt1.PNG ‏6 KB

  • Can't update XML with optional element

    Hi,
    I'm trying to update an XML document (global XML Schema based) with an optional element (insert an optional element into an existing xml document).
    The update statement seems to work but the optional element is missing when I select the document!
    How can I update (insert) an optional element in an XML document?
    Thanx for your comments,
    Markus
    My scenario:
    ============
    XML Schema:
    <?xml version='1.0'?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb">
    <xsd:element name="TestUpdate" xdb:defaultTable="TESTUPDATE">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="anElement" type="xsd:string" />
    <xsd:element name="optElement" type="xsd:string" minOccurs="0" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    SQL:
    begin
    dbms_xmlschema.registerSchema('xsd/TestUpdate.xsd',
    getDocument('testupdate.xsd'),
    FALSE);
    end;
    ALTER TABLE TestUpdate
    add constraint VALID_TestUpdate
    check (XMLIsValid(sys_nc_rowinfo$)=1);
    INSERT INTO TestUpdate values (xmltype(getDocument('TestUpdate.xml')))
    update TestUpdate x
    SET x = UPDATEXML(value(x),
    '/TestUpdate/optElement','<optElement> my optional Element</optElement>');
    ==> Message is: 1 row updated !!!!!!!!!!
    SQL> select * from testupdate;
    SYS_NC_ROWINFO$
    <TestUpdate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespac
    eSchemaLocation="xsd/TestUpdate.xsd">
    <anElement>more text....</anElement>
    </TestUpdate>
    ==> No UPADATE performed!!!

    Thanks Pete,
    XPath evaluation may return no data and may cause the trouble of giving an 'success' answer.
    On the other side I have rewritten the statement:
    SQL> update testupdate x set x.XMLData."optElement" = ' just some text';
    SQL> select * from testupdate;
    SYS_NC_ROWINFO$
    <TestUpdate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespac
    eSchemaLocation="xsd/TestUpdate.xsd">
    <anElement>more text....</anElement>
    </TestUpdate>
    ===> no UPDATE ???????
    SQL> select x.xmldata."optElement" from testupdate x;
    XMLDATA.optElement
    just some text
    ===> WOW, row is updated!!!!!!!!
    This result is more wired than before :-)
    (at least for myself)
    Can somebody explain the result?
    bye,
    Markus

  • Best way to handle optional elements in XSLT

    Hi All,
    I'v wondering if there are any better ways to handle optional fields in XSLT.
    For example if my Person Type has 5 fields and 3 of them are optional:
    <xs:complexType name="PersonType">
    <xs:element name="PersonID" min="1"/>
    <xs:element name="PIN" min="1"/>
    <xs:element name="FirstName" min="0"/>
    <xs:element name="MiddleName" min="0"/>
    <xs:element name="LastName" min="0"/>
    </xs:complexType>
    In my xslt file, if I do somthing like:
    <Person>
    <FirstName>
    <xsl:value-of select="PersonType/FirstName"/>
    </FirstName>
    </Person>
    I might get an empty FirstName element in my output xml file. (like <FirstName/>) This has caused some very weired behavour with Oracle v2 parser because optional means the node may not be present in the xml not the node is there but empty.
    The only way I can think of solving this is to put <xsl:if test> around every single optional element to test if it exist in the source file. If it does then generate the element in the destination file. But in this way, if the source file is very complicated, then you would have to wrap each element with a <xsl:test> which is very ugly to me.
    Do anyone know if there is a more generic way that we can solve this issue?
    Thanks,
    Larry

    Dharmendra,
    The answer you gave is very very helpful. The only thing that I can think of here is that it might accidentally delete the fields that have been set empty deliberately.
    Maybe, this is one of the grey areas in XML Schema that I do not understand very well yet. In xml, if you define an element to be a string type and mandatory (minOccurs="1"), for exampe the following xml
    <Name></Name>
    will be valid against the schema because the Name element is present in the xml payload. However, it has no value or has a valud of empty string. I know that this is only a problem with string type. If it is boolean, then it has to be either true of false, being empty won't satisfy the schema validator. But with String it is a bit trickier, because String can be empty. Maybe this issue should be stopped when designing your xml schema by specifying the mininum length (>0) in the schema. Any suggestions would be welcomed.
    Cheers,
    Larry

  • Creating optional elements using SQL / XML functions

    Hi,
    I am struggling with some SQL / XML functionality in order to create some optional elements in a XMLType.
    I have one table with data to be generated into an XML document. The table looks like this (only the attributes related to the problem are shown):
    msg_id (pk)
    geslacht_hoofdverzekerde
    geboortedatum_hoofdverzekerde
    geslacht_medeverzekerde
    geboortedatum_medeverzekerde
    I have to create an XML document that looks like this:
    <ber:rekenparameters>
    <ber:verzekerde>
    <ber:codeRelatierol>HVZ</ber:codeRelatierol>
    <ber:geslacht>M</ber:geslacht>
    <ber:datumGeboorte>01-01-1960</ber:datumGeboorte>
    </ber:verzekerde>
    <ber:verzekerde>
    <ber:codeRelatierol>MVZ</ber:codeRelatierol>
    <ber:geslacht>V</ber:geslacht>
    <ber:datumGeboorte>01-01-1961</ber:datumGeboorte>
    </ber:verzekerde>
    </ber:rekenparameters>
    Where <ber:codeRelatierol> is hard coded: i.c. of hoofverzekerde 'HVZ' in case of medeverzekerde 'MVZ'.
    Geslacht en datumGeboorte are taken form the table.
    The element <ber:verzekerde> is obligatiry for hoofdverzekerde but optional for medeverzekerde: only in case geslacht_medeverzekerde and geboortedatum_medeverzekerde are not null this 2nd <ber:verzekerde> element has to be added.
    I created the next SQL (I skipped some stuff in order to focus on the problem):
    CREATE OR REPLACE
    VIEW dps_v_berekening_berichten
    AS
    SELECT msg_id as msg_id
    , XMLElement( "ber:berekening"
    , XMLAttributes( 'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"
    , 'http://www.mycompany.nl/berekenen' AS "xmlns:ber"
    , 'http://www.mycompany.nl/berekenen http://www.mycompany.nl/berekenen/berekening.xsd' AS "xsi:schemaLocation"
    , XMLElement( "ber:nummerRekenRegel"
    , XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
    , 1
    , XMLElement( "ber:rekenparameters"
    , XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
    , XMLElement( "ber:codeEvolutie" ) -- Empty
    , XMLElement( "ber:verzekerde"
    , XMLForest ( 'HVZ' AS "ber:codeRelatierol"
    , xoa.geslacht_hoofdverzekerde AS "ber:geslacht"
    , xoa.geboortedatum_hoofdverzekerde AS "ber:datumGeboorte"
    , XMLElement( "ber:verzekerde"
    , XMLForest ( 'MVZ' AS "ber:codeRelatierol"
    , xoa.geslacht_medeverzekerde AS "ber:geslacht"
    , xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
    -- Some more elements.
    ) AS bericht
    FROM DST_UP1_XML_OUTDATA xoa
    The problem is that the XMLForest always creates an <ber:verzekerde> element for medeverzekerde. I tried to create an inline view with just the "vezekerde"attributes and conditionally joining this inline view with the dst_up1_xml_outdata table. That didn't solve my problem. Because in case of a medeverzekerde available it returned two XML documenst: one that included the hoofdverzekerde and one that included the medeverzekerde. And obviously that's not what I want.
    I imagine I have to juggle with some of these SQL / XML functions although I cannot put the finger on the exact differences between some of these (XMLElement, XMLForest, XMLAgg, XMLSequence). The examples shown in de XML DB Developer's Guide don't seem to adress my problem.
    Help !

    Hi, are you talking about this part that you don't want to be there? I am not so clear about your requirements.
    XMLElement( "ber:verzekerde"
    , XMLForest ( 'MVZ' AS "ber:codeRelatierol"
    , xoa.geslacht_medeverzekerde AS "ber:geslacht"
    , xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
    If you want to control certain subelements so they don't appear, do not use xmlforest. Use xmlelement instead so it is easier to control it using case when. Mark (of Oracle, he should be here soon since OOW is over) showed me this technique and it helps tremendously, because oftentimes XDB will return an empty tag even though your consumers don't like it!
    try something like this,
    (case when xoa.geboortedatum_medeverzekerde = 'MVZ' then
    xmlelement("ber:verzekerde",
    xmlelement("What you want", colname),
    xmlelement("ber:codeRelatierol", 'MVZ'),
    (case when colname is not null or = some other value then
    xmlelement("Rest", colname))
    end)
    end),
    You may have to twig some details there. But the key is to use the case when construct to get rid of unwanted elements or empty elements. So you should only have the elements if you have a value of 'MVZ'. Hope this helps.
    Ben

  • Remove Options from iView, Page - Tray

    How do I remove the Options from an iView, Page Tray in ESS & MSS:
    'Add to Favorites' Option
    'Details' Option
    'Expand'/'Collapse' Icon in Tray
    'Help' Option
    'Open in New Window' Option
    'Personalize' Option
    'Refresh' Option
    'Remove' Option
    I wish do this global for my ESS and MSS user when they view any Pages and iViews
    Thanks
    WB

    Hi there,
    Make the necessary settings here:
    SPRO -> Personnel Management -> Employee Self-Service -> General Settings -> Homepage for Self-Services -> Resources-> Define Resources -> Define Resources (Add Entries)
    Changes made to this service will appear in ESS/MSS and will affect the Icons the manager or an employee will be able to see on the portal.
    Goto the below link too:
    http://help.sap.com/saphelp_erp2004/helpdata/en/f6/263359f8c14ef98384ae7a2becd156/frameset.htm
    Regards,
    Ponneswari.

Maybe you are looking for