Filtering elements in an XML based on criteria

we have an output schema that has some repeating elements. There is some meta-data in the output XML that we are trying to filter out in the final output. Since this transformation is between the same input/output XML, I am trying to achieve this using transform activity. How can we use XSLT constructs in the transformation activity to achieve this. For example:
Records (parent)
-->Record (child unbounded)
--> Id (attribute of Record element)
--> name (attribute of Record element)
If we have a list of record elements, we want to filter/remove all the record elements that starts with name="meta__" in the output XML

hi Veer,
I have achieved the same using java API. This is the block of code, through which i achieved
com.oracle.bpel.client.IBPELProcessHandle
com.oracle.bpel.client.IInstanceHandle
com.oracle.bpel.client.Locator
com.oracle.bpel.client.ServerException
This four API's will help us to communicate with OC4j instance and we can get relevant xml element, in my case i have retrieved input variable from audit instance data.
IBPELProcessHandle processHandle = connectOC4J();
IInstanceHandle instanceHandle = getInstanceHandle(processHandle,instanceID);
String Title = instanceHandle.getTitle();
String processId = instanceHandle.getParentId();
String Status = instanceHandle.getStatus();
HashMap AuditTrail = (HashMap)instanceHandle.getField("inputVariable");
System.out.println(Title+"\t"+processId+"\t"+Status+"\t");
Set keySet = AuditTrail.keySet();
Iterator it = keySet.iterator();
for(int k=0;k<AuditTrail.size()&&it.hasNext();k++){
String key = (String)it.next();
Element value = (Element) AuditTrail.get(key); // Element contains input variable data..
Hope this helps you..
regards
Rajesh

Similar Messages

  • Dynamic element binding between XML based PDF form and WDA context

    Hi Experts,
    I am working on a XML based interactive form.There is a table node in the XML interface which generated by WDA context, and binding on a subform in the PDF form.
    I tried to add instances to the subform using javascript. Unfortunately, I can not get the internal table in WDA.
    If I initialize the table to 10 lines in WDA , and then add 5 line to it in PDF, when I submit the PDF, I can only get 10 lines in the WDA framework. It seems that the element which is create dynamically can not be past to the interface.
    Could you tell me why? And is there any other better solution? I just want build a table in PDF form in runtime and pass it to WDA context.
    Thanks a lot!
    Best Regards,
    Guo Guo Qing

    Hi Thomas,
    Thank you for your reply.
    I think the performance will be a problem if I create the elment in WDA using submit event. I need to create hundreds of record dynamically. I must find some way to reduce the communication between the WDA and PDF form. Maybe I can set a container with a number of elements before the PDF output. Do you have some better ideas?
    Best Regards,
    Guo Guo Qing

  • Reading XML based on DTD

    HI All
    i need a solution.
    if we have a dtd file and a xml file and read the file using SAX i am able to read it where i use the startElement() and endElement() and in these i will use a hardcoded my tag names so that upon reaching this tag name i do something or print.
    THis is fine.
    But what if i have different DTDs and their corresponding XMLs
    Can i read an XML by parsing first a DTD,getting the elements from the DTD and use those element names in the XML parsing by SAX.
    That is i need a generic program where given a DTD and XML, i can parse the XML based on DTD
    Is this possiblew with SAX or any other parser.
    if so how.
    i found that if i read 10 XML files from a parser. i can do that only if all are of the same DTD type.
    but can i have 10 XML with each one with different DTD and even then use a single program to read all the files
    Please help me
    Thanks
    Vijay Sunder

    Normally, XML is done for writing XML instances, respecting a specific DTD or SCHEMA.
    In the XML content you can set the DTD for the instance. So, instances can have reference to a DTD, not necessarily the same, of sure.
    In that case, the PARSER is responsible for validating the instance against the defined DTD. Simply, be careful to locate the right DTD for each instance.
    There is a very good tutorial, and short, here [http://java.sun.com/j2ee/1.4/docs/tutorial/doc/] and go to "Chapter 2: Understanding XML". You will learn how to parse a XML document, how to validate its content...
    Naturally, a Java program can read multiple XML documents, extract valuable data for your stuff. For example transform a echo.java source explained in the tutorial, for handling multiple input document which is your need, and you will experience that this code can parse different documents having different DTD references.

  • Unable to create XML based interface while using Interactiveform UIelement

    Dear All,
    I have a node under a subnode which is of a structure type.
    This structure has three components each of which is assigned a table type.
    While generating the XML based interface, message 'unsupported types wont be generated' comes and in the following From layout, I find the data entries for this particular node are invisible.
    Can you suggest a way to achieve the functionality?
    Thank You.
    Regards,
    Prosenjit.

    We should use only data elements and ABAP table structures while working with XML interfaces.

  • "Cut" an element out of XML?

    Folks,
    Please does anyone know a shortcut to "snip out" XML elements as serialized XML?
    The scenario is: We're SAX parsing a potentially very large (I guess upto maybe 200 MB) XML document. The data ("features") therein will be edited by the user in a third party GIS application... and then I need to quickly detect which "feature" elements have changed.
    I need to turn the modified features back into XML and send them back to the server, which updates the database. Currently the users have to manually mark which features have been modified and which have been deleted... a process which is subject to human error (and there have been some doozies, apparently).
    So... I'm trying to knutt-out a practical way to detect: "Has this feature been modified (or deleted).
    My thought was to calculate a hash (SHA1, MD5, or maybe just CRC32) of the serialized XML which represents the feature (both geometry and attributes) before and after... if they're different the feature has been modified. If the feature (identified by a unique id) is missing from the after shot then obviously it's been deleted.
    So... My question is: does anybody know a cheats way to get the XML-string for an element from a SAX parser? Note that I can't use a DOM (even for one feature) because the largest existing feature has a tad over 500,000,000 points.
    My best approach (the obvious one) so far is:
    IMPORT XML
    foreach feature
    1. parse the feature-XML into a model
    2. serialize the model to a StringBuffer
    3. calculate the hash (or whatever) and store it against the featureId.
    EXPORT XML
    foreach feature
    1. serialize the feature to StringBuffer
    2. recalcuate the hash (or whatever)
    3. compare the hash.
    Does this sound reasonable to you? It sounds slow but simple to me... Got any better ideas?
    Note that the third party editor has no "callback hooks" which allow me to handle the "feature modified" events, and whilste I can query and update it's internal database (dBase4 based) via the API, doing so is cumbersome.
    I've also looked into timestamps, which appear impossible... atleast I can't imagine how it could be done, short of writing my own dBase driver (which I'm not up for, thanks anyway;-).
    No ideas will be rejected... I'll try (almost) anything once.
    Cheers all. Keith.
    Edited by: corlettk on 16/04/2009 23:55 ~~ Clarity.
    PS: It's already past my bedtime... I shall check this post again tomorrow evening (in about 18 hours).
    Edited by: corlettk on 16/04/2009 23:56

    corlettk wrote:
    So... My question is: does anybody know a cheats way to get the XML-string for an element from a SAX parser? Well, obviously there isn't one. At least not when you phrase the question that way. Consider the case where the element in question is the root element: then you need to serialize the whole document.
    But you could read up on XMLFilter, which is a useful but little-known tool which works with SAX parsing.

  • How to get the values of all elements and sub elements from  following xml

    how to get the values of all elements and sub elements from following xml...
    <?xml version="1.0" encoding="UTF-8" ?>
    <List_AML_Finacle xmlns="http://3i-infotech.com/Cust_AML_Finacle.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://3i-infotech.com/Cust_AML_Finacle.xsd List_AML_Finacle.xsd">
    <TransactionID>TransactionID</TransactionID>
    <Match>
    <Src_Matched_Field>Src_Matched_Field</Src_Matched_Field>
    <List_Matched_Field>
    <FSFM_Matches>
    <NUMBER>NUMBER</NUMBER>
    <TERROR>TERROR</TERROR>
    <TU>TU</TU>
    <NAMEU>NAMEU</NAMEU>
    <DESCRIPT>DESCRIPT</DESCRIPT>
    <KODCR>KODCR</KODCR>
    <KODCN>KODCN</KODCN>
    <AMR>AMR</AMR>
    <ADDRESS>ADDRESS</ADDRESS>
    <SD>SD</SD>
    <RG>RG</RG>
    <ND>ND</ND>
    <VD>VD</VD>
    <GR>GR</GR>
    <YR>YR</YR>
    <MR>MR</MR>
    <CB_DATE>CB_DATE</CB_DATE>
    <CE_DATE>CE_DATE</CE_DATE>
    <DIRECTOR>DIRECTOR</DIRECTOR>
    <FOUNDER>FOUNDER</FOUNDER>
    <TERRTYPE>TERRTYPE</TERRTYPE>
    </FSFM_Matches>
    <OfacMatchDetails>
    <UID>UID</UID>
    <TITLE>TITLE</TITLE>
    <SDNTYPE>SDNTYPE</SDNTYPE>
    <REMARKS>REMARKS</REMARKS>
    <ID_UID>ID_UID</ID_UID>
    <IDTYPE>IDTYPE</IDTYPE>
    <IDNUMBER>IDNUMBER</IDNUMBER>
    <IDCOUNTRY>IDCOUNTRY</IDCOUNTRY>
    <ISSUEDATE>ISSUEDATE</ISSUEDATE>
    <EXPIRATIONDATE>EXPIRATIONDATE</EXPIRATIONDATE>
    <ADDRESS1>ADDRESS1</ADDRESS1>
    <ADDRESS2>ADDRESS2</ADDRESS2>
    <ADDRESS3>ADDRESS3</ADDRESS3>
    <CITY>CITY</CITY>
    <STATEORPROVINCE>STATEORPROVINCE</STATEORPROVINCE>
    <POSTALCODE>POSTALCODE</POSTALCODE>
    <COUNTRY>COUNTRY</COUNTRY>
    </OfacMatchDetails>
    </List_Matched_Field>
    </Match>
    </List_AML_Finacle>

    avoid multi post
    http://forum.java.sun.com/thread.jspa?threadID=5249519

  • Using XML-based object structures to represent data in code/at run-time

    Hello,
    I have quite a "high level" question which has be bothering me for some time, and I haven't found the subject tackled in any books. I believe J2SE/J2EE is not an important divide here.
    Lets say I want to develop a J2SE game application with two programs: a "level designer", and a "level viewer", and I want to store the level files in an XML format.
    My question, and I use this example only to try and illustrate it, is:
    when coding the level designer or viewer, is it reasonable to use an XML-based object hierarchy for representing a level in code/at run-time, i.e. using the standard Java DOM APIs? Or should one (as I would have done before XML came along) develop a set of classes much closer to modelling the real form of a level, and then add a means to convert those objects to/from to XML format?
    This second option of course I would use/would have used if I wasn't thinking about XML, but isn't it sometimes easier to just read in an XML file into a DOM representation and just use the data straight out of that structure, rather than go through the bother of parsing the XML into a set of unrelated objects defined by a different family of classes? What shapes your decision here? And if the second option is best, what is the easiest way of converting to/from the XML?
    Thank you for any advice.
    Greg

    Hi Christian,
    Can I ask: what about if your domain was quite 'close' to an object/DOM representation of XML?
    For instance, what if a game operated by acting out a theatrical script, a spoken conversation, between two characters, perhaps somehow influenced at points by the user, and a particular level was just a different script for the characters.
    One could imagine that the object representation of this would in the end be quite similar to how you'd represent XML, i.e. like a tree of nodes, where each node was a line from the script, and some nodes were a decision point where different nodes could be chosen from.
    Would you still want to avoid using XML-based classes to represent the underlying 'game', or is there a point where you would 'give it' to the similarity and use existing XML structures directly?
    Thank you for any advice
    Greg

  • How to update/change the value of elements in an xml file?

    Hi Everyone,
    Could any one of u tell me how to update the value of elements in an XML file, using java? The reason is i want to use an XML file as a data source (i.e. more or less like a database), without using any RDBMS, for simple applications such as to read a record and update the record. By the way, my XML file will have only one record, such as the current weather information, with fields such as temperature, humdity etc. for 1 city only.
    Thanks in advance.

    Here is a solution how to check a particular value or element name in an xml and update the changes e to an xml.
    Sample.xml
    <URLConstructor>
    <application name="cp_outage">
    <resource>hello</resource>
    <value>val</value>
    </application>
    <application name="cp_outage">
    <resource>hello</resource>
    <value>val</value>
    </application>
    </URLConstructor>
    XMLWriter.java
    package com;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.JDOMException;
    import org.jdom.input.DOMBuilder;
    import org.jdom.output.XMLOutputter;
    // used for printing
    import org.apache.xml.serialize.XMLSerializer;
    import org.jdom.output.XMLOutputter;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.util.Iterator;
    import java.util.List;
    class XMLWriter{
    public void update(File fileName)
    try {
              DOMBuilder domBuilder=new DOMBuilder();
              Document doc=domBuilder.build(fileName);
              Element element=doc.getRootElement();
              getChildren(element);
              writeToXML(doc,fileName);
              getChildren(element);
    } catch (Exception e) {
    e.printStackTrace();
         * @param doc
         private void writeToXML(Document document,File filePath)
                   XMLOutputter xmloutputter = new XMLOutputter();
                        try
                             FileOutputStream fileOutputStream = new FileOutputStream(filePath);
                             xmloutputter.output(document, fileOutputStream);
                             fileOutputStream.close();
                        catch (FileNotFoundException e)
                             e.printStackTrace();
                        catch (IOException e)
                             e.printStackTrace();
         public void getChildren(Element element)
                        if(!element.hasChildren())
                             return;
                        List childrenList = element.getChildren();
                        Iterator itr=childrenList.iterator();
                        while(itr.hasNext())
                             Element childElement=(Element) itr.next();
                             if(childElement.hasChildren())
                                       getChildren(childElement);
    //                                   System.out.println("Name "+childElement.getName());
    //                                   System.out.println("Value "+childElement.getText());
                                       if(childElement.getText().equals("hello") || (childElement.getName().equals("resource")))
                                            updateInfo(childElement,"New_Resource","AddedText");
         * @param childElement
         * @param string
         * @param string2
         private void updateInfo(Element element, String elementName, String value)
              element.setName(elementName);
              element.setText(value);          
    static public void main(String[] args)
    XMLWriter xmlWriter=new XMLWriter();
    xmlWriter.update(new File("c:/sample.xml"));
    After execution the file will be changed to
    <URLConstructor>
    <application name="cp_outage">
    <New_Resource>AddedText</New_Resource>
    <value>val</value>
    </application>
    <application name="cp_outage">
    <New_Resource>AddedText</New_Resource>
    <value>val</value>
    </application>
    </URLConstructor>
    Regards,
    Maheswar

  • Specifying Case-Insensitive Element Names in XML Schema

    Hope someone knows this!
    Is it possible to define an an XML Schema Definition so that Element names in the target XML File can be case insensitive.
    At the moment my Parser throws an error if the element names in the XML file do not have the exact same case as the definition in the XML schema.
    E.g
    In Schema i have:
    <xsd:element name="HOSTINVENTORYLINE" type="HostInventoryLineType" maxOccurs="unbounded" minOccurs="0"/>
    but in xml file i have
    <HostInventoryLine field=""/>
    or
    <hostinventoryline field=""/>
    Does anyone know anyway to get around this, so that the parser accepts the HostInventoryLine element in the xml as an instance of the HOSTINVENTORYLINE element defined in the schema.
    Thanks in Advance
    JJ
    Message was edited by:
    [email protected]

    You could use substitution groups to handle this. You would need an entry in the schema for each valid capitalization. This won't scale well if you want to be completely case insensitive, but if you only support lower case, upper case, and camel case it should do the trick.
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:complexType name="HostInventoryLineType">
              <xs:sequence>
                   <xs:element name="an-element" type="xs:string"/>
              </xs:sequence>
         </xs:complexType>
         <xs:element name="HostInventoryLine" type="HostInventoryLineType"/>
         <xs:element name="HOSTINVENTORYLINE" type="HostInventoryLineType" substitutionGroup="HostInventoryLine"/>
         <xs:element name="hostinventoryline" type="HostInventoryLineType" substitutionGroup="HostInventoryLine"/>
    </xs:schema>-Blaise

  • How to Add namespace to all elements in a xml document

    Hi,
    I am trying to read an xml file that does not have any namespace definitions. I have been able to create another schema in which i specify the namespace defination as shown below.
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://TargetNamespace.com/AckPaymentFile_PL" targetNamespace="http://TargetNamespace.com/AckPaymentFile_PL" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" nxsd:version="DTD" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <include schemaLocation="PM_XML_FILE_ACK_SCHEMA_NO_NAMESPACE.xsd"/>
    </xs:schema>
    Once i do it, i am able to see the namespace has been assigned to the root element. I am looking for a way to assign the namespace and prefix tag to all elements in the xml document. If i don't i am unable to access any part of the xml document, keep getting please verify if xpath is correct.
    Thanks
    Sridhar

    Hello,
    Once you've answered all the above.
    If you can run xpath that supports functions against the xml, the expression:
    count(//phone)Otherwise, without leaving SQL:
    select count(*) from
    xmltable('//phone' passing
      -- Your XML goes here, could be a table column with type XMLTYPE.
      xmltype('<person><phone>123-456-7890</phone><phone>098-765-4321</phone></person>')
      columns phone varchar2(24 char) path '/phone'
    ;

  • No root element found in xml

    I am facing a problem when i am trying to use TOAD. Its giving me an error like
    NO ROOT ELEMENT FOUND IN XML. Can someone help me in corrcting this Error ?
    Regards,
    Chandra deep

    NO ROOT ELEMENT FOUND IN XML. Can someone help me in
    corrcting this Error ? That means the XML document is either missing the surrounding <element> ... </element> pair or has more than one pair at the base level of the document. Resolve that and you are done.
    Now ... given that I am probably 4,000+ km away from you and can not see your screen, please look at your question and ask yourself whether you have given sufficient information for troubleshooting. <g>

  • Identify individual elements in repeated elements in an XML document

    Hello,
    I'd like to identify individual elements in repeated elements in an XML document.
    For example a table 'dataXML' which has a column 'sample' (XMLType). If I have an XML document such as,
    <ELEMENT>
    <PO>
    <PONO>100</PONO>
    <PONO>200</PONO>
    </PO>
    </ELEMENT>
    I can use //PONO[1] to identify the first "PONO" element (with value 100) and //PONO[2] to identify the second "PONO" element in the document.
    If I write this query:
    select L.sample.extract('ELEMENT/PO/PONO/text()')).getStringVal()"SAMP"
    from dataXML L
    I'll receive this result:
    SAMP
    100200 (the first row)
    And if I write this query:
    select L.sample.extract('ELEMENT/PO/PONO[1]/text()')).getStringVal()"SAMP"
    from dataXML L
    I'll receive this result:
    SAMP
    100 (the first row)
    But I'd like the following result:
    SAMP
    100 (the first row)
    200 (the second row).
    Could you help me, please?
    Thank you very much.
    Melissa Lemos

    you have to use something like this.
    select extractvalue(xmltype_column, '/Name/@attributename')
    from table_name
    For more details see
    XMLDB Developers Guide (Oracle 9i)
    Chapter - XPATH and namespace Primer
    Table C2 - Location Path Examples Using Abbreviated Syntax.
    Page Number 907/1044
    Hope this helps.

  • Inserting an element into an XML document

    I am simply looking insert a new element into an existing XML Document using JDOM. Here is my code so far:
    public class UserDocumentWriter {
         private SAXBuilder builder;
         private Document document;
         private File file = new File("/path/to/file/users.xml");
         private Element rootElement;
         public UserDocumentWriter() {
              builder = new SAXBuilder();
              try {
                   document = builder.build(file);
                   rootElement = document.getRootElement();
              } catch (IOException ioe) {
                   System.err.println("ERROR: Could not build the XML file.");
              } catch (JDOMException jde) {
                   System.err.println("ERROR: " + file.toString() + " is not well-formed.");
         public void addContact(String address, String contact) {
              List contactList = null;
              Element contactListElement;
              Element newContactElement = new Element("contact");
              newContactElement.setText(contact);
              List rootsChildren = rootElement.getChildren();
              Iterator iterator = rootsChildren.iterator();
              while (iterator.hasNext()) {
                   Element e = (Element) iterator.next();
                   if (e.getAttributeValue("address").equals(address)) {
                        contactListElement = e.getChild("contactlist");
                        contactListElement.addContent(newContactElement);
                        writeDocument(document);
         public void writeDocument(Document doc) {
              try {
                   XMLOutputter output = new XMLOutputter();
                   OutputStream out = new FileOutputStream(file);
                   output.output(doc, out);
              } catch (FileNotFoundException ntfe) {
                   System.err.println("ERROR: Output file not found.");
              } catch (IOException ioe) {
                   System.err.println("Could not output document changes.");
         }However, the problem is, the newly added element will always be appended to the end of the last line, resulting in the following:
    <contactlist>
                <contact>[email protected]</contact><contact>[email protected]</contact></contactlist>Is there anyway in which I can have the newly added element create it's own line for the purpose of tidy XML? Alternatively is there a better methodology to do the above entirely?

    Your question is not very clear.
    Do you want to know How to insert an element into an XML document?
    Answer: I can see you already know how to do it. You have added the element using addContent()
    or do you want to know How to display the XML in a tidy format?
    Answer: to view the XML in a properly formatted style you can you the Format class. A very basic way of viewing the XML would be:
       * Prints the Document to the specified file.
       * @param doc
       * @param filename
       * @param formatting
      public static void printDocToFile(Document doc, String strFileName,
          boolean formatting)
        XMLOutputter xmlOut = null;
        if (!formatting)
          xmlOut = new XMLOutputter();
        } else
          Format prettyFormat = Format.getPrettyFormat();
          prettyFormat.setOmitEncoding(false);
          prettyFormat.setOmitDeclaration(false);
          xmlOut = new XMLOutputter(prettyFormat);
        try
          if (doc != null)
            FileWriter writer = new java.io.FileWriter(strFileName, true);
            xmlOut.output(doc, writer);
            writer.flush();
            writer.close();
          } else
            System.out.println("Document is null.");
        catch (Exception ex)
          System.out.println(ex);
      }

  • Adding an extra element to a XML message

    Hello,
    We are generating XML-files using DBMS_XMLQUERY on a Oracle Database 10g Enterprise Edition Release 10.2.0.3.0.
    This works fine. But now one of our customers needs an extra element (header) in the XML file. How do I get this job done?
    The XML-file needs to look like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <aankomstBevestiging>
    <header>
    <retailPartnerCode>retailPartnerCode</retailPartnerCode>
    <bestandsNaam>bestandsNaam</bestandsNaam>
    <berichtNaam>berichtNaam</berichtNaam>
    <berichtDatumTijd>2001-12-31T12:00:00</berichtDatumTijd>
    </header>
    <aankomst>
    <artikelNummer>artikelNummer</artikelNummer>
    <kleurNummer>kleurNummer</kleurNummer>
    <maat>maat</maat>
    <status>status</status>
    <aantalOntvangen>1</aantalOntvangen>
    <werkelijkeAankomstDatum>2001-01-01</werkelijkeAankomstDatum>
    <ggb>1</ggb>
    <goederenSoort>goederenSoort</goederenSoort>
    </aankomst>
    </aankomstBevestiging>
    Currently the output looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <aankomstBevestiging>
    <aankomst>
    <artikelNummer>artikelNummer</artikelNummer>
    <kleurNummer>kleurNummer</kleurNummer>
    <maat>maat</maat>
    <status>status</status>
    <aantalOntvangen>1</aantalOntvangen>
    <werkelijkeAankomstDatum>2001-01-01</werkelijkeAankomstDatum>
    <ggb>1</ggb>
    <goederenSoort>goederenSoort</goederenSoort>
    </aankomst>
    </aankomstBevestiging>
    The code generating this XML:
    procedure create_xml_file(
    is
    l_xml clob;
    l_ctx DBMS_XMLQUERY.ctxhandle;
    PROCEDURE clob_to_xml (p_file IN VARCHAR2,
    p_clob IN CLOB,
    p_dir in varchar2,
    p_setrowsettag in varchar2 default 'Dataset',
    p_setrowtag in varchar2 default 'Table'
    IS
    l_output UTL_FILE.file_type;
    l_amt NUMBER DEFAULT 5000;
    l_offset NUMBER DEFAULT 1;
    l_length NUMBER DEFAULT NVL (DBMS_LOB.getlength (p_clob), 0);
    BEGIN
    l_output := UTL_FILE.fopen (p_dir, p_file, 'w', 32760);
    WHILE (l_offset < l_length)
    LOOP
    UTL_FILE.put (l_output, DBMS_LOB.SUBSTR (p_clob, l_amt, l_offset));
    UTL_FILE.fflush (l_output);
    l_offset := l_offset + l_amt;
    END LOOP;
    UTL_FILE.new_line (l_output);
    UTL_FILE.fclose (l_output);
    END clob_to_xml;
    BEGIN
    l_ctx := DBMS_XMLQUERY.newcontext('select mvw.rpr_artikel_nr "artikelNummer",
    mvw.rpr_kleur_nr "kleurNummer",
    mvw.rpr_maat_code "Maat",
    mat.locus_status_code "Status",
    mat.ontvangen_aantal "aantalOntvangen",
    mat.werkelijke_aankomst_datum "werkelijkeAankomstDatum",
    mat.ontvangst_order_nr "ggb",
    mat.ontvangst_order_nr "goederenSoort"
    from wdp_magazijn_aankomsten mat
    , wdp_rpr_artikel_maat_vw mvw
    where mvw.maa_id = mat.maa_id;);
    DBMS_XMLQUERY.setrowsettag (l_ctx, 'aankomstBevestiging' );
    DBMS_XMLQUERY.setrowtag (l_ctx, 'aankomst');
    DBMS_XMLQUERY.setdateformat (l_ctx, 'dd-MM-yyyy HH:mm:ss');
    DBMS_XMLQUERY.setencodingtag (l_ctx, 'UTF-8');
    l_xml := DBMS_XMLQUERY.getxml(l_ctx);
    DBMS_XMLQUERY.closecontext (l_ctx);
    clob_to_xml (p_file_name,l_xml, l_dir );
    end if;
    end;
    /

    Posted this messages also in PL/SQL XML programming
    Adding an extra element to a XML message

  • Issue with [env-entry] element in web.xml

    I know it's possible to define [env-entry] elements in web.xml for environment
    properties of a web application. But how do you access [env-entry] elements from
    classes that do not exist within a web application? In other words, this is my
    problem:
    I have an EAR file, enterprise.ear, which contains the following...
    employee.jar
    employeeSearchEJB.jar
    webApp1.war
    META-INF/
    application.xml
    The employee.jar file is a utility archive that contains common classes, one of
    which is a class called LogManager. LogManager needs to read environment properties
    in order to initialize itself. Currently, LogManager reads these properties from
    a property file, and therefore it needs to know the name of the property file
    in order to access it. I dont like this approach because I'm forced to hard-code
    the name of the property file in LogManager. I would rather leverage the power
    of J2EE deployment descriptors and use the [env-entry] element to define the environment
    properties for the LogManager class. Then, I would simply use JNDI to get the
    values of the [env-entry] elements without ever having to specify their location
    aside from the default JNDI context; java:comp/env, which is standard anyway.
    The problem I'm having is that you can define the [env-entry] element in only
    2 types of deployment descriptors; namely, web.xml and ejb-jar.xml, neither of
    which are available to LogManager because LogManager exists at the EAR root level.
    I was hoping application.xml supported the [env-entry] element, but it doesn't.
    Any suggestions?
    SAF

    SAF,
    I am not sure if this applies to you situation but if you create an initial context
    instance and then grab the value using the jndi name within that context then
    you should be able to grab that environment variable.
    I have a helper class that is used as part of a deployed application. The helper
    class doesn't have access to the Servlet context but it is created as part of
    the application workflow. When it gets initiated it grabs an env-entry created
    in the web.xml deployment descriptor to find the default url for a content path.
    After I create an initialContext, I perform a initContext.lookup("jndi.env.entry.here")
    where "jndi.env.entry.here" is the name specified in the env-entry tag.
    This returns the value of the entry.
    This works under both Jrun and Weblogic so my guess is it should work for you.
    Again, I am assuming that your class will at least be able to grab a context
    object to communicate back to the server.
    Hope this helps,
    Troy
    "SAF" <[email protected]> wrote:
    >
    I know it's possible to define [env-entry] elements in web.xml for environment
    properties of a web application. But how do you access [env-entry] elements
    from
    classes that do not exist within a web application? In other words, this
    is my
    problem:
    I have an EAR file, enterprise.ear, which contains the following...
    employee.jar
    employeeSearchEJB.jar
    webApp1.war
    META-INF/
    application.xml
    The employee.jar file is a utility archive that contains common classes,
    one of
    which is a class called LogManager. LogManager needs to read environment
    properties
    in order to initialize itself. Currently, LogManager reads these properties
    from
    a property file, and therefore it needs to know the name of the property
    file
    in order to access it. I dont like this approach because I'm forced to
    hard-code
    the name of the property file in LogManager. I would rather leverage
    the power
    of J2EE deployment descriptors and use the [env-entry] element to define
    the environment
    properties for the LogManager class. Then, I would simply use JNDI to
    get the
    values of the [env-entry] elements without ever having to specify their
    location
    aside from the default JNDI context; java:comp/env, which is standard
    anyway.
    The problem I'm having is that you can define the [env-entry] element
    in only
    2 types of deployment descriptors; namely, web.xml and ejb-jar.xml, neither
    of
    which are available to LogManager because LogManager exists at the EAR
    root level.
    I was hoping application.xml supported the [env-entry] element, but it
    doesn't.
    Any suggestions?
    SAF

Maybe you are looking for

  • Test Execution hangs while executing a test from Command prompt option

    I have done the following 1) Created a script Test driver 2) Added different scripts as Script->Properties->Assets to the driver script 3) Call each of this asset script from TestDriver using command getScript("<<ScrptName>>".run(1, true, true, true)

  • Ipod won't do anything but restore

    Hello, I've had my ipod for about 6 months now working fine. All of the sudden when I put a new cd on it, it needs to restore. Fine... but since I had itunes up my ipod showed I had all those songs, but they were empty. I restored it again, and now i

  • Alternate query to Remove minus operator

    Hi All, The query below does following First Query Find all the GL accounts within date range and second query find all GL Elimination Accounts from GL Elimination setup. By Using minus i will find out which accounts are not setup in GL Elimination S

  • Errors in the generated reports

    When I run a report for Management 3 - Updates in a deployment, SCCM will generate all the data except in a few areas.  On the main report I get #Error in Collection Name, then if I click on a particular update I get #Error for all 3 states.  If I go

  • Zen MicroPhoto not playing tracks in proper ord

    Hey all, Just got this player and it is pretty good. Having one problem though. Some albums do not play songs in the proper order. Instead they are played in alphabetical order. I checked the tag information on the player and it reads the tracks as h