Read Xml Child node from XML Blob
Hi Gurus,
Greetings
I am working in oracle 10g /Solaris platform.
I have table with columns namely id varcha2,pmt blob.
PMT stores xml file.
<Products xmlns:source="http://apache.org/cocoon/source/1.0" DocStatus="approved" DocTimeStamp="2013-04-18T06:52:14" DocType="PMT" DocVersion="xUCDM_product_external_1_3.xsd">
<Product Country="DE" IsAccessory="false" IsLocalized="true" IsMaster="false" Locale="de_DE" lastModified="2013-04-18T00:08:11" masterLastModified="2013-02-25T14:46:40">
<Assets>
<Asset code="46PFL8008S_12" description="User manual" extension="pdf" extent="3359201" lastModified="2013-04-18" locale="de_DE" number="001" type="DFU">http://download.p4c.abc.com/files/4/46pfl8008s_12/46pfl8008s_12_dfu_deu.pdf</Asset>
<Asset code="46PFL8008S_12" description="Leaflet" extension="pdf" extent="970750" lastModified="2013-04-18" locale="de_DE" number="001" type="PSS">http://download.p4c.abc.com/files/4/46pfl8008s_12/46pfl8008s_12_pss_deu.pdf</Asset>
<Asset code="46PFL8008S_12" description="Quick start guide" extension="pdf" extent="911832" lastModified="2013-04-18" locale="de_DE" number="001" type="QSG">http://download.p4c.abc.com/files/4/46pfl8008s_12/46pfl8008s_12_qsg_deu.zip</Asset>
<Asset code="46PFL8008S_12" description="Front product photograph - highres 2196x1795" extension="jpg" extent="1989253" lastModified="2013-04-18" locale="global" number="001" type="_FP">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-_FP-global-001</Asset>
<Asset code="46PFL8008S_12" description="Alternative product photograph 1 - highres 2196x1795" extension="jpg" extent="603474" lastModified="2013-04-18" locale="global" number="001" type="A1P">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-A1P-global-001</Asset>
<Asset code="46PFL8008S_12" description="Alternative product photograph 2 - highres 2196x1795" extension="jpg" extent="407701" lastModified="2013-04-18" locale="global" number="001" type="A2P">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-A2P-global-001</Asset>
<Asset code="46PFL8008S_12" description="Alternative product photograph 3 - highres 2196x1795" extension="jpg" extent="174261" lastModified="2013-04-18" locale="global" number="001" type="A3P">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-A3P-global-001</Asset>
<Asset code="46PFL8008S_12" description="Alternative product photograph 4 - highres 2196x1795" extension="jpg" extent="109712" lastModified="2013-04-18" locale="global" number="001" type="A4P">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-A4P-global-001</Asset>
</Assets>
</Product>
</Products>');
I want the extract the ids from the table where pmt contains the child node (asset) contains .zip
for example http://download.p4c.abc.com/files/4/46pfl8008s_12/46pfl8008s_12_qsg_deu.zip
Then, I tried like this...
select r.* from
(SELECT xmltype(pmt) object_value
FROM PRODUCT_TR_PMT
XMLTABLE
'for $Product in $TEST/Products/Product/Assets/Asset
return <RESULT>
$Product
</RESULT>'
passing OBJECT_VALUE as "TEST"
columns Asset path 'Asset'
) r;
ORA-02263: need to specify the datatype for this column
Could you kindly help.
Thanks
Raj
Blob storage we (db folks) dont have any control its from application standard design.
If necessary, i can create function blob to clob.
Kindly help me in extracting child node which contains zip.
select r.* from
(SELECT xmltype(pmt) object_value
FROM PRODUCT_TR_PMT
XMLTABLE
'for $Product in $TEST/Products/Product/Assets/Asset
return <RESULT>
$Product
</RESULT>'
passing OBJECT_VALUE as "TEST"
columns Asset varchar2(255) path 'Asset'
) r;
ORA-06553: PLS-306: wrong number or types of arguments in call to 'XMLTYPE'Thanks
Raj
Similar Messages
-
Update xml column by inserting any missing child nodes from a M_V
Hello all,
I am trying to update a xml column(col1) of a table (abc) by looping through, by selecting from a materialized view and find any missing (child) nodes in the existing table (abc) of a xml column (col1) on each rows, and then do update the xml column (col1) of table (abc). How to do this in Oracle pl/sql?.
Thanks & Regards,
JoshYou do not need stored procedure for that. Use something like APPENDCHILDXML, INSERTCHILDXML or INSERTXMLBEFORE. For example, to insert a node into XML document:
SELECT APPENDCHILDXML(
XMLTYPE(
CURSOR(
SELECT ENAME,
SAL
FROM EMP
WHERE DEPTNO = 10
'//ROW',
XMLTYPE('<ROW><ENAME>user631757</ENAME><SAL>10000</SAL></ROW>')
) EMP_XML
FROM DUAL
EMP_XML
<?xml version="1.0"?><ROWSET><ROW><ENAME>CLARK</ENAME><SAL>2450</SAL><ROW><ENAME
user631757</ENAME><SAL>10000</SAL></ROW></ROW><ROW><ENAME>KING</ENAME><SAL>5000</SAL><ROW><ENAME>user631757</ENAME><SAL>10000</SAL></ROW></ROW><ROW><ENAME>MILL
ER</ENAME><SAL>1300</SAL><ROW><ENAME>user631757</ENAME><SAL>10000</SAL></ROW></R
OW></ROWSET>
SELECT INSERTXMLBEFORE(
XMLTYPE(
CURSOR(
SELECT ENAME,
SAL
FROM EMP
WHERE DEPTNO = 10
'//ROW[ENAME="KING"]',
XMLTYPE('<ROW><ENAME>user631757</ENAME><SAL>10000</SAL></ROW>')
) EMP_XML
FROM DUAL
EMP_XML
<?xml version="1.0"?><ROWSET><ROW><ENAME>CLARK</ENAME><SAL>2450</SAL></ROW><ROW>
<ENAME>user631757</ENAME><SAL>10000</SAL></ROW><ROW><ENAME>KING</ENAME><SAL>5000
</SAL></ROW><ROW><ENAME>MILLER</ENAME><SAL>1300</SAL></ROW></ROWSET>
SQL> SY. -
Problem in delting child node from tree
Hello friends I have a problem in tree component
I am using Xml File with creator .
I am showing company name as a root node
then department name as a child of company name
then employee name as a child of department
Initialy its working fine ,user can add edit and delete any node
In add and edit option I have no problem but in delete I hava a problem
when I am deleting any child node and after deleting the node I am clicking on the root node of the deleted node the it gives me null pointer Ecxeption .
but user added any child node and then delete it then Application work properly .
What is the problem I can't Understand please help me
thanks
Raviraj Gangradethanks deepsix for helping me
it gives me java.lang.NullPointerException and class name is
net.sf.saxon.dom.NodeWrapper$ChildEnumeration
here is my Stack Trace
javax.faces.FacesException: #{Graphs.childNode_action}: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:307)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
... 44 more
Caused by: java.lang.NullPointerException
at pegasusweb.Graphs.childNode_action(Graphs.java:1075)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
... 45 more
|#]
[#|2006-11-30T14:51:30.000+0530|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=16;|StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
com.sun.rave.web.ui.appbase.ApplicationException: #{Graphs.childNode_action}: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.destroy(ViewHandlerImpl.java:601)
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:302)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)
Caused by: javax.faces.FacesException: #{Graphs.childNode_action}: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:307)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
... 36 more
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
... 44 more
Caused by: java.lang.NullPointerException
at pegasusweb.Graphs.childNode_action(Graphs.java:1075)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
... 45 more
|#] -
How can I remove child node from JTree???
Hi,
I would like to remove all the child node of my jtree. For instance I would like to remove the c, d, and e nodes. It's possible to remove all the child node or to remove by her name ("c", "d", and "e"). If yes what is the method that it permit to do.
A-----
|
b-------c
|
|--------d
|
---------e
I use the model : DefaultMutableTreeNode
ThanksThere are a couple of ways it can be done. If your tree uses DefaultTreeModel as its TreeModel, you can use removeNodeFromParent(). This will remove the node from its parent and effectively remove its children, too. All nodes removed will be garbage-collected if there are no other references to them.
If your tree model is not the default tree model, but still uses MutableTreeNode, you can use either remove() or removeFromParent() on the node itself, depending on whether you want to remove the node itself or one of its children.
On the other hand, your tree may use a model that simply "mirrors" another data structure, in which case you would have to remove the node from the other data structure and have it reflected in the model. -
How data in transferred to data nodes from Azure Blob?
I started a HDInsight cluster which was using a Azure blob storage. After looking at the jobs counters I noticed that there are some 'local' and 'rack-local' mappers for the job. I wonder to know what this local mappers mean? as far as I understood the architecture
of HDInsight, the data nodes and blob storage are located in two different clusters and data is transferred to data nodes over a high-speed network. So how come there exist 'local mappers'? how about 'rack local mapper'? Are the data first copy to local disk
of the data nodes and then get passed to the data nodes to get processed?Hi,
When HDInsight is performing its task, it is streaming data from the storage node to the compute node. But many of the map, sort, shuffle,and reduce tasks that Hadoop is performing is being done on the local disk residing with the compute nodes themselves.
The map, reduce, and sort tasks typically will be performed on compute nodes with minimal network load while the shuffle tasks will use some network to move the data from the mappers nodes to less reduce nodes. The final step of storing the dat back
to the storage is typically a much smaller dataset (e.g. a query dataset or report). In the end, the network is being more heavily utilized during the initial and final streaming phases while most of the other tasks are being performed intra-nodally
(i.e. minimal network utilization).
Regards.
Debarchan Sarkar - MSFT ( This posting is provided AS IS with no warranties, and confers no rights.) -
Get child nodes and only child nodes from a tree?
Hi all,
Relatively simple table
create table replaced_parts
old_part_number varchar(7),
replaced_part_number varchar(7),
updated_date date
insert into Replaced_parts values('AAAAA/1', 'BBBBB/1', '2012-Feb-16');
insert into Replaced_parts values('BBBBB/1', 'FFFFF/1', '2012-Feb-23');
insert into Replaced_parts values('YYYYY/3', 'ZZZZZ/3', '2012-Mar-17');
insert into Replaced_parts values('FFFFF/1', 'LLLLL/1', '2012-Mar-18');
insert into Replaced_parts values('LLLLL/1', 'HHHHH/1', '2012-Mar-19');The question is how do I issue a select using 'AAAAA/1' and get the result 'HHHHH/1'
i.e. (A... -> B, B->F, F->L, L->H)
and select using 'YYYYY/3' to get 'ZZZZZ/3' (Y... ->Z)?
It would be really nice if I could also get my original value, say, 'CCCCC/1' if there is no entry
for 'CCCCC/1' in the replaced_parts table (maybe NVL?).
I have googled and tried various combinations of CONNECT BY, PRIOR, ISLEAF... &c. but
am beating my head off a brick wall at the moment.
TIA,
Paul...>
Hi, Paul,Hi again Frank - couldn't sleep and am back at the "£$%^&* computer...
Yeah - it's a pity they weren't correct - I'll make doubly sure in future - see
my edited post (with DROP TABLE commands inter alia - I also removed
Order_Parts.User_Number since it was redundant - all that's needed is
Order_Number (normalisation) so now your SQL doesn't work - sorry
about that.
Just saying something "doesn't work" isn;t very helpful. What exactly is wrong with the SQL
statements I posted? Point out a couple of places where they are wrong, and explain how
you get the right results in those places.Nothing is wrong with your SQL - I meant *sorry* about the confusion in the DDL/DML from my end.
Now, I'm sorry again about the ambiguity of my English.
I'll reconstruct the original data that I gave you and re-run your SQL against that data - again,
this is *totally* my fault.
My tables creation script seems to work fine now - I've edited my reponse to Solomon - the definitive scripts
are now there - with Order_Parts.User_Number gone and the TO_DATE(...) as
you suggested - the VARCHARs seemed to give the right result though - but I
agree that if there's a correct way of doing it, then it should be done that way.
Remember why you need to go to the trouble of posting CREATE TABLE and INSERT statements
for some sample data here. It's to allow the people who want to help you to re-create the prolem
and test their ideas. I know, and that's why I did it - the OR REPLACE that I added (stupidly and without thinking or testing) was
so that people wouldn't have to go to the trouble of dropping the tables - I have now added
DROP TABLE blah... to the beginning of the script so it won't be necessary.
I have over 600 posts on this forum and only 26 questions - most of my time
spent here is trying to help (to the best of my limited ability - I'm not a guru
like yourself) and learning - it's amazing the number of times problems that
I've seen here have subsequently arisen at work - and I am frequently
frustrated by some posters' inability to explain their problem or at least give test
cases.
I can forgive bad English (except my own) - not everybody is a fluent speaker of the language,
but SQL should run no matter what language one speaks.
I appreciate that people are volunteering their time and effort here and I really do
try and make it as easy as possible for them when I ask questions - I messed up
this time, I'm afraid. It might also be the fact that I'm moving between SQL*Plus
and SQL Developer and a text editor that I got confused (plus, fatigue didn't help...)
In general, other people are not going to test anything on your system. I'm going to test
things on my system, Solomon will test things on his system, and other people will test things
on other systems. Well, if ever you're in Dublin ;). Again, I appreciate the effort that you, Solomon and sKr have
gone to in helping me.
Your INSERT earlier statements did not work on my system, because you were using a VARCHAR2
in a place where a DATE was required. The correct thing to do is to use DATEs where DATEs are required. Indeed, and I agreed with you that if there's a right way of doing it, then it should be done that way.
If your NLS settings are such that this is not causing you any errors right now, it's still a good
idea for you to fix it; but, at any rate, whether it works on your system isn't what's important in
this case; you're posting it to run on other peoples' systems.Ahhh.... <the blinding light of a moment of epiphany descends on Paul> I didn't realise it was
an NLS setting - of course Americans will be different - it's just that I thought that YYYY-Mon-DD
worked everywhere (I tried to avoid the day-first/month-first pitfall ) but now that you've explained
it to me, I'll *never* make that mistake again.
Yes - my mistake - I've now corrected the error
Where are the desired results? Don't merely hide them in an old message; post them in a new message.OK. I'll put it in a reply to this post. I really am endeavouring to be as clear as possible - please
excuse my errors - I will do better in future. I'm also very annoyed at my own incompetence and at
having put you to more trouble than you would have had to go to if I had my wits about me.
- should I keep Order_Parts.User_Number even
if it isn't conformant to normalisation rules?
If you have a good reason, it's okay to store de-normalized data. For example, some address tables in
the US contain both state and ZIP code, even though state is fucntionally depenedent on ZIP code. I think that in this case, denormalisation is not called for.
Re. the ZIP code thing, yeah, sure AIUI, the first two digits are dependent on the state, but the
last three? They're more or less random - at least in the sense that there's no way to type
in an address and calculate (mathematically, using a formula) them - so unless one were
to have weird SQL lookups to a "State" table for the first two digits and then take the final
three from a user-entered string field, then do a TO_CHAR on the returned 2-digit state number and add
this to the 3-character one - I can't see how the ZIP code is an example of this? But, maybe
(unless you wish to discuss that) we're getting side-tracked. Perhaps I'll ask this question
on comp.databases.theory?
Oracle actually added a new feature in version 11 (virtual columns) to make de-normalizing easier.Hmmm... is adding virtual columns denormalisation per se? My favourite "cheap'n'cheerful"
db server (Firebird) has had a COMPUTED BY clause (same idea) for yonks (> 12yrs) - no data
is actually stored - rather it is calculated on the fly. Another one for comp.databases.theory
perhaps?
BTW, wouldn't triggers remove all this hassle? It was my first idea, but trying to do it
purely through SQL is now *obsessing* me ;)
That would be another example of de-normalization. If the benefits of doing that outweigh the
costs, then go ahead. A trigger will take some effort to maintain, and it will make all DML slower, regardless
of how often that derived value is needed. Having the extra column will make some queries simpler and faster. Disk is cheap. Have an Original_Orders table (never changes) and a Revised_Orders table. When
a part replacement occurs - for orders that haven't been fulfilled (boolean flag?), change the
old part number to the new one. I can't imagine that replacement occurs very frequently, so
the expense of a trigger would IMHO be minimal - plus the down side of any trigger would
be mitigated by greatly simplifying the production of the Revised_Orders report?
... I'll experiment with what you've given me so far - but it's 23:40 here now, so I won't
get a chance to do it tonight - unfortunately, I *do* have to sleep.
If you haven't tested it yet, why did you start this message saying "your SQL doesn't work"?Sorry - what I meant was it obviously doesn't work when this eejit (i.e. me) has changed
the table structure - I did run it quickly (your 1st statement) against the (revised table
structure, the one you hadn't seen and I don't think even a man of your great SQL talents
can be expected to write working queries against unknown table structures :)).
Again, thanks for your help so far - I'll post the *_correct_* DDL and DML as a reply to this post
with the desired result. I'll also reconstitute the old (i.e. the one you worked against) tables
and data and let you know - again as a reply to this post - if I can at least learn something
from my fiasco, it won't have been a total waste of my time, and again, apologies for
wasting yours.
Thanks again and rgs.
Paul...
Edited by: Paulie on 22-Mar-2012 02:50 -
Copy node from XML tree problem
I am trying to copy an XML node 9whic hmay have child nodes) from one tree to another with the code
nodes = dataDoc.getElementsByTagName("text");
currentElement = (Element) nodes.item(0);
textNode.appendChild(nodes.item(0).cloneNode(true));
gives the error
org.apache.crimson.tree.DomEx: WRONG_DOCUMENT_ERR: That node doesn't belong in this document.
at org.apache.crimson.tree.ParentNode.checkDocument(ParentNode.java:250)
at org.apache.crimson.tree.ParentNode.appendChild(ParentNode.java:333)
What am I doing wrong?
Regards,
MArkWhat am I doing wrong?Failing to use the Document.importNode() method.
-
Need some help in reading the child nodes in a jTree after a parent node has been selected.
I've created a Jtree using DefaultMutableTreeNode. When I select a node, I'm able to read the contents of that node but can't figure out how to read all the children beneath it.
I'm using this code to read the current selected path:
TreePath tp1 = jTreeTOC.getSelectionPath();
Object bal_Grp[] = tp1.getPath();
int iNodeCnt = bal_Grp.length;
if (iNodeCnt > 1) {
String sTOCNode = bal_Grp[iNodeCnt-1].toString();
So my sTOCNode is the selected one, now how do I get the children.
Any help is appreciated.
ThanksRead the tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#select
If you use getLastSelectedPathComponent you get back DefaultMutableTreeNode object of the selected node.
You can use it to get the children of the selected node. -
Read Implementation class attribute from context node
Hello all,
I have a global atttribute in my Implementation class. How can I access this attribute from the getter setter method of an attribute in my Context node?
Regards,
Debolinahi ,
I discovered that we cannot access the child nodes from parent class,so instead I am using custom controllers -
Parent node showing in schema when child nodes not present
I had several folks answer my questions on mapping from a flat file to an EDI 835 schema and I am down to just a couple of issues before I finish up. I have a conditional mapping issue that I have to solve before I can map the rest of the document. I am
mapping three fields in a single non-repeating line in the flat file to a repeating segment in the 835. Basically I need to create a separate AMT_ClaimSupplementalInformation segment for each field in the flat file line. As you can see in the picture
below I want to create a AMT_ClaimSupplementalInformation segment for CDISCOUNT, CINELIGIBLE and CALLOWED.
You can see I have quite a bit of conditional logic attached to the three fields, but I have all three connected via a loop to the AMT_ClaimSupplementalInformation parent. I cannot attach the loop to the parent of the three fields because it only appears
once in the file. And if I leave the loop out the AMT segments get stacked funny, like this:
<AMT_ClaimSupplementalInformation>
AMT1
AMT1
AMT2
AMT2
</AMT_ClaimSupplementalInformation>
You can see how they should be stacked in the next pic.
In some cases however, one of those fields may be blank so I will not need to create a AMT_ClaimSupplementalInformation segment for it. I was able to use some conditional mapping ideas you guys gave me using the Not-Equal and Value Mapping functoids, and
that works great to keep blank child nodes from being created. However, Since I have a loop attached to the AMT_ClaimSupplementalInformation parent node it still creates an empty parent node even when the child nodes are not created. See the empty parent
node in the pic below.
Since looping functoids can only be attached to links I don't know how to make the parent node conditional.
Any suggestions?
Thanks.Boatseller, thanks for the tip. I did end up going the XSLT direction. It's a bit of a hack, but I'm using the following XSLT to eliminate empty nodes :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:if test=". != ''">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
I created a new map with the 835 schema on each side. I then created an XSLT file and pointed to it in the Custom XSLT Path property. It seems to work well. I call this map right after my FlatFile_To_835 map.
I was hoping to use the scripting functoid with inline XSLT in the map so that I didn't have to worry about deploying the XSLT file(just another thing to keep up with in the future), but when I compile it I get the following error:
The "Scripting" functoid has 1 input parameter(s), but 2 parameter(s) are expected.
I'm wondering if I'm connecting the schemas incorrectly in the map:
In any case, I'm past the empty nodes issue for now, which was a big roadblock. Now I have to deal with the CAS segments which are, as you said, a real pain.
Thanks for all of your input. -
Hi,
I have done a application with Tree by NST table .
The initial screen will contains around 6 fields , the first field (ObjKey) will be displayed. I have stored in one internal table and i i want to display the child node for correponding objkey,for that child node again im storing in to the same internal table . now when i to expand the child node from the output there was no details coming , i got one empty line thats it .
I have seen many links available in the forum. but not helpful , please explainhi andre .
i am also facing same problem .......
my context is like ......
folder
| folder_content (recurcive node)
| file
| | file attribute
| folder attribute.
can u plz tell me about recurcive node .... if have any doc. then plz give the link ....
thanks . -
I need to be able to get a String with the original xml for all the child nodes once I traverse a DOM tree and find a particular node.
Use the method suggested above, but unless you've done it before it might not be obvious how to get it into a string.
Here's the trick:
// Create a StringWriter
StringWriter sw = new StringWriter();
// Wrap the StringWriter with a PrintWriter
PrintWriter pw = new PrintWriter(sw);
// Print the node, passing the printwriter
yourNode.print(pw);
// Retrieve the string result from the underlying stringwriter
String theXMLText = sw.toString(); -
Deleting Nodes from XML Tree (JTree)
I have created a XML Tree(extended from JTree) using XNodes ( extended from DefaultMutableTreeNode)
After some insertions, i need to delete certain nodes from the XML Tree.. but after deletion, XNode will be null.
subroutine is as follows...
appreciates any advice
Thanx
private XNode RemoveExtraNode( XNode xNode ){
int child;
String nodeType;
XNode childNode=null;
if ( (child=xNode.getChildCount() ) > 0){
for(int i=0;i<child;i++){
childNode=(XNode)xNode.getChildAt(i);
nodeType = childNode.getType();
if(nodeType.equals("DTD") )
childNode.removeFromParent();
}//end for (int i=1;i<child;i++)
}//endif((child=xNode.getChildCount())!=0)
return xNode;
}//RemoveExtraNodeHi IKEDA
Thanx for the reply.
I have tried xNode.remove(childNode) b4 and it still return a null JTree.
Anyway fyi i discover i can delete last child of xNode and return the correct java tree. therefore to delete a node of my choice i simply insert its next sibling nodes in its place and delete that particular node when it becomes the last child. -
Just starting to learn about XML.
I have a simple XML file that I created which is as follows
<?xml version="1.0" encoding="utf-8" ?>
<Probes>
<Probe>
<Location>Ambient</Location>
</Probe>
<Probe>
<Location>panel1</Location>
</Probe>
<Probe>
<Location>panel2</Location>
</Probe>
<Probe>
<Location>panel3</Location>
</Probe>
</Probes>
Using XML Property Node - Child Nodes Array results in an array of 9 elements:
#text
Probe
#text
Probe
#text
Probe
#text
Probe
#text
My question is what are all the #text that are there? Shouldn't the child nodes be just the probes?
Solved!
Go to Solution.It sounds to me like you may be heading down a dark path. Instead of using the 'Child Nodes Array' and fighting through the complications like extraneous text nodes, let me suggest you look into XPath and use 'Get All Matched Nodes.vi' or 'Get First Matched Node.vi' to get the elements. XPath makes parsing XML a breeze.
For Example:
Of course I hope that using XP does not mean you are using LV8.6 or earlier since the XPath VIs are new to LV9.
If you are using LV8.6 or earlier I suggest looking into the .NET functions to implement XPath. Once you get the hang of it, it still beats trying to parse XML the old fashioned way.
As to the editor, I generate very few XML files by hand, mostly I get them from other programs and parse them in LV. Again, XPath smooths out the rough edges. -
Adding multiple same-name nodes from one xml into another
Hi,
Following on from my question the other day (Adding multiple different nodes from one xmltype into another), I now have a slightly more complex requirement that I cannot work out where to start, assuming that it's something that can reuse some/all of yesterday's work (thanks again, odie_63!). ETA: I'm on 11.2.0.3
So, here's the (slightly amended) xml along with yesterday's solution:
with sample_data as (select xmltype('<root>
<xmlnode>
<subnode1>val1</subnode1>
<subnode2>val2</subnode2>
</xmlnode>
<xmlnode>
<subnode1>val3</subnode1>
<subnode2>val4</subnode2>
</xmlnode>
</root>') xml_to_update,
xmltype('<a>
<b>valb</b>
<c>valc</c>
<d>
<d1>vald1</d1>
<d2>vald2</d2>
</d>
<e>vale</e>
<f>valf</f>
<g>
<g1>valg1</g1>
<g2>valg2</g2>
</g>
<h>
<h1>valh1</h1>
<h2>valh2</h2>
</h>
<multinode>
<name>fred</name>
<type>book</type>
<head>1</head>
</multinode>
<multinode>
<name>bob</name>
<type>car</type>
<head>0</head>
</multinode>
</a>') xml_to_extract_from
from dual)
select xmlserialize(document
xmlquery(
'copy $d := $old
modify (
insert node element extrainfo {
$new/a/b
, $new/a/d
, $new/a/f
, $new/a/h
} as first into $d/root
return $d'
passing sd.xml_to_update as "old"
, sd.xml_to_extract_from as "new"
returning content
indent
from sample_data sd;
That gives me:
<root>
<extrainfo>
<b>valb</b>
<d>
<d1>vald1</d1>
<d2>vald2</d2>
</d>
<f>valf</f>
<h>
<h1>valh1</h1>
<h2>valh2</h2>
</h>
</extrainfo>
<xmlnode>
<subnode1>val1</subnode1>
<subnode2>val2</subnode2>
</xmlnode>
<xmlnode>
<subnode1>val3</subnode1>
<subnode2>val4</subnode2>
</xmlnode>
</root>
However, I now need to add in a set of new nodes based on information from the <multinode> nodes, something like:
<root>
<extrainfo>
<b>valb</b>
<d>
<d1>vald1</d1>
<d2>vald2</d2>
</d>
<f>valf</f>
<h>
<h1>valh1</h1>
<h2>valh2</h2>
</h>
<newnode>
<name>fred</name>
<type>book</type>
</newnode>
<newnode>
<name>bob</name>
<type>car</type>
</newnode>
</extrainfo>
<xmlnode>
<subnode1>val1</subnode1>
<subnode2>val2</subnode2>
<type>book</type>
</xmlnode>
<xmlnode>
<subnode1>val3</subnode1>
<subnode2>val4</subnode2>
<type>car</type>
</xmlnode>
</root>
If it's easier, I *think* we would be ok with something like:
<newnode>
<type name="fred">book</type>
<type name="bob">car</type>
</newnode>
The closest I've come is:
with sample_data as (select xmltype('<root>
<xmlnode>
<subnode1>val1</subnode1>
<subnode2>val2</subnode2>
</xmlnode>
<xmlnode>
<subnode1>val3</subnode1>
<subnode2>val4</subnode2>
</xmlnode>
</root>') xml_to_update,
xmltype('<a>
<b>valb</b>
<c>valc</c>
<d>
<d1>vald1</d1>
<d2>vald2</d2>
</d>
<e>vale</e>
<f>valf</f>
<g>
<g1>valg1</g1>
<g2>valg2</g2>
</g>
<h>
<h1>valh1</h1>
<h2>valh2</h2>
</h>
<multinode>
<name>fred</name>
<type>book</type>
<head>1</head>
</multinode>
<multinode>
<name>bob</name>
<type>car</type>
<head>0</head>
</multinode>
</a>') xml_to_extract_from
from dual)
select xmlserialize(document
xmlquery(
'copy $d := $old
modify (
insert node element extrainfo {
$new/a/b
, $new/a/d
, $new/a/f
, $new/a/h
, element newnode {
$new/a/multinode/name
,$new/a/multinode/type
} as first into $d/root
return $d'
passing sd.xml_to_update as "old"
, sd.xml_to_extract_from as "new"
returning content
indent
) fred
from sample_data sd;
Which produces:
<newnode>
<name>fred</name>
<name>bob</name>
<type>book</type>
<type>car</type>
</newnode>
- obviously not right!
Can anyone provide any hints? I've tried searching for similar examples, but I mustn't be putting in the right search terms or something!odie_63 wrote:
or, similarly, to get the alternate output :
copy $d := $old
modify (
insert node element extrainfo {
$new/a/b
, $new/a/d
, $new/a/f
, $new/a/h
, element newnode {
for $i in $new/a/multinode
return element type {
attribute name {data($i/name)}
, data($i/type)
} as first into $d/root
return $d
So we're going with the second method, but I've discovered that the "$i/name" node is not always present. When that happens, I would like to use a default value (for example, "george"). I promise I've searched and searched, but I'm completely failing to turn up anything that sounds remotely like what I'm after (seriously, I can't believe my google-fu sucks this badly!).
Is there a simple way of doing it? The only thing that I've found that looks vaguely relevant is "declare default namespace...." but I'm not sure that that's the correct thing to use, or if it is, how I'm supposed to reference it when populating the attribute value.
Maybe you are looking for
-
Not sure if its new itunes or new ipod nano
At first I plugged the ipod in and had no problem loading my songs on. I disconnected it and listened to it for about an hour before plugging back in to make some playlists. That's when the new Itunes started downloading and everything went crazy. Wh
-
I bought a device in NYC - how can I get a copy of the invoice?
Last April we bought an I-Pad mini in NYC - Grand Central Station and now I need to send it in for service as it does not power on. Somehow I cannot find the electronical invoice that was sent to me via email at the time, does anyone know if there is
-
Use of negative Plan values in CJ40
Hi everyone I would like to know if anyone uses negatives plan values via CJ40 to reflect possible refunds ect. If you have, has there been any impact on any areas, eg reporting, end of year roll etc. Alternatively, how does your area process such
-
Hi, I have a requirement like to store and retrieve video files and pdf files in a CLOB datatype in an oracle table (10g). Is it possible to store video files in CLOB? If yes plz provide me a sample code. Thanks in advance. Regards, Karthik.K Edited
-
Deleted OSX partition after installing windows
I installed windows 8 in bootcamp, everything was fine and working properly. I have now deleted the osx partition and was wondering if i ever wanted it back could i use the internet recovery to do so, as i don't have a disk or anything that came with