Unknown xml tag extraction
I have an XML document with the following structure:
<foo>
<foo id="F1">television</foo>
<foo id="F2">car</foo>
</foo>
foo id can be none or up to 99. So I want to extract the tag "F1", "F2", etc. and its content when it shows up in a document to enter them in separate fields in a database. I have tried different codes but with no luck. These two are my latest methods but they don't work as expected. The second method gives an error message at the line "matcher = pattern.matcher(xml)". If any one could help I would appreciate it very much.
_xmlFile is my parsed document. I know it works because I have other methods using getTextContent() with specific tags and work well.
private void processFoo(Document _xmlFile){
String xPath = null;
String value = null;
xPath = "/*/foo";
try{
NodeList nodelist = XPathAPI.selectNodeList(_xmlFile, xPath);
for(int i2 = 0; i2 < nodelist.getLength(); i2++){
Element elem =(Element)nodelist.item(i2);
value = elem.toString();
value = value.replaceAll("\t", "");
value = value.replaceAll("\n", "");
value = value.replaceAll("\r", "");
}catch(TransformerException transformerexception){
addFoo(value);
public void addFoo(String _xml)
String regex = null;
String id = null;
String content = null;
Pattern pattern = null;
Matcher matcher = null;
String sql = null;
int index = 0;
String xml = _xml;
regex = "\\<foo id=\"F(.+?)\">";
pattern = Pattern.compile(regex);
matcher = pattern.matcher(xml);
while (matcher.find())
id = matcher.group(1);
id = id.replaceAll("'", "");
index = matcher.end(1)+2;
index = xml.indexOf("</foo>", index);
content = xml.substring(matcher.end(1)+2, index);
content = processOfString(content);
sql = "INSERT INTO my.Foo (Foo_Id, Foo_Content) VALUES " + "(" + id + ", '" + content + "')";
//System.out.println(sql);
insertQuery(sql, false);
xml = xml.substring(index+11, xml.length());
matcher = pattern.matcher(xml);
}
Although I still have a question (which is at the bottom) I finally got what I wanted with the following method.
private void addFoo(Document _xmlFile){
String foocontent = null;
String fooref = null;
Document doc = _xmlFile;
String foopath = "foo";
String sql = null;
NodeList foo = doc.getElementsByTagName(foopath);
for (int i = 0; i < foo.getLength(); i++){
Element foos = (Element) foo.item(i);
fooref = foos.getAttribute("id");
foocontent = foos.getTextContent();
foocontent = foocontent.replaceAll("\t", "");
footcontent = footcontent.replaceAll("\n", "");
foocontent = foocontent.replaceAll("\r", "");
//System.out.println(fooref);
//System.out.print(foocontent);
sql = "INSERT INTO insider.footnote SET fooRef = ?, fooText = ?";
try{
PreparedStatement addfoo = con.prepareStatement(sql);
addfoo.setString(1, fooref);
addfoo.setString(2, foocontent);
addfoo.executeUpdate();
}catch(SQLException ex){
System.err.println("SQLException: " + ex.getMessage());
my foo table has a primary key that I need as a foreign key in ABC table. So I was wondering if there is anything in java that would allow me to send the key to ABC every time the foo table is updated. Actually, it would better if I can store the key in a variable that I send later with other data that needs to be input into the ABC table.
Thanks.
Similar Messages
-
Hi
When the tags are known for xml document
a NodeList could be created and then the Tganame and TagNameValue could be found like so NodeList nl_t = elem.getElementsByTagName("type");
NodeList nl_av = elem.getElementsByTagName("roomsAvailable");
NodeList nl_pr = elem.getElementsByTagName("price");
// get the element <type> and print
type = (Element)nl_t.item(i);
tagname = type.getTagName();
node = (Node)nl_t.item(i);
nodeName = node.getNodeName();
tagnameValue = node.getChildNodes().item(0).getNodeValue() ;
// insert item into the vector
bb_Vector.add(tagnameValue);
System.out.println( tagname.toString()+" ---> : "
+ tagnameValue.toString() +"\n");
/// XXXXXXXXXXXXXXX /////
// get the element <price> and print its price
price = (Element)nl_pr.item(i);
tagname = price.getTagName();
node = (Node)nl_pr.item(i);
nodeName = node.getNodeName();
tagnameValue = node.getChildNodes().item(0).getNodeValue() ;
// insert item into the vector
bb_Vector.add(tagnameValue);
System.out.println( tagname.toString()+" ---> : "
+ tagnameValue.toString() +"\n");
/// Note the above isjust a portion of the codeNow I have an xml document and I dont know any of the tags , and I need to scan it and print out all the TagNames and their valuse .
Could someone please help
Thanks
IBHere's a start:
node = document.getDocumentElement(); //get root node
//traverse document elements beginning from current root node:
NodeList nodeList = node.getChildNodes();
int count = nodeList.getLength();
for (int i = 0; i < count; i++) { //for all children
Node child = nodeList.item(i);
if (child != null) { //just to be sure ...
String name = child.getNodeName();
int type = child.getNodeType();
//decoding:
switch (type) {
case Node.ELEMENT_NODE:
Element element = (Element) child;
... -
Reading a xml file and Extract content of xml tags
Hi,
I need a InDesign script to Extract content of xml tags by reading a local xml file. And stamping the content of xml on InDesign Text frame.
My sample xml is as follows .
<events type="array">
<event>
<aktiv_jn>J</aktiv_jn>
<enetpulse_id>1712408</enetpulse_id>
<event_id>65974</event_id>
<hjemmehold>AZ Alkmaar</hjemmehold>
<id>93</id>
<kickoff>2014-08-17T12:30:00+01:00</kickoff>
<land_id>140</land_id>
<land_navn>Holland</land_navn>
<liga_id>13684</liga_id>
<liga_navn>Eredivisie</liga_navn>
<livebetting_jn>J</livebetting_jn>
<marked_id>2897740</marked_id>
<marked_nummer>138</marked_nummer>
<marked_tekst>AZ Alkmaar - Ajax</marked_tekst>
<moderkamp_jn>J</moderkamp_jn>
<ob_bet_type>MR</ob_bet_type>
<odds_1>2.95</odds_1>
<odds_2>2.25</odds_2>
<odds_x>3.35</odds_x>
<program_slut>2014-08-18T23:59:00+01:00</program_slut>
<program_start>2014-08-15T00:00:00+01:00</program_start>
<resultat>2</resultat>
<spilstop_dato_tid>2014-08-17T12:30:00+01:00</spilstop_dato_tid>
<sport_id>21</sport_id>
<sport_navn>Fodbold</sport_navn>
<taerskel nil="true"/>
<udehold>Ajax</udehold>
<udfald_1_id>9661951</udfald_1_id>
<udfald_2_id>9661953</udfald_2_id>
<udfald_x_id>9661952</udfald_x_id>
</event>
</events>
And on my Indesign Page upon execution of script: I need text like,
land_navn: Holland
odds_1: 2.95
odds_2: 2.25
odds_x: 3.35Hi,
Try: -
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. -
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 "); -
Unknown PT XML tag 'gatewaylink
Hi,
I'm trying to use the gatewayLink tag within my code but it keeps returning 'unknown PT XML tag 'gatewaylink'. I have used the pt:URL tag before so i know that works on the current plumtree portal build we are using (5.04 and edk 2.2) and i have also tested pt:currenttime which also returns a correct value.
I am using the tags directly in the html code:
<pt:currentTime xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/>
<pt:gatewaylink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:fixurl="On" pt:objectID='10' pt:href="portlet.aspx">Click here</pt:gatewaylink>
but receive this is in the source of the page:
Apr 11, 2007 9:47:26 AM
unknown PT XML tag 'gatewaylink Click here unknown PT XML tag 'gatewaylink
(removed < - - - - > from arround each block of text either side of the click here as they do not show on the forum)
i am trying to create a link to a specific portlet which will be accessible outside the standard portal interface but still gatewayed.
can anyone help with this at all?
Thanks
Alex
Edited by cannedfool at 04/11/2007 3:08 AM:-( let me just say,
gatewayLink. -
Unknown PT XML tag userInfo userinfo
When using a transformer tag for userinfo in a load balanced environment "one" of the servers returns "<!--unknown PT XML tag 'userInfo-->". The same code works fine on 3 other servers. What would cause this? I am suspecting it is some configuration on that server, but need to know what to tell our sys admin to look for.
Thanks for the help. By the way this is in our production environment and I would like to get it resolved before Christmas. :):-( let me just say,
gatewayLink. -
Application.xml - Unknown Assembly Tag
Hello:
Has anyone encountered the error:
05/11/18 10:01:39 Error instantiating application at ..... Unknown assembly tag in file:..... <library>
This happens when I start up the oc4j application server...
I am positive that it happens because of the following line in my application.xml file:
<library path="../bvp-web/WEB-INF/lib"/>
When I take that line out, the applicaiton starts up fine.
Does anyone have any thoughts as to why I am getting that error? Isn't <library> a tag that is expected to be in the application.xml file?
I need that line in there since my jsps refer to classes that are in that directory.
Thanks for your help.<library> tag only applies to the orion-application.xml in META-INF/ of a j2ee application or the j2ee/home/config/application.xml, which is actually the orion-application.xml of the default application of oc4j.
-
Document contains too many nodes error when extracting xml tag name
I Have a large xml file in which the tag contains ~: as the value.
Now I am trying to extract all the tags which have ~: as the value and store that column using the following query and insert into a table.
insert into space_md select distinct xmltype(extract(value(x), '/').getstringval()).getrootelement() COLUMN_NAME
from gt_xmltype_tab gt, TABLE(XMLSequence(extract(gt.xmlfile1, '/ROWSET/ROW/*'))) x
where instr(extract(value(x),'/').getstringval(),'~:') > 1;
The xml file was generated using dbms_xmlgen.getxml. Table has 48 columns and around 4000 rows.
My above insert query gave me an error of 31186 too many nodes error.
I am using oracle version 10.2.0.3.
Following are the set of commands I ran....
SQL> insert into gt_xmltype_tab(xmlfile1)
values(XMLType(bfilename('BKUP_RES','QC.xml'),nls_charset_id('AL32UTF8'))); 2
1 row created.
SQL> SQL>
SQL> insert into restore_space_metadata select distinct 'QC', xmltype(extract(value(x), '/').getstringval()).getrootelement() COLUMN_NAME
2 from gt_xmltype_tab gt, TABLE(XMLSequence(extract(gt.xmlfile1, '/ROWSET/ROW/*'))) x
3 where instr(extract(value(x),'/').getstringval(),'~:') > 1;
insert into restore_space_metadata select distinct 'QC', xmltype(extract(value(x), '/').getstringval()).getrootelement() COLUMN_NAME
ERROR at line 1:
ORA-31186: Document contains too many nodes
Is there a better way of extracting the xml tag element name based on the xmltag content?
There is one other table which has 172 columns but only 100 rows so it doesnt create any problem on that table.
But this QC table has less columns but many many rows...
Any suggestionsThere is a requiremnent of taking centain type of data backup and restore it.
It was implemented on flat file approach which was giving errors.
So it was implemented using XML approach.
Read data, store in xml file and read from xml file and load it into table.
Further, found that dbms_xmlstore is not able to handle tag only with whitespace
and tried to use the loading xml file into xmltype table column and extract data.
XMLTYPE column also has same problem of ignoring whitespace when used with extractvalue functions.
So for the workaround I update xmlfile having only one more more whitespace in the tag to have ~: character once.
After restoring data from xml to table I would run update qeury to update ~: to " ".
Now instead of running blind update for all the tables and all the columns from ~: to " " I thouhgt whyy not create a xml file of tag having ~:
along with its tablename.
and thats where I found the problem of too many nodes...
THe insert query you saw is populating table for table_name and column_name with tag having only ~: in it.
I hope this gives you the fair idea of stuff I am doing. -
XMLTable - Extract single row among 2 XML tags
Hello,
Aim to extract the BRAND and its COST and I am able to extract with without any problem using XMLTable.
CREATE TABLE xml_tab (seqno number default 1, xml_data XMLType);
INSERT INTO xml_tab
VALUES
(1, XMLType('<PRODUCTS>
<LAPTOPS>
<NOTEBOOK BRAND="HP">1000</NOTEBOOK>
<NOTEBOOK BRAND="LENOVA">2000</NOTEBOOK>
</LAPTOPS>
</PRODUCTS>'));
SELECT t.seqno, tx.* FROM xml_tab t,
XMLTABLE('/PRODUCTS/LAPTOPS/NOTEBOOK' PASSING t.xml_data
COLUMNS brandname CHAR(20) PATH '@BRAND',
cost CHAR(20) PATH '.') tx
WHERE brandname in ('HP', 'LENOVA') AND seqno = 1;
Outpupt
SEQNO BRANDNAME COST
1 HP 1000
1 LENOVA 2000
Below query will demonstrate the problem I am facing and need your kind help to resovle it.
INSERT INTO xml_tab
VALUES
(2, XMLType('<PRODUCTS>
<LAPTOPS>
<NOTEBOOK BRAND="HP">3000</NOTEBOOK>
<NOTEBOOK BRAND="HP">1400</NOTEBOOK>
<NOTEBOOK BRAND="LENOVA">5000</NOTEBOOK>
</LAPTOPS>
</PRODUCTS>'));
(Below query is not working)
SELECT t.seqno, tx.* FROM xml_tab t,
XMLTABLE('/PRODUCTS/LAPTOPS/NOTEBOOK[1]' PASSING t.xml_data
COLUMNS brandname CHAR(20) PATH '@BRAND',
cost CHAR(20) PATH '.') tx
WHERE brandname in ('HP', 'LENOVA') AND seqno = 2;
My requirement is to display only single row of HP and LENOVA brand even if there are multiple XML tags of one brand. Therefore, desired output is*
SEQNO BRANDNAME COST
2 HP 3000
2 LENOVA 5000
Kindly suggest.
Thanks in advance
Sandeep
Edited by: Sandeep98191 on Sep 22, 2012 9:24 PMWITH t as (
SELECT t.seqno,
tx.*,
row_number() over(partition by brandname order by rownum) rn
FROM xml_tab t,
XMLTABLE(
'/PRODUCTS/LAPTOPS/NOTEBOOK'
PASSING t.xml_data
COLUMNS
brandname CHAR(20) PATH '@BRAND',
cost CHAR(20) PATH '.'
) tx
WHERE brandname in ('HP', 'LENOVA')
AND seqno = 2
select seqno,
brandname,
cost
from t
where rn = 1
SEQNO BRANDNAME COST
2 HP 3000
2 LENOVA 5000
SQL> SY. -
Extracting XML tags and its values using ORACLE PL/SQL
I need help to create a procedure that receive a XML string and insert it into the table after parsing it.
If the XML has 10 tags then it should insert into the table 10 rows. Table will be having tag name and value. This will be plain XML tags without attributes in tags.Hi,
I am able to retreive the values of the tags using extract function (example: lv_xml.EXTRACT ('/ROWSET/EMPLOYEE/EMPNO/text()').getstringval() ). But could you help me to find some way to extract the tags also since we have no idea what the tags are and how many tags are there, in advance.
Anybody's help will be a releif!
Thanks in advance,
Leslie
Message was edited by:
user544830 -
ho can I extract the xml tags and its value in a java programs
Check out the API docs for javax.xml and javax.xml.parser. If you want to parse via DOM (IMHO, the easiest way to learn), then download Xerces from xml.apache.org. There are numerous FAQ's and HOW-TO's on that site.
- Saish -
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 ') -
Unknown deployment tag - web-app-class-loader
I can create the ear file with jdeveloper, but when deploy in 9iAs with the ear file, the next error apaers:
Deployment failed:
Unknown deployment tag in
orion-web.xml:
<web-app-class-loader>;
nested exception is:
java.lang.InstantiationException:
when deploy the system show the web module.
I have a CMP entity bean and too show in deploy.
I don't know wath can I do.
Please Help Me
Miguel Angel Caro
[email protected]I manually hacked the EAR file generated by JDeveloper 10g and removed the offending tag from the orion-web.xml
After removing the tag I was able to deploy the EAR to 9iAS (9.0.2.3) but now I am getting runtime errors...
Anyone who has gone through this please let me know!
Thanks! -
Are XML Tags starting with '_' underscore valid with XML DB?
Dear Experts,
I am importing an XML data file into an XMLType field in a table, then extracting data within a tag. I am using Oracle Database version 10.2.0.2.0
The data file I am using looks like:
<?xml version="1.0" ?>
<_PARENT>
<_EXAMPLES>
<_ITEM_NO>1</_ITEM_NO>
<_PAX_NO>1</_PAX_NO>
....etc.
If I then extract it using the command:
SELECT extractValue(e.XML_INVOICE_DATA, '/_PARENT/_EXAMPLES/_ITEM_NO')
FROM XXIBO_XML_STAGE_TABLE e
I get the error:
SQL Error: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00601: Invalid token in: '/_PARENT/_EXAMPLES/_ITEM_NO'
31011. 00000 - "XML parsing failed"
*Cause: XML parser returned an error while trying to parse the document.
*Action: Check if the document to be parsed is valid.
If I take out the '_' underscores prefixing the XML tab names e.g:
<?xml version="1.0" ?>
<PARENT>
<EXAMPLES>
<ITEM_NO>1</ITEM_NO>
<PAX_NO>1</PAX_NO>
....etc.
and run:
SELECT extractValue(e.XML_INVOICE_DATA, '/PARENT/EXAMPLES/ITEM_NO')
FROM XXIBO_XML_STAGE_TABLE e
This query works, which leads me to my origional question - is it invalid to have XML tags that are named starting with an underscore, when manipulating it in an XMLType object?
Many thanks for your time,
MarkAnts - thanks very much for that, has been useful.
Mark
Maybe you are looking for
-
USB-to-VGA adapter compatible with Mac?
Hi, I'm trying to hook up an additional external monitor to my MacBook Pro using a USB-to-VGA adapter. I don't need any kind of graphics acceleration. Here is the type of adapter I'm looking at: http://www.iogear.com/main.php?loc=product&Item=GUC2015
-
Variables not updating in Snippets
Hi there. I'm currently still on RoboHELP 8 and about to upgrade but I've found this issue is still a problem when I've upgrading my project to a trial version of RoboHELP 9 (with the critical update applied). It's on my local drive - no networks i
-
Expand/collapse folders in CS4 ?
Searched the forum and through offline help and tried every icon in the panels but can't find this. In DW CS4 how do you expand/collapse all folders in a site automatically ? Either in panel view or expanded full screen view ? Or do you have to open
-
Is it possible to continue using 28 while I see if I can customise 29 to my satisfaction?
A number of people have reported difficulty getting 29 to function like 28, enough that some have given up and reinstalled 28. So I am leery of abandoning 28 before I find out if I can make 29 work for me. Is there any way I can continue to use 28 wh
-
Does anyone experience banding when viewing images with gradients in them? I recently swapped a display from a 1GHz TiBook into a 1.67GHz Aluminum (non high-res) and have begun to notice this issue in the default OSX desktop wallpaper. Are the displa