Parsing attribute value using dbms_xslprocessor

Hi,
We have a xmltype column which has the following structure :
<?xml version="1.0" encoding="utf-16"?>
<myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
<PayToTheOrderOf>TESTING</PayToTheOrderOf>
<AllocationList>
<Allocation d3p1:LineNum="0" xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
<d3p1:Name>ANNE PETER</d3p1:Name>
<d3p1:StreetAddress2>600 N WEST ST</d3p1:StreetAddress2>
<d3p1:City>BALTIMORE</d3p1:City>
<d3p1:State>MD</d3p1:State>
</Allocation>
<Allocation d3p1:LineNum="1" xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
<d3p1:Name>DAVID GREY</d3p1:Name>
<d3p1:StreetAddress2>EAST AVE</d3p1:StreetAddress2>
<d3p1:City>4</d3p1:City>
<d3p1:State>MD</d3p1:State>
</Allocation>
</myFields>"
Can anyone tell me how to parse the attribute value from the tag, "Allocation". Example: I would like to get the value from "LineNum" attribute. I would like to use dbms_xslprocessor in pl/sql.
Thanks in advance.

DECLARE
l_return xmltype;
l_num VARCHAR2 (10);
l_namespace1 VARCHAR2(200) := 'xmlns="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30"';
l_namespace2 VARCHAR2(200) := 'xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30"';
l_parser dbms_xmlparser.parser;
l_doc dbms_xmldom.domdocument;
l_nl dbms_xmldom.domnodelist;
l_n dbms_xmldom.domnode;
BEGIN
SELECT xmltype('<?xml version="1.0" encoding="utf-16"?>
<myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
     <PayToTheOrderOf>TESTING</PayToTheOrderOf>
     <AllocationList>
          <Allocation d3p1:LineNum="0" xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
               <d3p1:Name>ANNE PETER</d3p1:Name>
               <d3p1:StreetAddress2>600 N WEST ST</d3p1:StreetAddress2>
               <d3p1:City>BALTIMORE</d3p1:City>
               <d3p1:State>MD</d3p1:State>
          </Allocation>
          <Allocation d3p1:LineNum="1" xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
               <d3p1:Name>DAVID GREY</d3p1:Name>
               <d3p1:StreetAddress2>EAST AVE</d3p1:StreetAddress2>
               <d3p1:City>4</d3p1:City>
               <d3p1:State>MD</d3p1:State>
          </Allocation>
     </AllocationList>
</myFields>')
INTO l_return
FROM dual;
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_return.getclobval());
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_xmlparser.freeParser(l_parser);
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/myFields/AllocationList/Allocation', l_namespace1);
FOR i IN 1 .. dbms_xmldom.getLength(l_nl) LOOP
l_n := dbms_xmldom.item(l_nl, i-1);
dbms_xslprocessor.valueOf(l_n,'@d3p1:LineNum',l_num, l_namespace2);
dbms_output.put_line(l_num);
END LOOP;
dbms_xmldom.freeDocument(l_doc);
END;

