Print value of a XML tag
Hi
We have a requirement where we need print a value from XML tag. The tag is ike this
<Order ordernumb=22><Order>
how can i access the value 22, print it in logs.
Any functions avaialble for this?
Thanks
Kedar
thanks
Similar Messages
-
Need help in extracting value from an xml tag.
Hi ALL,
Good Morning to all, i have problem in fetching a value from a xml tag. I have created a xml schema based on the schema i have created a xmltype table and inserted a value to the table. When i am trying to fetch a value from a particular tag i am unable to do so.. Kindly help me to solve this. Here by i am posting all the workings i have done...
I am using the following client:
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 31 11:44:59 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
////////////////////////////////// XML Schema ///////////////////////
begin
dbms_xmlschema.registerSchema(
'http://www.oradev.com/chipsxml.xsd',
'<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.oradev.com/chipsxml.xsd"
xmlns:samp="http://www.oradev.com/chipsxml.xsd"
version="1.0">
<element name="Field1">
<complexType>
<sequence>
<element name="UTI">
<complexType>
<sequence>
<element name = "U01" type = "string"/>
<element name = "U02" type = "string"/>
<element name = "U03" type = "string"/>
<element name = "U03a" type = "string"/>
<element name = "U03b" type = "string"/>
<element name = "U03c" type = "string"/>
<element name = "U04" type = "string"/>
<element name = "U05" type = "string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>',
TRUE, TRUE, FALSE, FALSE);
end;
////////////////////////// Table which has multiple Column //////////////////////////
CREATE TABLE chipsxmltable1 (
id number, XMLDATA XmlType)
XMLTYPE XMLDATA STORE AS OBJECT RELATIONAL
XMLSCHEMA "http://www.oradev.com/chipsxml.xsd"
ELEMENT "Field1";
///////////////////////////////// Insert Query in chipsxmltable //////////////////////////
INSERT INTO chipsxmltable VALUES(
xmltype.createxml('<?xml version="1.0"?>
<samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd" >
<UTI>
<U01>No</U01>
<U02>Y</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
</samp:Field1>'));
To show the data as a field with structure:
1. Query:
Select * from chipsxmltable1;
Output:
ID XMLDATA
1 <?xml version="1.0"?>
<samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
<UTI>
<U01>No</U01>
<U02>No</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
</samp:Field1>
2. Query: (Both the query displays the same Output)
SELECT X.xmldata.getClobVal() "XMLDATA" FROM chipsxmltable1 X;
select extract(XMLDATA, '/Field1').getstringval() "XMLDATA" from chipsxmltable1 x;
Output:
XMLDATA
<?xml version="1.0"?>
<samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
<UTI>
<U01>No</U01>
<U02>No</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
</samp:Field1>
To show the data as a single string without structure using "getstringval()":
3. Query
select extract(XMLDATA, '//text()').getstringval() "CHIPS - XML" from chipsxmltable1 x;
OUtput:
CHIPS - XML
NoNoYYYYYY
To show the data as a single string without structure using "getclobval()":
4.Query
select extract(XMLDATA, '//text()').getClobVal() "CHIPS - XML" from chipsxmltable1 x;
Output:
CHIPS - XML
NoNoYYYYYY
To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACT" function:
6.Query:
select extract(XMLDATA, '/Field1/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
select extract(XMLDATA, '/Field1/UTI').getstringval() "XMLDATA" from chipsxmltable1 x;
select extract(XMLDATA, '/Field1/UTI/U01').getstringval() "XMLDATA" from chipsxmltable1 x;
select extract(XMLDATA, '/Field1/UTI/U01/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
Output:
CHIPS - XML
The above queries are not fetching the value.
To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACTVALUE" function:
7. Query:
select extractValue(XMLDATA, '/Field1/UTI') "XMLDATA" from chipsxmltable1 x;
select extractValue(XMLDATA, '/Field1/UTI/U01') "XMLDATA" from chipsxmltable1 x;
Output:
X
The above queries are not fetching the value.
My question is:
How to fetch values from xml tag when the value are inserted through xml schema?
Apologies if the description is not clear. Kindly let me know if further details are needed. Many thanks for your help.
Very best regards,
Godwin Jebakumar C.V.Hi,
You need to declare the namespace of each element used in the XPath expression, like this :
SQL> select extractvalue( XMLDATA
2 , '/samp:Field1/UTI/U01'
3 , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"' ) "XMLDATA"
4 from chipsxmltable1 x
5 ;
XMLDATA
No
SQL> select extract( XMLDATA
2 , '/samp:Field1/UTI'
3 , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"'
4 ).getstringval() "XMLDATA"
5 from chipsxmltable1 x
6 ;
XMLDATA
<UTI>
<U01>No</U01>
<U02>Y</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
Please see EXTRACT and EXTRACTVALUE documentation :
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions051.htm#i1006712
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions052.htm#SQLRF06173
BTW, "XMLDATA" is a pseudo-column used by Oracle. I don't know if it'll ever cause any conflict but maybe you should rename your column.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns010.htm#SQLRF00256
Regards. -
Getting unwanted values between the XML tags in XSLT mapping
Hi Folks
I have come across a very strange situation with my xslt mapping.
I am getting unwated values "11" between xml tags
as follows
<Tag>0001</Tag>
11
<DataID>3</DataID>
I am not sure why I am getting these values in between the tags. Any suggestions would be appreciated.Hi David,
Here is the code fragment where these 2 tags are mapped, FYI, the source is an IDOC message. The unwanted "11" is coming After the <Tag></Tag> and <DataID></DataID>. FYI, Fof the element <Tag></Tag> its a default value. But for <DataID> </DataID> I have the mapping logic.
<Order>
<OrderHeader>
<Tag>009</Tag>
<xsl:for-each select="E1EDKA1">
<xsl:choose>
<xsl:when test="normalize-space(PARVW) = 'WE' and normalize-space(LIFNR) = 'U960'">
<DataID>
<xsl:value-of select="'1'" />
</DataID>
</xsl:when>
<xsl:when test="normalize-space(PARVW) = 'WE' and normalize-space(LIFNR) = 'U300'">
<DataID>
<xsl:value-of select="'3'" />
</DataID>
</xsl:when>
<xsl:when test="normalize-space(PARVW) = 'WE' and normalize-space(LIFNR) = 'U930'">
<DataID>
<xsl:value-of select="'1'" />
</DataID>
</xsl:when>
<xsl:when test="normalize-space(PARVW) = 'WE' and normalize-space(LIFNR) = 'U400'">
<DataID>
<xsl:value-of select="'3'" />
</DataID>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'1'" />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each> -
How to get the value in the XML tag?
hi all,
i am new to JAXP. i tried the sample program provided in the following link. it just counts the number of tags in the XML file. XML file name is given as command line argument.
Now, if i want to display the value in the XML tag( say <NAME>xxx</NAME> in this tag i want to display the value 'xxx' ), what has to be done?
how can i achieve this?
please help...
link of the sample program:
http://xml.apache.org/~edwingo/jaxp-ri-1.2.0-fcs/samples/SAXLocalNameCount/SAXLocalNameCount.java
thx in advance,
-Soni.implement this method the same way you have startElement...
public void characters(char[] ch,
int start,
int length)
throws SAXException -
XML:selecting the value of a xml tag using plsql
Hi,
I have a table xx_table with one of the column xx_column which is of type XMLTYPE.I inserted the xml data into this column with xml data as below.
<userComments xmlns:ns1="http://xmlns.oracle.com/XXXX_AccountDistribution"
xmlns="http://xmlns.oracle.com/XXXXX_AccountDistribution">
<task:userComment
xmlns:task="http://xmlns.oracle.com/bpel/workflow/task">
<task:comment>*********** Rejecting invoice **********</task:comment>
<task:updatedBy>
<task:id>r</task:id>
<task:displayName></task:displayName>
<task:systemVersionFlag></task:systemVersionFlag>
</task:updatedBy>
<task:updatedDate>2010-05-19T14:09:15-07:00</task:updatedDate>
<task:displayNameLanguage></task:displayNameLanguage>
<task:action></task:action>
<task:systemVersionFlag></task:systemVersionFlag>
</task:userComment>
</userComments>
My question ,how do i select the value of the tag "comment" from the above xml data using plsql? Can we write a query to select the value of the tag "comment" to fetch "*********** Rejecting invoice **********" as value.
Regards,
SandeepIf you have rights to modify tabular model then, you can create a measure in your Tabular model which returns previous week and then use this measure in Pivot Table.
Thanks,
Sagar K
(Blog: http://datamazik.blogspot.in/) -
Html tag as xml tag value?
Hi,
Can I put a html tag as value to a xml tag? something like this
<abc>
<username>Uma</username>
<displayTag>
<start><h1></start>
<end></h1></end>
</displayTag>
</abc>Please help.
Thanks in advance.You can either use > and < for < and > to get something that appears to be an html tag, or you can use a CDATA section.
It partly depends on what you plan to do with that content.
Dave Patterson -
Output to the printer printing xml tags with actual output
Hi,
we are calling fnd_request.submit_request with 'XDOREPPB' and assigning a printer to it.
the output that is getting printed has both the xml tags and the actual output.
anyone has any idea what might be the reason.
Regards,Got the solution. These tags are getting generated from standard report and we can use <columnname>[1], <columnname>[2]... etc if there are multiple tags with same tag names.
-
Hi,
I am trying to get the attribute values of an XML Tag of a Textbox. To get the xml tag of the selected element, I use
InterfacePtr<IXMLTagSuite> xmlTagSuite(fCurrentSelection,UseDefaultIID());
if (xmlTagSuite)
UIDList tagUIDList = xmlTagSuite->GetTags();
UID tagID;
UIDRef tagUIDRef;
for(int32 i=0; i < tagUIDList.Length();i++)
tagID = tagUIDList[i];
tagUIDRef = UIDRef(fCurrentSelection->GetDataBase(), tagID);
InterfacePtr<IXMLTag>xmlTag(tagUIDRef,UseDefaultIID());
if (kTrue == tagUIDRef.ExistsInDB()) {
tagName = xmlTag->GetTagName();
err = kSuccess;
since I am totally new to this, It would help a great deal if you could tell me how to iterate thourgh the attribute values of that tag.
Thanks so much in advance
Benny"Tags" are what appear in the Tags palette. "Elements" are what appear in the Structure View. Tags do not have attributes, elements are the ones with attributes. Instead of looking at the tags, you should be looking for the elements. Find the element that's associated with the story, and IIDXMLElement should have attributes you can loop through.
-
Re: Help needed in AP Check Printing R12 XML Tags
Hi,
I am trying to print the 'Overflow' Image on top of the check area in first page instead of 0.00. and nicely align the check print on the bottom of the 2nd page. I am unable to keep the number of invoices stub as static so that check can be static. Please send me if you have the check print .rtf with overflow logic in it for R12.1.3
Thx,
Srini.There can be any 'n' number of <Form1>'s in one
XML.Not if you want the XML to be valid there can't. You would need a root element around all the <Form1>'s to make it valid.
The technique I was using is,
1. Convert to clob
2. User dbms_instr find the location of <Form1> in a
loop
3. For every occurence of <Form1> I find
<TotalEarnings> value and check if this is greater
than 1 million.
4. If true, I use dbms_instr to get the values of all
the tags inside <Form1>
5. The drawback of using dbms_instr is that it gets
the value of first occurence of whatever sting we
supply.In this case
dbms_instr(xml,'<Gender>',position of Form1) will not
return null whereas it will return "Female" from the
next form. This is wrong as it doesnt belong to the
person who earns more than a million.
Can anyone suggest a way to fetch the values that
only belong to the form of the person who earns more
than a million?Why on earth are you using dbms_instr for this? Oracle has built in XML functionality for use against XMLTYPE data, such as the ExtractValue method and the use of XPATH expressions.
I'd suggest you start reading some of the manuals regarding XML functionality in Oracle rather than trying to manually parse it all. -
Formating and calculating xml tag value
I have an xml file that holds xml tag such as <weight>.55 kg</weight>
I want to have two outputs:
Output 1) Output to print: 0.55
Output 2) Output to print 0.8 of the xml tag value (0.55 * 0.8) : 0.44
I was able to get the Output 1) by using <?format-number:weight;'9G990D00'?>
However, I can not get the Output2) as expected.
If I put <?format-number:(weight)*0.8;'9G990D00'?>,
I get the error message "Caused by: oracle.xdo.parser.v2.XPathException: Cannot convert .55 kg to number."
Appreciate any help on how to solution for Output2)
Edited by: user4697912 on Jun 22, 2010 1:23 AM
Edited by: user4697912 on Jun 22, 2010 1:23 AMIf that is the case then try using
<?format-number:( substring-before(WEIGHT,'kg')*0.8);'9G990D00'?> -
How to get the XML TAG name itself instead of TAG value
Hi All,
I have a question here
I want to retrieve the XML tag from a XML file instead of its value.
Example:
<item>Colgate</item>
Now I want to retrieve "item" as output from XPath expression, I dont want its value as "colgate"
How to do that...?
Thanks
-PraveenYou can do this with an axes XPatch expression:
child::node()/name()
For more info see: http://www.w3schools.com/xpath/xpath_axes.asp
HTH,
Bas -
Text Box issue - displays XML tag instead of the value in EBS
I need to use a textbox (or a autoshape with text) to place a data element in a specific position on the page in an RTF template. I tried using tables and it didn't help. This layout needs some elements to be placed at specific location and using an autoshape or a text box is easy. When I preview the pdf output on my desktop, it works fine. Once I upload the template into EBS XML Publisher, the value in the text box shows up as an XML Tag instead of the value in that tag. The same XML data when loaded and previewed locally shows the data instead of the tag.
Any thoughts on this? Is there a patch or something we might need for this in EBS?
Thanks,
VinayThanks Tim for the quick response.
Yes - the versions are same. Also, I tried giving the complete path. The issue is that it is not even reading the text in the text box as an XML tag. It seems to think the whole text box is an object and hence just display that text as is. If it was reading and not able to resolve it, I guess it would have displayed blank (and not the tag as is). Again as I mentioned it works fine in local preview on my machine. -
How to filter particular xml tag value using -DBMS_XMLGEN / DBMS_XMLSTORE
Hi,
I am using dbms_xmlgen and dbms_xmlstore package to extract xml datafile tag value from file server to oracle database table.
I have used the below pl/sql program to extract the xml tag values to oracle relational table.Its working fine for me.
But I would like to extract the values based on particular filter condition.
The following xml program I have 3 rows I would like extract the xml data based on the following condition .
Filter condition
==============
the tag <STATE_ABBREVIATION> value shuold be 'CA' and the <CITY> tag value should be Palo_Alto then I will store the ZIPCODE
ZIP_CODE_EXTN,STATE_ABBREVIATION tag values in the Oracle Relational table.
The below pl/sql program storing all the three rows but I required the values based on the filter condition that I mentioned earlier.
Kindly assist me what are the steps that I need to change in this program.?
XML Program file content.
======================
<ZIPCODES>
<mappings>
<STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
<ZIPCODE>94301</ZIPCODE>
<ZIP_CODE_EXTN>9277</ZIP_CODE_EXTN>
<CITY>Palo_Alto</CITY>
</mappings>
<mappings>
<STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
<ZIPCODE>95302</ZIPCODE>
<ZIP_CODE_EXTN>9279</ZIP_CODE_EXTN>
<CITY>LA</CITY>
</mappings>
<mappings>
<STATE_ABBREVIATION>TX</STATE_ABBREVIATION>
<ZIPCODE>75038</ZIPCODE>
<ZIP_CODE_EXTN>7837</ZIP_CODE_EXTN>
<CITY>DALLAS</CITY>
</mappings>
</ZIPCODES>
PL/SQL Program for XML extract.
==========
declare
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp number;
insCtx DBMS_XMLStore.ctxType;
ctx dbms_xmlgen.ctxHandle;
v_FileHandle UTL_FILE.FILE_TYPE;
begin
v_FileHandle := utl_file.fopen('XMLTEST','XML_NEW_CITIES.XML','r') ;
loop
BEGIN
utl_file.get_line(v_FileHandle, charString);
exception
when no_data_found then
utl_file.fclose(v_FileHandle);
exit;
END;
dbms_output.put_line(charString);
if finalStr is not null then
finalStr := finalStr || charString;
else
finalStr := charString;
end if;
end loop;
insCtx := DBMS_XMLStore.newContext('SYS.ZIPCODES');
dbms_xmlgen.setRowsetTag(insCtx,'ZIPCODES');
dbms_xmlgen.setRowsetTag(insCtx,'mappings');
DBMS_XMLStore.clearUpdateColumnList(insCtx);
DBMS_XMLStore.setUpdateColumn(insCtx,'ZIPCODE');
DBMS_XMLStore.setUpdateColumn(insCtx,'ZIP_CODE_EXT N');
DBMS_XMLStore.setUpdateColumn(insCtx,'STATE_ABBREV IATION');
rowsp := dbms_xmlstore.insertXML(insCtx,finalstr);
end;
Thanks,
natThanks for your reply. :)
Its working fine in the DBMS_XMLSTORE package. Here I have given the code
CREATE OR REPLACE TYPE typ_dummy AS OBJECT
( "@ENO" NUMBER,
"@ENAME" VARCHAR2(100),
eno NUMBER,
ename VARCHAR2(100));
CREATE TABLE EMP
empno VARCHAR2(25),
sal NUMBER,
hiredate DATE,
typ TYP_DUMMY
DECLARE
insCtx DBMS_XMLStore.ctxType;
rows NUMBER;
xmldoc CLOB :=
'<ROWSET>
<ROW num="1">
<SAL>1800</SAL>
<EMPNO>739</EMPNO>
<HIREDATE>27-AUG-1996</HIREDATE>
<TYP ENO="739" ENAME="Nazurullah">
<ENO> 1 </ENO>
<ENAME> ALDRIN </ENAME>
</TYP>
</ROW>
<ROW>
<SAL>18000</SAL>
<EMPNO>7369</EMPNO>
<HIREDATE>27-AUG-1996</HIREDATE>
<TYP ENO="7369" ENAME="PEPPIN" />
</ROW>
<ROW>
<SAL>37000</SAL>
<EMPNO>20701</EMPNO>
<HIREDATE>27-AUG-1996</HIREDATE>
<TYP>
<ENO> 20701 </ENO>
<ENAME> VENKATACHALAM </ENAME>
</TYP>
</ROW>
</ROWSET>';
BEGIN
insCtx := DBMS_XMLStore.newContext('emp'); -- get saved context
-- Now insert the doc.
-- This will only insert into EMPNO, SAL and HIREDATE columns
rows := DBMS_XMLStore.insertXML(insCtx, xmlDoc);
-- Close the context
DBMS_XMLStore.closeContext(insCtx);
END;
SELECT * FROM emp;
EMPNO SAL HIREDATE TYP(@ENO, @ENAME, ENO, ENAME)
739 1800 27-AUG-96 TYP_DUMMY(739, 'Nazurullah', 1, ' ALDRIN ')
7369 18000 27-AUG-96 TYP_DUMMY(7369, 'PEPPIN', NULL, NULL)
20701 37000 27-AUG-96 TYP_DUMMY(NULL, NULL, 20701, ' VENKATACHALAM ') -
Extracting value from XML tags in Java
Hi all,
I need to extract the value from a string (XML Format). Eg. <Name>Ray</Name> and displaying Name: Ray
The string value is like any other String class object except that it is format with XML tags. I have quite a few examples that shows how a value can be read from a .xml file but none that describe how to get a value from a String object.
Thanks in advance.DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse("Your XML Goes here "); -
Error "XML tag Main/@versionMinor has incorrect value 001; expected value."
I'm going to describe our scenario.
We have created an Abap proxy in a BW system to run a XI interface. The abap proxy in BW is connected to the IE of a XI 3.0 system. That scenario runs without problems with BW 3.5 (basis 6.40). Now, we are migrating the release of BW to 7.30. we have created the Abap proxy in the migrated BW system but when we run the interface the next message is returned:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Call Integration Server
-->
- <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SAP:Category>XIProtocol</SAP:Category>
<SAP:Code area="PARSER">UNEXPECTED_VALUE</SAP:Code>
<SAP:P1>Main/@versionMinor</SAP:P1>
<SAP:P2>001</SAP:P2>
<SAP:P3>000</SAP:P3>
<SAP:P4 />
<SAP:AdditionalText />
<SAP:Stack>XML tag Main/@versionMinor has the incorrect value 001. Value 000 expected</SAP:Stack>
<SAP:Retry>N</SAP:Retry>
</SAP:Error>
does anyone know what the problem is? is there a version conflict between BW 7.3 and XI 3.0?
Thanks very muchHi,
I'm not an expert, but it might be that you would also need to update the XI content to match the new release and then regenerate the proxy.
It does indeed seem to be a difference in the version of the proxies between BW 3.5 and BW 7.3.
Regards,
Horia
Maybe you are looking for
-
Download and upload speed per ssid in air-sap2602.
Dear team, How to limit the download and upload speed per ssid in air-sap2602 ? SSID =5MB download + 1upload SSID= 30MB download + 5upload Regards
-
Create Customer-Master Info record (VD51).
Hi All, Have a requirement in which I need to create a customer-Master Info record (VD51). Want a suggestion, what is the best way to create a customer-Master Info record via program. Is there a BAPI or a FM which create a customer-Master Info record
-
Automatically refresh the report tabs after selecting the parameters in bip
Hello Everything!! Is there a way to automatically refresh all the report tabs once we select the parameters? The report are not refreshed automatically in each tab and users have to either hit apply button or refresh button for each report tab . Is
-
Calling RFC problem...
Hi everyone, I have a real strange problem trying to call custom RFC via WebDynPro. If I call for example the BAPI_HELPVALUES_GET passing table and structure...everything works. But if I call a simple custom RFC, it seems that the RFC gets emty table
-
Adobe Content Viewer with multiple Adobe-IDs
Hi guys, i am having a problem with the Adobe Content Viewer. Because we work on several projects for different customers we have different Adobe-IDs for each of them. So I used to sign-in and sign-out in the Content Viewer to download the different