Format String using XML attributes

I need to format a string based on attributes from a schema. I am attempting to do this using an Assign activity and the java embedded format string function. Here is a simplified version of what I am trying to do:
oraext:format-string('Service Error COD={0}', bpws:getVariableData('caXMLError','/CAXMLERROR/CLIERR/@COD'))
When I execute this line I get:
XPath expression failed to execute. An error occurs while processing the XPath expression; the expression is oraext:format-string('Service Error COD={0} ',bpws:getVariableData('caXMLError','/CAXMLERROR/CLIERR/@COD')). The XPath expression failed to execute;
The value at bpws:getVariableData('caXMLError','/CAXMLERROR/CLIERR/@COD' is valid because I can create a dummy xsd:string variable and set it equal to that.
I also tried to wrap the getVariableData with the get_content_as_string methods and neither worked. I also verified that my format-string function is working because when I substitute just a plain string like ‘T01’ the string is successfully created.
Any ideas what I am doing wrong or how I can accomplish this?

If the xml document is to be stored in the Oracle database with the XML SQL Utility, defne elements instead of attributes. XSU utility does not map the attributes of an xml document to the database table.
Further ref:
http://xml.coverpages.org/elementsAndAttrs.html

Similar Messages

  • How to extract a tagged string using XML in sql server 2014?

    A column stores the string data with tag as below.I have to retrieve the value of ATRB_C1 as val1234 through xml
    Query:
    CREATE TABLE #test (col varchar(500))
    INSERT INTO #test VALUES('< ATRB_C value ="val1" />< ATRB_C1 value ="val234" />')
    SELECT * FROM  #test FOR XML RAW
    Output:
    <row col="&lt; ATRB_C value =&quot;val1&quot; /&gt;&lt; ATRB_C1 value =&quot;val234&quot; /&gt;" />
    Since the format is incorrect, not able to extract using xml.value
    Any help would be appreciated!!

    CREATE TABLE #test (col xml)
    INSERT INTO #test(col) VALUES('<ATRB_C value ="val1"/><ATRB_C1 value ="val234" />')
    SELECT * FROM #test
    Select Col1.value('(@value)[1]','varchar(20)') as [tab1_col1],col2.value('(@value)[1]','varchar(20)') as [tab2_col2]
    from #test cross apply col.nodes('/ATRB_C') as tab1(col1)
    cross apply col.nodes('/ATRB_C1') as tab2(col2)
    drop table #test
    Hope it Helps!!

  • Load associate format string using DLR

    Hi,
    I'm trying to load an associate format string with a DLR from a text datafile.
    My DLR has been built like this :
    PARENT0,Account CHILD0, Account ALIAS0,Account PROPERTY0,Account PROPERTY0,Account PROPERTY0,Account
    Father Child Alias Store ^ mdxformat(...)
    The mdxformat(...) code works fine when I add it manually in the outline via EAS
    But everytime I load with a DLR I got this error message
    \\Record #23 - Error adding Dynamic calc property to member Child (3320)
    \\Record #23 -      Level 0 virtual members must have a formula associated with them
    I'm using Essbase 11.1.2
    I removed the mdxformat from my datafile and the member is load properly.
    Regards,
    Franck

    Finally no solution, I added it manually

  • To format string like xml

    Hi,
    i have a string which has a xml content:
    String myXML = "<xml><test>Test</test></xml>";
    With log4j i produce a trace file with the output of String a: Log.info(myXML);
    Unfortunately the content of xml data is verly long and its difficult to read it.
    I would like to have the string to be xml formatted like:
    <xml>
    <test>Test</test>
    </xml>
    how to manage it?
    Thanks

    Your best bet might to be getting a 'tidy' program for xml. Most xml editors can very cleanly re-structure xml to collapsible nodes.
    Also you could try some proactive logging logic;
    after a closing tag, add a \n to return a new line, this will help most editors make it display nicely.

  • Parsing String to XML Attribute bug

    Hello!
    I'm trying to convert String to org.w3c.dom.Document with javax.xml.parsers.DocumentBuilder, but when I check my XML Document after creating, I find that all the Attributes are like "" or "&#xa; ". Does anyone have some idea why that problem is and how it can be solved?
    Thanks a lot!
    Svigi

    There are lots of bug reports about Java 5's built-in XML parser screwing up on attribute values. Try forcing Java to use the current version of Xerces (download it) instead of whatever it has built in, if that seems to apply to you. On the other hand it's possible that the bug is in your code too.

  • Format string using Regular Expression

    Input string output format...
    SELECT q'<select ab_c "ABC", efg "EFG" from dual>' str FROM DUAL
    Output:
    STR                                 
    select ab_c "ABC", efg "EFG" from dual
    Required output format using regular expression...
    STR                                 
    select 'ab_c' "ABC", 'efg' "EFG" from dual

    Regular expressions have many limitations as parsing tools, and you didn't specify the rules you wanted. This expression puts quotes around the non blank string before a quoted string:
    SELECT regexp_replace(q'<select ab_c "ABC", efg "EFG" from dual>',
                          '([^" ]+)( +"[^ ]*")' , '''\1''\2' ) str FROM DUAL;
    STR
    select 'ab_c' "ABC", 'efg' "EFG" from dual
    {code}
    It is not robust - a missing " will confuse it, and you should be using bind variables anyway.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • File-Adapter: Variable substitution form payload XML-attribute

    Hi experts,
    is possible to use XML-attribute-content for variable substitution in file-Adapter?
    extract from XML:
    <?xml version="1.0" encoding="utf-8" ?>
    - <all>
    - <transaction <b>file="filename"</b>>
    - <table name="BPAADDRESS" options="insertIfUpdateFails">
    - <record id="1">
      <hkeycol name="BPAMAINHKEY">0010500345</hkeycol>
      <hkeycol name="USAGE">Invoice</hkeycol>
      </transaction>
    I want to get the value "filename" = attribute file of transaction.
    Is this possible?
    Thanks a lot,
    Florian

    I have done this taking a field from the XML.
    You have to map the location of the field within the XML...
    Taken from:
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm
    Variable Substitution (Target Directory/File Name Scheme)
    If you set the Enable indicator, you can enter variables for the Target Directory and File Name Scheme. Enter the names of the variables and references in the table.
    &#9679;      Enter each variable that you reference in the Target Directory and File Name Scheme fields without the surrounding percentage sign under Name of Variables in the table.
    The variables can refer to attributes of the message header or elements of the message payload.
    &#9675;       If the variables are to refer to an attribute of the message header, add the prefix message: to the name of the variable under Reference. You can specify the following attributes of the message header:
    sender_party, sender_service, receiver_party, receiver_service, interface_name, interface_namespace,
    message_id (message ID with hyphens, for example 9fbe1ff1-9a0d-11d9-8665-cbf10a126331)
    message_id_hex (message ID in hexadecimal format, for example 9fbe1ff19a0d11d98665cbf10a126331)
    For example, if you want to specify the interface name from the message header in the target directory or in the file name scheme, enter message:interface_name as the reference.
    If one of the message attributes contains characters that are not permitted in a file name, for example \, /, :, *, ?, ", <, >, |, then these characters are replaced by an underscore ("_").
    &#9675;       If the variable refers to an element in XML schema, add the prefix payload: to the information under Reference. The reference then comprises a pseudo path description in the form of a comma-separated list with the schema namea,na,nameb,nb,....
    namea,nameb,... corresponds to the element name and na,nb,... corresponds to the occurrence of the element name at the respective level in the document.
    The description begins at the root of the document and ends at the respective element.
    To reference the element that is in bold in the example, the following expression is used: payload:root,1,e1,1,e2,2
    The parser searches for the first occurrence of the root element at the first level. It then searches for the first occurrence of e1 at the second level and for the second occurrence of e2 at the third level. The content of the last element (“Example Value”) is set as the value for a specified variable.
    <?xml version="1.0" encoding="UTF-8" ?>
    <root>
      <dummy>
         <e1>
            <e2>Data_1</e2>
            <f/>
            <g attr="abc">text</g>
            <e2>Data_2</e2>
         </e1>
      </dummy>
      <e1>
         <e2>illegal/value</e2>
         <f/>
         <g attr="abc">text</g>
         <e2 attr="fghij">Example Value</e2>
      </e1>
    </root>
    &#9679;      To disable the check the adapter performs for the element data, set the Disable Security Checks indicator.
    Otherwise, the adapter checks whether the element data contains characters that could lead to security risks in the file system environment. The check includes the characters “/“, “\“, and “..“.

  • XML attributes as a response

    My skills are rudimentary, I'm a new flex developer. I have
    done all of the tutorials and examples and I'm just struggling with
    using an XML attribute checking a response.
    I've written a simple flex 3 app to talk to Asterisk AJAM.
    I'm writing the login piece-- and i'm having trouble parsing this
    response from an http service (successful login) my problem comes
    in with the value not being as such
    <item>valuehere</item> it's part of the tag, an
    attribute i would suppose.:
    <ajax-response>
    <response type="object" id="unknown">
    <generic response="Success" message="Authentication
    accepted"/>
    </response>
    </ajax-response>
    What I have is a simple app with a http service and a login
    form. I have an event handler for the HTTP service, but I don't
    know how to parse for that generic response tag. Anyone know how to
    format an XML object for that type of response and throw a simple
    if statement looking for that attribute?
    Failure looks like this BTW:
    <ajax-response>

    <response type="object" id="unknown">
    <generic response="Error" message="Authentication
    failed"/>
    </response>
    </ajax-response>
    Thank you,
    Brian

    I've came up with the following code trying to use XML
    attributes from the response above--- it doesn't work but here is
    what I have (right now the if statement is commented out.... i'm
    trying to have it do an alert which doesn't work either):
    ---source---
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:states>
    <mx:State name="Logged In">
    <mx:SetProperty target="{panel1}" name="width"
    value="95%"/>
    <mx:SetProperty target="{panel1}" name="height"
    value="95%"/>
    <mx:RemoveChild target="{password}"/>
    <mx:RemoveChild target="{username}"/>
    <mx:RemoveChild target="{label1}"/>
    <mx:RemoveChild target="{Submit}"/>
    <mx:RemoveChild target="{label2}"/>
    <mx:SetProperty target="{panel1}" name="title"
    value="Once Logged In"/>
    <mx:AddChild relativeTo="{panel1}"
    position="lastChild">
    <mx:Label x="10" y="10" text="You properly
    authentictaed!"/>
    </mx:AddChild>
    <mx:AddChild relativeTo="{panel1}"
    position="lastChild">
    <mx:Label x="10" y="62" text="Label"/>
    </mx:AddChild>
    </mx:State>
    </mx:states>
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    var MyXML:XML;
    private function checkLogin(evt:ResultEvent):void
    MyXML = evt.result.channel.item;
    mx.controls.Alert.show(MyXML.@*);
    trace(MyXML.@*.toXMLString());
    /* if (MyXML.attribute(ajax-response.response.@generic) ==
    "Success") {
    if (MyXML.ajax-response.response.(@generic == "Success"))
    currentState = "Logged In";
    if (MyXML.ajax-response.response.(@generic == "Error"))
    mx.controls.Alert.show('Invalid username/password');
    ]]>
    </mx:Script>
    <mx:HTTPService id="login_user"
    result="checkLogin(event)" showBusyCursor="true" method="GET" url="
    http://72.22.224.90:8088/asterisk/mxml"
    useProxy="false">
    <mx:request xmlns="">
    <action>login</action>
    <username>
    {username.text}
    </username>
    <password>
    {password.text}
    </password>
    </mx:request>
    </mx:HTTPService>
    <mx:Panel resizeEffect="Resize" width="250" height="200"
    layout="absolute" title="Login System" horizontalCenter="0"
    verticalCenter="-2" id="panel1">
    <mx:Label x="10" y="10" text="Username:" id="label1"/>
    <mx:TextInput x="10" y="36" id="username"/>
    <mx:Label x="10" y="66" text="Password:" id="label2"/>
    <mx:TextInput x="10" y="92" id="password"
    displayAsPassword="true"/>
    <mx:Button x="10" y="122" label="Submit" id="Submit"
    click="login_user.send();"/>
    </mx:Panel>
    </mx:Application>

  • XML attributes instead of elements in data contract serialisation in Rest WCF implementation

    I want to uses XML attributes instead of elements, I implemented IXmlSerializable and
    public partial class Id : IXmlSerializable {
    /// <remarks/>
    [XmlAttribute]
    public string lmsId;
    /// <remarks/>
    [XmlAttribute]
    public string unitId;
    /// <remarks/>
    [XmlAttribute]
    public string lmsPresId;
    /// <remarks/>
    [XmlAttribute]
    public string callId;
    public System.Xml.Schema.XmlSchema GetSchema()
    return null;
    public void ReadXml(System.Xml.XmlReader reader)
    //implement if remote callers are going to pass your object in
    public void WriteXml(System.Xml.XmlWriter writer)
    writer.WriteAttributeString("lmsId", lmsId.ToString());
    writer.WriteAttributeString("unitId", unitId.ToString());
    writer.WriteAttributeString("lmsPresId", lmsPresId.ToString());
    writer.WriteAttributeString("callId", callId.ToString());
    But my service help is showing request and response as unknown
    I tried even XmlSerializerFormat public partial class Id : IXmlSerializable {
    /// <remarks/>
    [XmlAttribute]
    public string lmsId;
    /// <remarks/>
    [XmlAttribute]
    public string unitId;
    /// <remarks/>
    [XmlAttribute]
    public string lmsPresId;
    /// <remarks/>
    [XmlAttribute]
    public string callId;
    public System.Xml.Schema.XmlSchema GetSchema()
    return null;
    public void ReadXml(System.Xml.XmlReader reader)
    //implement if remote callers are going to pass your object in
    public void WriteXml(System.Xml.XmlWriter writer)
    writer.WriteAttributeString("lmsId", lmsId.ToString());
    writer.WriteAttributeString("unitId", unitId.ToString());
    writer.WriteAttributeString("lmsPresId", lmsPresId.ToString());
    writer.WriteAttributeString("callId", callId.ToString());
    then I am getting everything in the xml as xmlElements instead of XmlAttributes But I am getting all the data as elements instead of Xmlattributes

    I will test it.
    I sale myself ONLY half CNY!

  • Spec oversight? Using dynamic-attributes in XML tag files

    I have a couple of tagfiles that generate form elements with specific conventions for the 'name' and 'value' attribute. Basically, a data binding framework.
    Dynamic attributes are useful because you can delegate all the usual html attributes to the generated HTML form element: SELECT, INPUT, id, class etc.
    The usual way to do this is to concatenate all the "pass-through" attributes to a string, and append this string to the element generated:
    <input type="hidden" name="foo" ${dynattrs}/>I'm wondering how to do this in a tagfile in XML format (mytag.tagx), since the XML format forbids syntax like in the example above.
    jsp:attribute won't help much, if it's nested inside a c:forEach: it won't apply to the right element.

    Ran into the same problem with 'optional attributes'. (see post "JSP 2.0 Tag files outputting elements with conditional attributes" http://forum.java.sun.com/thread.jspa?forumID=45&threadID=681033)
    Found a solution that is not very elegant but does work and saves you the trouble of reverting to Java Tags. Consider the following tag-file that outputs an html input-tag with conditional attributes:
    <?xml version="1.0" encoding="utf-8"?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"
         xmlns:c="http://java.sun.com/jsp/jstl/core">
         <jsp:directive.attribute name="name" required="true" type="java.lang.String"/>
         <jsp:directive.attribute name="id" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="value" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="disabled" required="false" type="java.lang.Boolean"/>
         <jsp:directive.attribute name="hint" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="cssClass" required="false" type="java.lang.String"/>
         <jsp:text><![CDATA[<input type="text" name="]]><c:out value="${name}"/><![CDATA["]]></jsp:text>
         <c:if test="${!empty id}"><![CDATA[ id="]]><c:out value="${id}"/><![CDATA["]]></c:if>
         <c:if test="${!empty cssClass}"><![CDATA[ class="]]><c:out value="${disabled?(cssClass + '-disabled'):cssClass}"/><![CDATA["]]></c:if>
         <c:if test="${disabled}"><![CDATA[ disabled="disabled"]]></c:if>
         <c:choose>
              <c:when test="${!empty value}"><![CDATA[ value="]]><c:out value="${value}"/><![CDATA["]]></c:when>
              <c:when test="${!empty hint}"><![CDATA[ value="]]><c:out value="${hint}"/><![CDATA[" onfocus="if(this.value==']]><c:out value="${hint}"/><![CDATA[')this.value='';"]]></c:when>
         </c:choose>
         <jsp:text><![CDATA[/>]]></jsp:text>
    </jsp:root>In answer to your question: Yes, it looks like an oversight. Using the jsp:attribute tag in a c:forEach doesn't work because the attribute is then applied to the forEach tag. You would have to put the attribute-tag inside a jsp:body tag (inside the forEach). Then it would apply not to the forEach tag but to the tag enclosing the forEach. However, this doesn't work either, or at least it doesn't work in Tomcat 5.5. Could be a bug though, JSP 2.0 is still very buggy (for instance, using a tagfile inside another tagfile from the same taglib doesn't seem to work either...)
    Anyway, if you ever find a good solution please let me know by posting to this topic!
    TIA

  • Help: Using XML to format Java output

    I built an application that uses an SQL DB (uses HSQLDB). Users are prompted to enter data via the keyboard to store in the tables.
    The users must be able to query the database as well, to see what is in the tables.
    My aim is to use XML to show the results of the query, so that it is formatted nicely.
    However, I am new to this and not sure how to start putting in the XML tags etc. I think I know which part of the code to modify. This is the part that does the displaying.
          * Ouptut the contents of a recordset to the console with
          * the column names from the tables
          * @param rs the ResultSet to display
         public static void print(ResultSet rs) throws SQLException {
              ResultSetMetaData meta   = rs.getMetaData();
                 int               colmax = meta.getColumnCount();
                 int               i;
                 Object            o       = null;
              String coln            = meta.getColumnName(1);     
                 for (;rs.next();) {
                     for (i = 0; i < colmax; ++i) {
                    o = rs.getObject(i + 1);// Is SQL the first column is indexed
              coln = meta.getColumnName(i+1);                  
                                                // with 1 not 0
              System.out.println(coln +":"+'\t'+ o.toString() + " ");
                System.out.println(" ");
    }Can anyone give me any guidance or just a hint for me to start?
    Thank you very much.

    Using DOM would probably be the easiest solution, though not fast enough for your problem, as many records might come out of the RS...
    So if performance is an issue, try producing XML with SAX (read the excellent Dr.Clap tips here: http://forum.java.sun.com/thread.jsp?forum=34&thread=326617)
    Else use DOM: chapter 7 here: http://java.sun.com/webservices/docs/1.1/tutorial/doc/index.html

  • Parse XML formatted String

    Hi All,
       I have a string field that is formatted in XML format. What I want to be able to do is pull a specific element from the xml formatted string.
    Example string:
    <customer><name>john</name><id>25636</id></customer>
    I want to retreive just the id number of 25636 from this string.
    I would I go about accomplishing this?
    Thank you in advance,

    I fixed it on my own.
    Here' s my answer for others that may need it:
    if(instr({field.xmlstring},'</id>')  - instr({field.xmlstring},'<id>') = 7)then
       mid(totext({field.xmlstring}),instr({field.xmlstring},'<id>')+4,3)
    else if(instr({field.xmlstring},'</id>')  - instr({field.xmlstring},'<id>') = 8)then
       mid(totext({field.xmlstring}),instr({field.xmlstring},'<id>')+4,4)
    else if(instr({field.xmlstring},'</id>')  - instr({field.xmlstring},'<id>') = 9)then
       mid(totext({field.xmlstring}),instr({field.xmlstring},'<id>')+4,5)
    I use the conditions to cover all possible lengths of the id number.

  • Xml report output in excel format without using options tab in EBS

    How to get xml publisher report output in excel format without using options tab in EBS?
    I am getting XML Publisher report output in excel format by using options tab while submitting the concurrent request .
    But i want to get excel output automatically.
    Can anyone give idea to get XML publisher Report output in excel without selecting options tab.
    Thanks in advance
    Sandeep V

    Hey Sandeep,
    I am working on a similar format for a report and if possible can you please give me some guidelines. I have initially created reports using XML Publisher, but for those , the output preview format was PDF. So, if I select the preview format as EXCEL will it give me output in Excel and for this to happen, how do I define the rtf template. I believe the working will be same as for PDF, create a rdf report, get output in XML and apply the template to get the data in Excel or there is something different to this.
    Thanks,
    Sunil

  • Convertion of String to XML node using Xquery transformation in OSB

    How to convert string to XML node elementusing a built in function using Xquery transformation in OSB?

    check this out - http://www.javamonamour.org/2011/06/fn-beainlinedxml.html
    if in SOA (BPEL & Mediator) you can use oraext:parseXML.
    you should thoroughly analyse where to implement your requirement as some good practices advise to implement more complex logic in SOA and leave OSB to only connect to the services' endpoints.
    Hope this helps,
    A.

  • Invalid column name in query string - using Format function

    In my post just before this one the problem was solved for writing a query string using a date range. The rest of the query string includes the same date field (Call_Date) but formatted as 'MMM-YY'. I get an invalid column name error when I add this field to the query string. Here is the rest of the query string:
    strSql = "SELECT Format(CALL_DATE,'mmm-yy'), " _
    & "HOME_REGION FROM CCC2.CASE_EPRP " _
    & "WHERE (HOME_REGION = 'NCR') AND " _
    "(CALL_DATE >= to_date( '1/1/2002', 'MM/DD/YYYY' )" _
    & "AND CALL_DATE <= to_date( '2/28/2003', 'MM/DD/YYYY' ))"
    In the Access Query tool I can include this field
    Format(CALL_DATE,'mmm-yy')
    and the query runs fine (I just need to make it dynamic using ADO). But in my ADO query string above, I get the invalid column name error. Is there a way I can include
    Format(CALL_DATE,'mmm-yy')
    in my ADO query string? I appologize for not being more familiar with Oracle Sql. Any help greatly appreciated.
    Thanks again,
    Rich

    Thank you very much for your reply. I think I'm getting closer to the solution. Just I got an error message
    "date format not recognized"
    when I add "to_char( call_date, 'mmm-yy' )" to the query string. I tried using all uppercase, but that did not make a difference. Do I need to use to_date inside the to_char maybe?
    to_char(to_date(call_date, 'mmm/yy'), 'mmm-yy')
    Thanks again for your help.
    Rich

Maybe you are looking for