Similar Messages

  • Oracle XML DOM parser - attribute values are not printing on the screen ??

    Hi Everyone,
    I am just trying to use oracle DOM parser to paerse one of my xml file, java file can be compiled and run agianst a xml file, But I cannot see any attribute values printing on the screen..
    Appreciate if anyone can help, where I have gone wrong please?
    Below is the java file:
    // menna puthe DOMSample eka - duwanawa 19/12/2005
    import java.io.*;
    import java.net.*;
    import org.w3c.dom.*;
    import org.w3c.dom.Node;
    import oracle.xml.parser.v2.*;
    public class DOMSample {  //public class eka ***
    static public void main(String[] argv){  // main method eka ###
    try {
    if (argv.length != 1){
    // Must pass in the name of the XML file...
    System.err.println("Usage: java DOMSample filename");
    System.exit(1);
    // Get an instance of the parser
    DOMParser parser = new DOMParser();
    // Generate a URL from the filename.
    URL url = createURL(argv[0]);
    // Set various parser options: validation on,
    // warnings shown, error stream set to stderr.
    parser.setErrorStream(System.err);
    parser.showWarnings(true);
    // Parse the document.
    parser.parse(url);
    // Obtain the document.
    Document doc = parser.getDocument();
    // Print document elements
    System.out.print("The elements are: ");
    printElements(doc);
    // Print document element attributes
    System.out.println("The attributes of each element are: ");
    printElementAttributes(doc);
    catch (Exception e){
    System.out.println(e.toString());
    } // main method eka ###
    static void printElements(Document doc) {
    NodeList nl = doc.getElementsByTagName("*");
    Node n;
    for (int i=0; i<nl.getLength(); i++){
    n = nl.item(i);
    System.out.print(n.getNodeName() + " ");
    System.out.println();
    static void printElementAttributes(Document doc){
    NodeList nl = doc.getElementsByTagName("*");
    Element e;
    Node n;
    NamedNodeMap nnm;
    String attrname;
    String attrval;
    int i, len;
    len = nl.getLength();
    for (int j=0; j < len; j++){
    e = (Element)nl.item(j);
    System.out.println(e.getTagName() + ":");
    nnm = e.getAttributes();
    if (nnm != null){
    for (i=0; i<nnm.getLength(); i++){
    n = nnm.item(i);
    attrname = n.getNodeName();
    attrval = n.getNodeValue();
    System.out.print(" " + attrname + " = " + attrval);
    System.out.println();
    static URL createURL(String filename) {  // podi 3 Start
    URL url = null;
    try {
    url = new URL(filename);
    } catch (MalformedURLException ex) { /// BBBBBB
    try {
    File f = new File(filename);
    url = f.toURL();
    } catch (MalformedURLException e) {
    System.out.println("Cannot create URL for: " + filename);
    System.exit(0);
    } // BBBBBB
    return url;
    } // podi 3 End
    } //public class eka ***
    // End of program
    output comes as below:
    Isbn:
    Title:
    Price:
    Author:
    Message was edited by:
    chandanal

    Hi Chandanal,
    I edited your code slightly and I was able to get the correct output.
    I changed the following line:
    for (int j=0; j >< len; j++)to:
    for (int j=0; j < len; j++)I have included the complete source below:
    // menna puthe DOMSample eka - duwanawa 19/12/2005
    import java.io.*;
    import java.net.*;
    import org.w3c.dom.*;
    import org.w3c.dom.Node;
    import oracle.xml.parser.v2.*;
    public class DOMSample {
        //public class eka ***
        public static void main(String[] argv) {
            // main method eka ###
            try {
                if (argv.length != 1) {
                    // Must pass in the name of the XML file...
                    System.err.println("Usage: java DOMSample filename");
                    System.exit(1);
                // Get an instance of the parser
                DOMParser parser = new DOMParser();
                // Generate a URL from the filename.
                URL url = createURL(argv[0]);
                // Set various parser options: validation on,
                // warnings shown, error stream set to stderr.
                parser.setErrorStream(System.err);
                parser.showWarnings(true);
                // Parse the document.
                parser.parse(url);
                // Obtain the document.
                Document doc = parser.getDocument();
                // Print document elements
                System.out.print("The elements are: ");
                printElements(doc);
                // Print document element attributes
                System.out.println("The attributes of each element are: ");
                printElementAttributes(doc);
            } catch (Exception e) {
                System.out.println(e.toString());
        // main method eka ###
        static void printElements(Document doc) {
            NodeList nl = doc.getElementsByTagName("*");
            Node n;
            for (int i = 0; i < nl.getLength(); i++) {
                n = nl.item(i);
                System.out.print(n.getNodeName() + " ");
            System.out.println();
        static void printElementAttributes(Document doc) {
            NodeList nl = doc.getElementsByTagName("*");
            Element e;
            Node n;
            NamedNodeMap nnm;
            String attrname;
            String attrval;
            int i, len;
            len = nl.getLength();
            for (int j = 0; j < len; j++) {
                e = (Element)nl.item(j);
                System.out.println(e.getTagName() + ":");
                nnm = e.getAttributes();
                if (nnm != null) {
                    for (i = 0; i < nnm.getLength(); i++) {
                        n = nnm.item(i);
                        attrname = n.getNodeName();
                        attrval = n.getNodeValue();
                        System.out.print(" " + attrname + " = " + attrval);
                System.out.println();
        static URL createURL(String filename) {
            // podi 3 Start
            URL url = null;
            try {
                url = new URL(filename);
            } catch (MalformedURLException ex) {
                /// BBBBBB
                try {
                    File f = new File(filename);
                    url = f.toURL();
                } catch (MalformedURLException e) {
                    System.out.println("Cannot create URL for: " + filename);
                    System.exit(0);
            // BBBBBB
            return url;
        // podi 3 End
    } //public class eka ***-Blaise

  • Selcect/ update attribute value using xpath navigator/ linq to xml

    Hi Folks,
    below is my xml string and the highlighted bold attribute value needs to update. Since this element contains prefix im not able to select teh particular element. if i remove the prefixx im able to select but i need to keep prefix.
        <IOP:MtvnSvcReq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:IOP="mtvnCWExternInteropReq" xmlns:IOP1="mtvnExtInteropReqData" xmlns:PR1="mtvnPRInteropReqData">
                              <IOP:Svc>
                                                 <IOP1:PR1>
                                                       <PR1:PRExternSSOReqData>
    <PR1:UserId>abcd</PR1:UserId>
                                                       </PR1:PRExternSSOReqData>
                                                 </IOP1:PR1>
                                </IOP:Svc>
                        </IOP:MtvnSvcReq>
    Thanks 

    Hi Pulikk,
    Do you mean you want  to change the attribute value(abcd)? If so,
    Please try the following code, i tested on my side, it changed successfully.
    //Here is the variable with which you assign a new value
    string newValue = string.Empty;
    XDocument objDoc = XDocument.Load(@"yourdata.xml");
    XNamespace IOP = "mtvnCWExternInteropReq";
    XNamespace IOP1 = "mtvnExtInteropReqData";
    XNamespace PR1 = "mtvnPRInteropReqData";
    foreach (var node in objDoc.Descendants(PR1 + "UserId"))
    node.Value = newValue;
    objDoc.Save(@"yourdata.xml");
    Have a nice day!
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Error when replacing attribute value using LDAPConnection.modify()

    I am using Directory SDK 4.1 from netscape. I am trying to replace/modify the value of an attribute for a particular dn. Below is the code:
    LDAPConstraints constraints = new LDAPConstraints();
    constraints.setReferrals(true);
    LDAPAttribute attribute = new LDAPAttribute("passwordexpwarned","1");
    LDAPModification mod = new LDAPModification
    (LDAPModification.REPLACE , attribute);
    getLDAPConnection().modify(dn, mod,constraints);
    Automatic Referral Handling is enabled and I want to use to anonymous authentication. When I run the code, I get the following error:
    java.lang.ClassCastException: netscape.ldap.LDAPConstraints     at netscape.ldap.LDAPConnection.performReferrals(LDAPConnection.java:5057)
    at netscape.ldap.LDAPConnection.modify LDAPConnection.java:3121)
    at netscape.ldap.LDAPConnection.modify(LDAPConnection.java:2981)
    at PasswordExpiration.setPasswordWarnedAttribute(PasswordExpiration.java:305)
    Has anyone encountered the same error or could anyone provide me some input on what could be the reason for the error? I would greatly appreciate any help in this matter.
    Thanks for your time.

    you must use LDAPSearchConstraints instead of LDAPConstraints;
    the reason is a minor but awkward bug in LDAPJDK;

  • Set attribute value using plugins

    Hi Experts,
    I am facing error when setting the value of attribute in the event "OnInvestigationStartedEvent". Any suggestion to fix the issue
    code:
                Session ses = onInvestigationStartedEvent.getSessionContext().getInterviewSession().getRuleSession();
                Attribute start = ses.getGlobalEntityInstance().getEntity().getAttribute("test_start_time");
                Date start_date = new Date();
                start.setValue(ses.getGlobalEntityInstance(), start_date);
    Error:
    25750 [http-apr-8080-exec-9] INFO com.oracle.determinations.engine.Session  - User setting attribute test_start_time, entity global, instance name global, session 1 to value 7/21/13 2:17 PM
    25752 [http-apr-8080-exec-9] ERROR com.oracle.determinations.web.platform.templatingengine.ErrorRenderer  - A unauthorised change to the Rule Session has been detected.
    com.oracle.determinations.interview.engine.exceptions.CorruptSessionException: A unauthorised change to the Rule Session has been detected.
      at com.oracle.determinations.interview.engine.data.local.RuleSessionManager.checkSessionIntegrity(RuleSessionManager.java:760)
      at com.oracle.determinations.interview.engine.data.local.RuleSessionManager.getRuleSession(RuleSessionManager.java:144)
      at com.oracle.determinations.interview.engine.local.LocalInterviewSession.getRuleSession(LocalInterviewSession.java:203)
      at com.oracle.determinations.interview.engine.data.model.InterviewEntityInstanceIdentifier.findEntityInstance(InterviewEntityInstanceIdentifier.java:73)
      at com.oracle.determinations.interview.engine.local.AttributeGoal.getNextScreen(AttributeGoal.java:112)
      at com.oracle.determinations.interview.engine.local.LocalInterviewSession.getNextScreen(LocalInterviewSession.java:222)
      at com.oracle.determinations.web.platform.controller.actions.InvestigateAction.getResource(InvestigateAction.java:65)
      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServlet.doGet(WebDeterminationsServlet.java:112)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.oracle.determinations.web.platform.util.CharsetFilter.doFilter(CharsetFilter.java:46)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
    Thanks,
    Vinay

    Vinay,
    When working in an Interview Engine event handler, you need to use Interview Engine objects to set values. Have a look at the example "Use the OnInterviewSessionCreatedEvent to pre-seed data into a newly created session" in the "Oracle Policy Automation Developer's Guide"
    Your code should look something like:
    // get the globalInstance from a new InterviewUserData;
    InterviewUserData data = new InterviewUserData();
    InterviewEntityInstance globalInstance = data.getGlobalInstance();
    // set the test_start_time
    Date start_date = new Date();
    globalInstance.setValue("test_start_time", start_date );
    // submit the data to the Interview session.
    TransactionResult result = session.submit(data);
    Hope this helps.
    Cheers
    Frank

  • How to pass a VO attribute value using Page Level button

    Hi Gurus,
    Consider the Sinple Page having a information header seaction (having name, ID (form value), and status) and one details section.this page has a page button bar having one button (say XYZbtn).
    Requirment : when the user clicks on the XYZbtn , this should navigate the user to another page and passing the ID as the parameter.
    Note : As we are not modifying the CO, so we cannot write code in PFR() to redirect.
    So we have added a button XYZbtn (using customization) and set its destination URI property as OA.jsp?page=/myorg/oracle/apps/../../../webui/NewPG&ID={@ID}
    This takes the user to newPG but passes null for ID
    Tell me pls, how can we pass the value of ID to another page using a button (or link) 's Destination URI property, how do we send this value ?
    thanks
    Chaitanya

    You can pass id as url parametre like :
    /myorg/oracle/apps/../../../webui/NewPG&ID=xxx
    and retrieve the parametre value in second page in process request of controller like
    string s=pageContext.getParameter("ID");
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Verify existing multivalued attribute values using powershell

    I am writing a powershell script which will add value to a multivalued reference attribute ( This multivalued reference attribute name is "Admins" and is binded to person object). 
    Suppose I am adding value "Test"(Reference attribute) to multivalued reference attribute ("Admins").
    I want to check whether the value  "Test" is already present in "Admins" before adding this value to multivalued reference attribute ("Admins"). Can someone please guide me on this.

    Function AddMultivalue also ignore update if the value is present :)
    function AddMultiValue
    PARAM($ImportObject, $AttributeName, $NewAttributeValue, $FullyResolved=1)
    END
    $ImportChange = CreateImportChange -AttributeName $AttributeName -AttributeValue $NewAttributeValue -Operation 0
    $ImportChange.FullyResolved = $FullyResolved
    AddImportChangeToImportObject $ImportChange $ImportObject

  • Getting the following error while parsing the values usng xml parser

    Hi
    I am getting the following error while parsing the values using the code in r12 instance on linux
    declare
    XML_PARSER XMLPARSER.PARSER;
    DOC XMLDOM.DOMDOCUMENT;
    DOCELEMENT DBMS_XMLDOM.DOMELEMENT;
    BEGIN
    -- NEW PARSER
    XML_PARSER := XMLPARSER.NEWPARSER;
    -- SET SOME CHARACTERISTICS
    XMLPARSER.SETVALIDATIONMODE(XML_PARSER, FALSE);
         IF P_DIR IS NOT NULL AND P_FILENAME IS NOT NULL
         THEN
         FND_FILE.PUT_LINE(FND_FILE.LOG,'DIRECTORY FOUND'||'-'||P_DIR);
         XMLPARSER.SETBASEDIR(XML_PARSER, P_DIR);     
         -- PARSE INPUT FILE
         FND_FILE.PUT_LINE(FND_FILE.LOG,'FILE FOUND'||'-'||P_FILENAME);
         XMLPARSER.PARSE(XML_PARSER, P_DIR || '/' || P_FILENAME);     
         -- GET DOCUMENT
         DOC := XMLPARSER.GETDOCUMENT(XML_PARSER);
         LOAD_SUPP(doc);
         ELSE
         DBMS_OUTPUT.PUT_LINE('DIRACTORY/FILENAME CANNOT BE NULL');
         END IF;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('DATA NOTINSERTED'||sqlerrm);
         ROLLBACK;
    END
    I am getting the following error
    DIRACTORYL-/home/appldevORA-0000: normal, successful completion
    FILE NAME-suppliersample_data.xmlORA-0000: normal, successful completion
    DATA NOTINSERTEDORA-31001: Invalid resource handle or path name "/home/appldev/suppliersample_data.xml"
    ORA-06512: at "SYS.XDBURITYPE", line 11
    ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 142
    ORA-29280: invalid directory path
    ORA-29280: invalid directory path
    ORA-29280: invalid directory path
    It could be great if some one could give a suggestion/solution.
    Thanks
    Ajesh

    Besides this is not the correct forum try to google the error message first before posting:
    http://ora-29280.ora-code.com/
    cheers

  • ORA-03113 when using dbms_xslprocessor.valueof()

    I have just recently started using the 9.2.0.2 functionality, and am having great difficulty in getting dbms_xslprocessor.valueof() to work correctly.
    I am aware of two known issues with this procedure.
    1) the necessitaty of including '\text()' on the end of the XPATH e.g.
    dbms_xslprocessor.valueof(v_employee_node,'LASTNAME',emp_rec.lastname);
    would cause a ORA-03113 error and kill the session, while
    dbms_xslprocessor.valueof(v_employee_node,'LASTNAME/text()',emp_rec.lastname);
    works and returns the correct node value.
    2) An empty element will cause the ORA-03113 error.
    I have two further questions:-
    1) I do not seem to be able to retrieve attribute value using the procedure - for example, assuming I have an element EMPLOYMENT, which has the attribute EMPLSTAT, I could have run the following using XDK to get back the value (assuming I had determined the v_employment_node first):-
    emp_rec.emplstat := xslprocessor.valueof(v_employment_node,'@EMPLSTAT');
    But running the equivalent in dbms_xlsprocessor:-
    dbms_xslprocessor.valueof(v_employment_node,'@EMPLSTAT',emp_rec.emplstat);
    gives me the ORA-03113, regardless of whether I include the '\text()' reference or not.
    Is this issue down to a lack of understanding on how the functionality works in 9i, or is there a bug? If it is my ignorance, then an example of how to do this would be appreciated.
    2)Are these issues known with Oracle, and if so when will a bug fix be released?
    Thanks in advance,
    Dave.

    OK I now use xmlagg & xmlelement instead of connect by.
    Sorry for not providing any solution.
    Yann.

  • Update attribute value in xml db in Oracle 10g

    I have a table with XML blob data
    The root element is invoice with an element billInfo and attribute type0
    I'm trying to update the attribute value using the following sql but it is not working.
    the sql goes to sucess but the value is not updated.
    Looking for a solution and I appreciate your help
    update sc.table_name
    set xml_cb= updateXML(xml_cb,'/invoice/billInfo/@type0','A')
    where id = 1 succeeded.
    select id,
    extractValue(xml_cb,'/invoice/billInfo/@type0') type_val
    from sc.table_name
    where id =1;
    ID TYPE_VAL
    1 K

    What database version are you using?
    could you show us the outcome of:
    SQL> select dbms_metadata.get_ddl('TABLE','TABLE_NAME','SC') from dual;
    and/or a
    SQL> describe SC.TABLE_NAME

  • JSP 1.2: jsp expression in attribute value doesn't parse.

    Hi, I'm trying to use a jsp:expression in an html attribute value in JSP 1.2 but jasper doesn't seem to be able to parse it correctly. I'm using the XML syntax in my jsp, the relevant snippets are as follows:
    <jsp:scriptlet>
    String versionedPath = "/mysite/2.1/images";
    </jsp:scriptlet>
    <img src="%= versionedPath %/foo.jpg" />
    The JSP documentation claims that this will work but I'm beginning to think this syntax won't work when using JSP's XML syntax. I already know that the following won't work:
    <img src="<jsp:expression> versionedPath </jsp:expression>/foo.jpg" />
    as it did in JSP 1.1 because it's not well-formed xml.
    Is it even possible to use jsp expressions in attribute values when using JSP 1.2's XML syntax? If so, please enlighten me, and if not, well, that seems pretty broken to me.
    TIA...
    --Stuart

    you should use this:
    <img src=<%= versionedPath %>/foo.jpg >

  • Parsing XML data stored as CLOB in DB and save attribute values in table

    Hello,
    I have a CLOB column in table that is holding XML data as follows,
    <banners>
    <banner-image id="0">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>www</click-through-url>
    <make>Acura</make>
    </banner-image>
    <banner-image id="1">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>gfrty</click-through-url>
    <make>BMW</make>
    </banner-image>
    </banners>
    Now I need to parse thru the above XML data and pull the attribute values to store in another table as follows,
    BANNER_IMAGE_ID | TYPE | LOCAL_PATH | CLICK_URL | MAKE
    0 | BANNER | http.gif | www | Acura
    1 | BANNER | http.gif | gfrty | BMW
    And XML data doesn't always end up with 2 rows in this table....some times it may be 3 or 4 as well. It is just that in this example it ended up with 2 rows.
    So, I would appreciate if someone can help me find a generic way of doing this,
    Thank you in advance,
    Madhu.

    This is not a reply.. sorry.
    I took have a similar problem only..
    can you pls help me
    XML structure.
    <PODetails>
    <POHeader>
    <CurrencyID>INR</CurrencyID>
    <ExchangeRate>1</ExchangeRate>
    <RefNo>0080000110</RefNo>
    <VendorID>1200</VendorID>
    <TransDate>2006-12-20</TransDate>
    <DocRelationshipId>PURCHASE</DocRelationshipId>
    <LocationID>0000102327</LocationID>
    </POHeader>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>L HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>3.000</Quantity>
    <PriceValue>2509.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>M HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>2.000</Quantity>
    <PriceValue>1673</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1556</ItemID>
    <Size>39FS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>1.000</Quantity>
    <PriceValue>836.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    </PODetails>
    The DB is ORACLE 9i
    This is stored in a XML table of type XMLTYPE.
    THIS I USED THE .extract function to get the values of the nodes.
    POHeader details are working fine. But when i get the POItemDetails i am getting 'ARSH1332ARSH1332ARSH1556' when i issue the command
    select a.extract('/PODetails/POItemDetails/ItemID/text()').getStringVal() ItemID
    FROM xmltable a
    WHERE a.existsnode('//POItemDetails/ItemID')=1
    Pls Help..
    Regds,
    Santhoshkumar.G.

  • XElement parser does not ignore entity tokens in attribute value

    I have sample XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <name id="show_file.php?fid=120983&action=download" />
    </root>
    I use simple C# console application to dump the content of this XML:
    static void Main(string[] args)
    var xmlPath = @"c:\test.xml";
    var xml = XElement.Load(xmlPath);
    Console.WriteLine(xml.ToString());
    However, an error occurs:
    An unhandled exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
    Additional information: '=' is an unexpected token. The expected token is ';'
    The error points to "=" sign here "&action=". I looked up the stack trace:
    System.Xml.XmlException was unhandled
      HResult=-2146232000
      Message='=' is an unexpected token. The expected token is ';'. Line 67, position 93.
      Source=System.Xml
      LineNumber=67
      LinePosition=93
      SourceUri=""
      StackTrace:
           at System.Xml.XmlTextReaderImpl.Throw(Exception e)
           at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
           at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(String expectedToken1, String expectedToken2)
           at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(Int32 pos, String expectedToken1, String expectedToken2)
           at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
           at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
           at System.Xml.XmlTextReaderImpl.ParseAttributes()
           at System.Xml.XmlTextReaderImpl.ParseElement()
           at System.Xml.XmlTextReaderImpl.ParseElementContent()
           at System.Xml.XmlTextReaderImpl.Read()
           at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
           at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
           at System.Xml.Linq.XElement.ReadElementFrom(XmlReader r, LoadOptions o)
           at System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options)
           at System.Xml.Linq.XElement.Parse(String text, LoadOptions options)
           at System.Xml.Linq.XElement.Parse(String text)
           at ConsoleApp.Program.Main(String[] args) in D:\Projects\ConsoleApp\Program.cs:line 21
    The point of interest is System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos). As I understand, Xml searches for entity tokens in attribute value. But
    is it mandatory? I think I can store in attribute value ANY characters and their combinations as far as I use parenthesis. Am I right?
    There is no knowledge that is not power.

    @syedfasih
    By the way, XMLSpy program shows same error. It says that my XML is not well-formed. As you see from exception, there's a method call System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean
    isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos) which has isInAttributeValue argument, which apperently regulates whether check entity tokens in attribute values. I can conclude from this that this can be controlled somehow,
    but don't know how.
    There is no knowledge that is not power.

  • Not getting attribute values in IPC routines Scenerio R/3 B2B using AP 7.0

    Hi,
    Our Scenerio is using ISA R/3 B2B using AP 7.0. I have developed IPC routines but when i debug my routines in SM53 I notice that I'm not getting any attribute value except for VKORG.
    I'm pasting the code below. Please help me if I have to implement some BADI or do something more to get the attribute values.
    I have defined the attributes properly in Routine assignment in tcode /n/sapcnd/ueass
    userexitlogger.writeLogDebug("*requirment 901*" + "Plant = "plant"||ANZ_MONATE ="+ item.getAttributeValue(ANZ_MONATE_STR).toString()"||ANZ_JAHRE="item.getAttributeValue(ANZ_JAHRE_STR).toString()"||MATKL="item.getAttributeValue(MATKL_STR).toString()"||PSTYV="item.getAttributeValue(PSTYV_STR).toString()"||VKORG="item.getAttributeValue(VKORG_STR)"||PRSFD="item.getAttributeValue(PRSFD_STR)"||MVGR2="item.getAttributeValue(MVGR2_STR).toString()"||PRSDT="item.getAttributeValue(PRSDT_STR).toString()"||AUDAT="item.getAttributeValue(AUDAT_STR).toString());
    I would reward points for help
    Many Thanks n regards,
    Dipender

    I would like to go through each Value of the xml file and give each Value a name
    e.g. from the xml file <VentCount Value=1> Retreive the value above and giving it the name VentCount. Then I would beable to use the name vent count as follows:
    setVentCount() //My own method can use as follows: setVentCount(VentCount); I would like to do his for ever value, each value with a specific name

  • Getting the attribute value from a table from page def using el expression.

    Hi,
    Am using Jdeveloper 11.1.2.0.0 and have a requirement as follows for which a sample is been created. Requirement is as follows..
    1. Have a Taskflow that has a readonly table Employee.
    2. On clicking of a button called "route" checks if the selected row , Manager id attribute value = 200 then navigate to first page else if manager id attribute value is 200 then navigate to second page.
    Through the page def , if it has form , then we can access the attributes like #{data.view_FirstPageDef.ManagerId} . In case of acquiring the same attribute value from table using page def ? is what am unable to get..
    Have achieved the routing concept using the Router activity on Taskflow. But am unable to get the selected row attribute value of a table from the employee page def.. Can someone suggest on the same...
    Thanks and Regards,
    Vinitha G

    On the router, right click its icon in the task flow and create a page definition. Then in the page def file, add an iterator based on the same View Object from the table in the first page, then add a value attribute mapped to managerId in the View Object iterator. Finally in the router you can write EL expressions along the lines of #{bindings.ManagerId.inputValue = 200} or #{bindings.ManagerId.inputValue != 200}.
    CM.

Maybe you are looking for