Add a tag and value to an XML document
Hi there,
Is it possible, indeed are there any functions that would help me, to add a tag onto an XML document that has been already created without having to use XSLT?
Perhaps someone could advise a function?
The only way in 9.2 is to use DBMS_XMLDOM package or to recreate the entire parent node and use updateXML(). 10g have some new features that are behind an event that allow these operations to be done directly in SQL.
Similar Messages
-
Getting Tag and value from the selected Xml element value
Hi All,
I have an xml file which i import to the Indesign CS3 .From the structure view , i drag and drop the root node on to the page. Now i select an xml value from the page. Now i need to get the element tag and value from the selected value.
For example
File Name : sample1.xml
<Root>
<employeeName> A</employeeName>
<employeeEmail>[email protected]</employeeEmail>
</Root>
Now i import this sample.xml in my indesign CS3 and from the structure view i drag the Root tag and drop it on the page.Now the values of the element tag are displayed.
Now i select "[email protected]" from the page and i have a menu "Get Selected XML" on clicking which i should get element tag with value.(i.e <employeeEmail>[email protected]</employeeEmail>)
How to go about it.?
Thanks
SakthiHi Steve,
If you haven't already done so, I recommend posting this question in the LivCycle Forms forum.
Jared -
Want to include ?xml tag and schema when creating XML
My database table that need to be generated in to XML are large and therefore I must use OracleXMLQuery.getXMLSAX . The output is missing the <?xml version="1.0" ?> tag. How do I get it? I am on 9i but have imported the .jar containing oracle/xml/parser/v2/XMLSAXSerializer from 10g XDK.
Also, I want the schema to be written next, before the actual XML table values.
I know that a command line parameter exists, which works for small XML files:
java oraclexml getxml -user "scott/tiger" -withDTD "select ....
How do I get the equivalent of '"-withDTD" when using
OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from "+table_name );
qry.getXMLSAX(myStream);
myStream.flush();
Thank you,
ElaineNo. Actually, I can get the <?xml tag and DTD if my select statement contains 'where rownum=0', as the resultset is small which lets me use getXMLMetaData() .
I write it to one output file, then do another OracleXMLQuery, repeating the select statement without the where clause, and run that through getXMLSAX to get the detail.
Next, I need to scrub the data of special characters acceptable in the database but which cause problems to a browser or XML validator. (e.g. accented characters).
Finally, I will concatente the two files.
Is there a simpler way to do this?
Thanks,
Elaine -
JAXB / Needs to add header tag and close the header tag at the bottom
I have successfully generated a XML file based on the XSD. I want to add another tag to my generated XML which is not the part of the XSD. Its like adding my whole xml inside a new tag. Is there a way to achieve it?User_10111723083878.xml
to this xml, I want to add as the parent element "<addRequest targetID="BottomLineTarget" executionMode="asynchronous" xmlns="urn:oasis:names:tc:SPML:2:0">
<data>" and close it at the bottom of the xml.
Is it possible?the easiest way would be to create an xsd which includes this new wrapper element, and wrap the original object with your new wrapper object before serializing.
an alternative would be to serialize the original object into a DOM object, then add the wrapper element manually before serializing that DOM object to your final destination (e.g. the xml file). -
Get the attributes NAME and VALUE from an XML
I really love this forum :)
I load an XML an populate a Tree, from which I start to drag
items.
the xml looks like this:
<myTag attrName="attrValue"
otherAttrName="otherAttrValue"/>
var ds:DragSource = event.dragSource;
var var1:String =(event.dragInitiator as
Tree).value.@attrName;
-> the var1 variable has now: "attrValue"
my question is.. how can I get all the attributes' names? in
this example: attrName and otherAttrName (suppose I don't know the
structure of that xml node)
what about attributes values?
thank you!The snippet below takes an xml node(nodeCur), loops over the
attributes list and builds an array that contains the attribute
name and value for each attribute. It comes from a sample app that
allows you to edit an xml file.
Sorry that the forum will remove the formatting
var aDPAttributes:Array = new Array();
var xlAttributes:XMLList = nodeCur.@*;
var attribute:Attribute;
for ( var i:int = 0; i < xlAttributes.length(); i++) {
aDPAttributes.push({name:xlAttributes [ i ]
.name(),value:xlAttributes [ i ] });
dgAttributes.dataProvider = aDPAttributes; //set the property
sheet dataProvider
Tracy -
Detecting column name and value from a xml
Dear all,
I need to create a procedure to get a xml file. The xml file may contain a table data or procedure parameter value. Off course it will also contain a flag if the data is of a procedure or table nnd then it's table or procedure name, column name(in case of table), and value. The procedure will receive the xml file and it does not know the column name in case of table or parameter name in case of procedure and then its value. i.e i have to parse the xml file without knowing the column name for table or parameter for procedure. Then i may populate data to my need. How can i do that? Please help me.
BR.
Tarik
Edited by: Tarik_kuet on Sep 23, 2008 2:32 PM
Edited by: Tarik_kuet on Sep 23, 2008 2:32 PMYou need to cast your data into an xmltype and look for the existence of nodes for tables, proceduresm etc
with xmldata
as
(select xmltype('<?xml version="1.0" encoding="UTF-8"?>
<Sample UniqueID="KWID_AP" >
<Description>Sample Application</Description>
<Table Name="SampleTable" />
<Procedure Name="SampleProc" />
</Sample>') xml
from dual)
select * from xmldata
where existsnode(xml,'/Sample/Procedure')=1 -
How to search for a text node with a particular value in an xml document with labview
supposing i have the following xml document:
<head>
<book>
<bookname>zio</bookname>
<author>dan</author>
</book>
<book>
<bookname>the spear warrior</bookname>
<author>britney</author>
</book>
<book>
<bookname>the beard</bookname>
<author>derrick</author>
</book>
</head>
i want to search for the author of the book "the beard" using for example the V.I Get first match of labview to access the the node with value "the beard" and then use Get next sibling V.I and Get node text content to get get the author of this book..so my question is how do i write the xpath expression for Get first match so as to access the node with bookname "the beard" instantyly? am trying to minimise the use of loops because they increase the time duration,..thank you (NB:i dont want to use Get all Matched V.I because it obliges me to use a loop in order to access the name derrick and this increases the time duration for my v.i)
Solved!
Go to Solution.Since it's all text, why not use a real quick Match Pattern (or Regular Expression, but you don't need that much power here), see attached.
Cameron
To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.
To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
LabVIEW Unit 1 - Getting Started
Learn to Use LabVIEW with MyDAQ
Attachments:
Two-stage match demo.vi 8 KB -
How to Add namespace to all elements in a xml document
Hi,
I am trying to read an xml file that does not have any namespace definitions. I have been able to create another schema in which i specify the namespace defination as shown below.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://TargetNamespace.com/AckPaymentFile_PL" targetNamespace="http://TargetNamespace.com/AckPaymentFile_PL" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" nxsd:version="DTD" elementFormDefault="qualified" attributeFormDefault="unqualified">
<include schemaLocation="PM_XML_FILE_ACK_SCHEMA_NO_NAMESPACE.xsd"/>
</xs:schema>
Once i do it, i am able to see the namespace has been assigned to the root element. I am looking for a way to assign the namespace and prefix tag to all elements in the xml document. If i don't i am unable to access any part of the xml document, keep getting please verify if xpath is correct.
Thanks
SridharHello,
Once you've answered all the above.
If you can run xpath that supports functions against the xml, the expression:
count(//phone)Otherwise, without leaving SQL:
select count(*) from
xmltable('//phone' passing
-- Your XML goes here, could be a table column with type XMLTYPE.
xmltype('<person><phone>123-456-7890</phone><phone>098-765-4321</phone></person>')
columns phone varchar2(24 char) path '/phone'
; -
How do I add (or insert) a node into an XML document with JSTL?
Dear all,
I am trying to use JSTL to store some data from a form into XML. However, I have read many articles in JSTL and only found that it can only be, as far as those articles are concerned, used to "read" data from XML files, but not "write" to them.
Am I missing something in JSTL? Or, if I want to write to an XML file (e.g., insert a new node, or modify a node's data), will I have to write my own bean and then use <c:usebean />?
Thanks very much in advance.
Regards,
RobertJSTL is not a programming language in and of itself. It is intended to help you to write scriptlet free JSPs.
JSP pages (by one school of thought) are intended to function as the "View" in a Model-View-Controller architecture.
Being a view, JSP pages should be able to look at things - but not touch.
The standard pattern is to go to a servlet first, which invokes the logic, and then forwards to a JSP for rendering.
Editing XML by adding new nodes etc etc is thus a function of the java code layer - servlet/action whatever you want to call it.
Giving you the power to edit XML documents via JSTL (ie on a JSP page) takes away from purity of the MVC design.
Hence why they don't provide the tags for manipulating XML, and only provide the database tags with a disclaimer that they should only be used for prototypes/trivial apps!
JSTL is designed to replace scriptlet code on a JSP page.
It can replace 99% of scriptlet code. The other 1% shouldn't be on the JSP in the first place :-)
cheers,
evnafets -
How to filter xml using dtd and create a new xml document
Good morning my name is Antonio and I'm an italian programmer.
I need an help about the follow question.
I want to filter the contents of a XML document using a DTD to allow
only the valid elements and attributes as specified in the DTD to be
passed through to the output, any data that does not conform to the DTD
should be filtered out.
To resolve this problem there's XML Translator Generator (XTransGen): http://www.alphaworks.ibm.com/tech/xmltranslatorgenerator
but at moment it's not avaiable.
Can you help me?
Many thanks.
ciao
Antonio...
-
Task to add new row and values to Table?
Hi, I am new to SSIS, I have a table that I would like to capture daily currency conversion rates. In my Control Flow
pane, I've been able to use a web service task to get a string value of the conversion rate pass it to an XML task, and connect it to at Data Flow Task. So now I'm not sure what to do from here. I would like to input the daily values into my table:
[CurrencyID] [int] IDENTITY(1,1) NOT NULL,
[CurrXDate] [datetime] NOT NULL,
[Country] [nvarchar](50) NOT NULL,
[CurrXRate] [float] NOT NULL,
insert into tbl_CurrXrates
(CurrXDate, Country, CurrXRate)
values
(getdate(), 'USD', @[User::ConversionRate])
What data tasks and order would I use to add a new row to my table which I think would be a simple insert statement. Hope my
question makes sense.You can put into a package variable and use as part of the insert statement via a SSIS expression to drive a Execute SQL Command to insert it or
Have the value off the webservice dumped to a XML file and then consume it with XML Source which will allow the values to be inserted into the table (e.g. OLEDB Destination)
Arthur
MyBlog
Twitter -
Add schema location and version to the XML file header
HI, I used XMLBean to generate a XML file:
<?xml version="1.0" encoding="UTF-8"?>
<bo:TXLife xmlns:bo="http://ACORD.org/Standards/Life/2">
</bo:TXLife>
I need add a schema location, a version, another name space so the header looks
like:
<?xml version="1.0" encoding="UTF-8"?>
<bo:TXLife xmlns:bo="http://ACORD.org/Standards/Life/2"
xmlns:xsd="http://www.w3.com/2001/XMLSchema"
xmlns:xsi="http://www.w3.com/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.iit.com/schema/Schema29.xsd"
version="2.9">
</bo:TXLife>
Thanks,Thanks Steve.
Your right, it seems that I can't access the attribute or in this case add it
by just editing the xsd. At least I haven't found a way to do that.
The cursor solution works ok, but we'll have to add that code to every transformation
etc.
Timo
"Steve Traut" <[email protected]> wrote:
Hello Timo -- Unless your schema defines the attribute as part of the
element you want to edit, I don't think you'll get access to the attribute
through JavaBeans-style accessors.
If you have any feedback about why the cursor won't work in your situation,
though, I'd love to hear it.
Steve
"Timo Lukumaa" <[email protected]> wrote in message
news:[email protected]...
Hello, where having a similar problem. We need a schema locationdefinition so
that XML is valid. We can edit the xsd files and add stuff there, wouldthere
be a way to do that with out the cursor? This cursor solution isn'ttoo
nice..
"Steve Traut" <[email protected]> wrote:
Henry -- You'll need an XmlCursor for inserting attributes that aren't
defined in your schema. Try something like the following.
TXLifeDocument txLifeDoc = TXLifeDocument.Factory.newInstance();
TXLife txLife = txLifeDoc.addNewTXLife();
// Create a cursor and move it to where you want to start inserting
attributes.
XmlCursor cursor = txLife.newCursor();
cursor.toFirstContentToken();
cursor.toLastAttribute();
// Insert your attributes.
cursor.insertAttributeWithValue("schemaLocation","http://www.w3.com/2001/XM
L
Schema-instance", "http://www.iit.com/schema/Schema29.xsd");
cursor.insertAttributeWithValue("version", "2.9");
cursor.insertNamespace("xsi",
"http://www.w3.com/2001/XMLSchema-instance");
cursor.insertNamespace("xsd", "http://www.w3.com/2001/XMLSchema");
// Dispose of the cursor.
cursor.dispose();
Steve
"Henry Niu" <[email protected]> wrote in message
news:[email protected]...
HI, I used XMLBean to generate a XML file:
<?xml version="1.0" encoding="UTF-8"?>
<bo:TXLife xmlns:bo="http://ACORD.org/Standards/Life/2">
</bo:TXLife>
I need add a schema location, a version, another name space so theheader
looks
like:
<?xml version="1.0" encoding="UTF-8"?>
<bo:TXLife xmlns:bo="http://ACORD.org/Standards/Life/2"
xmlns:xsd="http://www.w3.com/2001/XMLSchema"
xmlns:xsi="http://www.w3.com/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.iit.com/schema/Schema29.xsd"
version="2.9">
</bo:TXLife>
Thanks, -
How to add meta tags and keywords, I cannot find a way to do that
Does somebody know how can I add content and keywords to my website dome with I web?
It seems it is important for search engines to find it!Content is what you add to your page. The visible part your visitors can see.
Keywords have to be added with [a META tag in the HEAD|http://www.google.com/search?q=meta%20tag%20head] of the webpage. That cannot be done in iWeb. You have to edit the published pages with a HTML Editor of your choice.
It's debatable whether these keywords have any impact on being found by a Search Engine.
Provide good content. -
Getting Node Value of an XML document in JAVA.
Hi,
In my application, I have got the exact node that I want by parsing the document, but the node value returned is null as the node is an element and the Java Documentation does specify that it will return null. I would like to know if there in any alternative way by which I can parse the document and get the specified value of the node or element. Kindly Help.Well, there are not many mind readers on this forum.
You do not tell us how you are parsing the document, and so it is difficult determining why the node value is returned as a null.
There are two main styles of processing XML -- DOM and SAX. Dom (and its variants JDom and I think Dom4J) build a tree structure that is memory-resident. There are ways to walk up and down the tree, and locate arbitrary nodes in the tree.
The other style is SAX, which is much less intensive from a memroy perspective, but puts more work on you to keep what you want as the data goes flying by.
So, how are you "parsing the document" and what method is returning a null? That may give someone enough information to guess at your problem.
Dave Patterson -
Using Oracle Text to find attribute values in a XML document
Can anybody help me? I created a index on a URIType column,
create index my_index on uri_tab(docurl) indextype is ctxsys.context parameters ('SECTION GROUP my_sections').
Before index creation I executed these two functions, which prepare Oracle on text search in attribute sections: ctx_ddl.create_section_group('my_sections','XML_SECTION_GROUP') and exec ctx_ddl.add_attr_section('my_sections','machinetype','MachineType@text')
After index build I looking for an attribute value.
SELECT e.docName FROM uri_tab e WHERE CONTAINS(e.docurl,'SM_52 WITHIN machinetype') > 0;An advise to read Oracle documentation is great but I have done it already and didn't find a way to check a syntax of an attribute retrived from LDAP server.
I haven't find anything new in $ORACLE_HOME/RDBMS/admin/dbmsldap.sql as well.
Let's take an example. I have taken some attribute from LDAP server by dbms_ldap.first_attribute and would like to know if the values of this attribute are strings or some binary staff.
How can I do it?
Maybe you are looking for
-
In a single program how to lookup different EJB from different application
Hi, I have deployed two applications app1 and app2 on oc4j. There is a stateless session bean in a1 called ejb1. And there is also a stateless session bean ejb2 in app2. I write a test jsp in app1 to lookup ejb1 and ejb2 as an application client. So
-
I have a samsung smart tv i want to play my pogo but will not update for me
i have a samsung smart tv and want to play my pogo but it will not updat for me what do i do
-
Slow computer and Prebinding Woes
Greetings. I have been experiencing slow overall system performance as of late on my Dual 2.0GHZ G5. Normally, a repair permissions and prebind will solve this problem. I tried this last night, however when I ran prebinding from the terminal, it aske
-
IPod Touch Blueprints / Schematics?
I am a 3D artist and I want to design and make my own case for my new iPod. Can anyone direct me to a location I can download the Blueprints / Schematics for the new iPod Touch?
-
I have downloaded iOS 6 to my iTunes but I have clicked "Download Only" not "Download and Update" how do i install/sync it to my iPad. Please help me, its taken me hours to download it i don't want to do it again PLEASE HELP ME!!!