Problem while appending child nodes
hi
when i run the below program i got output like this
?xml version = '1.0'?>
<Products>
<Product/>
<ProductName>sugar</ProductName>
<Price>242</Price>
<Product/>
<ProductName>mint</ProductName>
<Price>4764</Price>
</Products>
but i want output like this
<?xml version = '1.0'?>
<Products>
<Product>
<ProductName>sugar</ProductName>
<Price>242</Price>
</Product>
<Product>
<ProductName>mint</ProductName>
<Price>4764</Price>
</Product>
</Products>
what changes should i made to the program to get o/p like above xml,;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.*;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.StringWriter;
import java.io.IOException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
public class CreateUsingDom {
public static void saveDocAsFile(Document doc, String fname) {
try {
TransformerFactory tfFac = TransformerFactory.newInstance();
// use null trandformation
Transformer tf = tfFac.newTransformer();
tf.setOutputProperty(OutputKeys.INDENT,"yes");
tf.transform(new DOMSource(doc), new StreamResult(System.out));
/* catch (IOException ioe) {
ioe.printStackTrace();
catch (TransformerException e) {
e.printStackTrace();
public static String returnDocAsString(Document doc) {
StringWriter sw = new StringWriter();
try {
TransformerFactory tfFac = TransformerFactory.newInstance();
// use null trandformation
Transformer tf = tfFac.newTransformer();
tf.transform(new DOMSource(doc), new StreamResult(sw));
catch (TransformerException e) {
e.printStackTrace();
return sw.toString();
public static void main(String[] args) {
String fname="t.xml";
DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = fac.newDocumentBuilder();
Document doc = db.newDocument();
Element rt = doc.createElement("Products");
doc.appendChild(rt);
String main[] = {"Product","Product"};
String productnames[] = {"ProductName","ProductName"};
String product[] = {"sugar","mint"};
String price[] = {"Price","Price"};
String priceValues[] = {"242","4764"};
for(int i=0;i<productnames.length;i++){
Element main1 = doc.createElement(main);
Element productnames1 = doc.createElement(productnames[i]);
Text product1 = doc.createTextNode(product[i]);
Element price1 = doc.createElement(price[i]);
Text priceValues1 = doc.createTextNode(priceValues[i]);
productnames1.appendChild(product1);
price1.appendChild(priceValues1);
rt.appendChild(main1);
rt.appendChild(productnames1);
rt.appendChild(price1);
saveDocAsFile(doc,fname);
catch (ParserConfigurationException e) {
e.printStackTrace();
bye
chaitanya
hi
i solved the problem on my own;
Similar Messages
-
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
|#] -
Problem when selecting child node in Hierarchical Tree
I have a hierarchical tree on a form populated thru a table query(form1). When I click on a child node, it opens form2 which contains a tab canvas. After closing forms, I return to the form1(containing Tree). At this point If I want to click on the same child node, I should be able to open form2 again. This doesn't happen.
I have the following code in my When-Tree-node_selected trigger:
Declare
htree item;
vnode_label varchar2(50);
node_clicked FTREE.NODE;
vnode_value number;
vnode_depth number;
v_type number;
v_value varchar2(100);
v_form_name varchar2(100);
v_alert_return number;
begin
-- Find the tree itself.
htree := FIND_ITEM('tree_block.tree');
node_clicked := :SYSTEM.TRIGGER_NODE;
vnode_value := FTREE.NODE_label;
-- Find the value of the node clicked on.
vnode_label := FTREE.GET_TREE_NODE_PROPERTY (htree,:SYSTEM.TRIGGER_NODE,FTREE.NODE_label);
vnode_depth := to_number(ftree.get_tree_node_property(htree,:SYSTEM.TRIGGER_NODE,ftree.Node_depth));
--Open form for node selected on tree and/or specific tab page
if vnode_depth <> 1 then
if :system.trigger_node_selected = 'TRUE' then CASE vnode_label
WHEN 'Personal' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
WHEN 'Citizenship' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
WHEN 'Emergency Contact' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
if id_null(Find_form(v_form_name)) then
open_form(:global.application_path || v_form_name,ACTIVATE,NO_SESSION,SHARE_LIBRARY_DATA);
else
go_form(v_form_name);
end if;
END IF;
elsif vnode_depth = 1 then
if :system.trigger_node_SELECTED = 'TRUE' then CASE vnode_label
WHEN 'EMPLOYEE INFO' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
vnode_label := 'Personal';
WHEN 'REPORTS' then
v_form_name :='HR_REPORTS';
vnode_label := '';
if id_null(Find_form(v_form_name)) then
v_form_name := :global.application_path || v_form_name;
open_form(v_form_name,ACTIVATE,NO_SESSION,SHARE_LIBRARY_DATA);--,p_list);
else
go_form(v_form_name);
end if;
end if;
end;
Can anyone please help me? I don't want the user to double click. They should only click once.
Thanks,
MercedesRight clicking does not change the current selection. The tree has no way to report what node was right clicked. Only work around is to left click the node you wish then right click it.
--pat -
Error while appending a Node to another as child
HI,
I am new to XML and trying to add a Node n2 as a child to Node n1 and getting error "Node does not belong to current XML document" .Iwas getting these Node objects through APIs written by somebody.I am doing like this.
Node n1 = SomeAPI.methode();
Node n2 = SomeAPI.method();
now n1.appendChild(n2);
is this the right approach can anybody post sample code how to do this.be sure n1 and n2 has the same owner document,if not u can do like this:
Node n1 = SomeAPI.methode();
Node n2 = n1.getOwnerDocument().import(SomeAPI.method(),true/false);
n1.appendChild(n2); -
Using assign-activity:Append to append child nodes in XML-tree within loop
I would like to produce an XML looking something like this (just an example):
<Customer>
<Name>Tom</Name>
<Invoices>
<Invoice>
<InvoiceData>.....</InvoiceData>
</Invoice>
<Invoice>
<InvoiceData>.....</InvoiceData>
</Invoice>
</Invoices>
</Customer>
For different reasons (composite PK's in DB etc) I have to first get the Customer-data, and then get each Invoice for that customer.
Then I have to loop the Invoices and append each Invoice-node to the XML, ending up with the whole thing when the loop is finished.
This should be pretty simple (I guess), and I have tried different variations of the Append (assign activity), but everytime I end up with only the last Invoice-node.
I can see in the Flow-window of the BPEL Console that it is not the same Invoice-node I'm appending within the loop-iterations, so that can not be the case in any way.
In other words it seems to copy instead of appending.
What is wrong ?
Is this a bug in the Append function ?
Any suggestions to other approaches that might work ? (I have to use the loop to get 1 and 1 Invoice-node though, and in that way put the whole XML together in some way)
Edited by: user1694182 on 09.okt.2008 05:08Thank you for your answer.
After taking your "debugging"-suggestions at hand and running some tests, I can now see that it gets appended in some way, but not correctly.
1st LOOP ROUND:
<installation>
<measurePoints>
<measurePoint><measurePointId>308</measurePointId>...</measurePoint>
</mesurePoints>
</installation>
Correct so far.
2nd LOOP ROUND:
<installation>
<measurePoints>
<measurePoint><measurePointId>322</measurePointId>...</measurePoint>
<measurePoint><measurePointId>322</measurePointId>...</measurePoint>
</mesurePoints>
</installation>
So now it appends the new measurepoint, but overwrites the 1st as well... Strange..
3rd LOOP ROUND (last round):
<installation>
<measurePoints>
<measurePoint><measurePointId>382</measurePointId>...</measurePoint>
<measurePoint><measurePointId>382</measurePointId>...</measurePoint>
</mesurePoints>
</installation>
So suddenly the same Append doesn't append, but overwrites the 2 I had with the new measurepoint...Strange...
WHAT I DO IN MORE DETAIL:
1: Assign(copy) the whole XML in the 1st loop round. (Copy - FROM: submitInstallation_InputVariable - TO: Powel_InstallationServiceInput)
2: Within each loop round I collect the whole XML with just 1 measurePoint (TransformActivity - FROM: DBAdapter-output - TO: submitInstallation_InputVariable).
3: Within each loop round I then append the new measurePoint (collected in step 2) to the measurePoints-node. (Append - FROM: submitInstallation_InputVariable - TO: Powel_InstallationServiceInput)
PS! I can see in the BPEL Console that it is a new measurePoint that gets collected in step 2, and just 1 node.
Help/tips on this is very appreciated ! :-)
Edited by: user1694182 on 14.okt.2008 00:57 -
I am having a problem finding a child node (c#)
Hi !
My XML is a bit like this:
<Layers>
<Layer>
<OverlapNames>
</OverlapNames>
<CommonNames>
</CommonNames>
<SnapNames>
<SnapName Name="zzz" />
<SnapName Name="yyy" />
</SnapNames
</Layer>
</Layers>
I have this initial XmlNode which returns a valid object:
XmlNode nodeLayer = xmlDoc.SelectSingleNode(String.Format("Layers/Layer[@Name=\"{0}\"]", strLayer));
Now what I want to do is try to find within this node if there is a SnapNames/SnapName with a value of, eg: zzz.
So I thought this would work (where strLayer2 is "zzz":
XmlNode nodeLayer2 = nodeLayer.SelectSingleNode(String.Format(".//SnapsNames/SnapName[@Name=\"{0}\"]", strLayer2));
// Also tried:
XmlNode nodeLayer2 = nodeLayer.SelectSingleNode(String.Format("SnapsNames/SnapName[@Name=\"{0}\"]", strLayer2));
But nodeLayer2 is always null! The only way I have managed to do it so far is like this:
bool bIsSnapName = false;
if (nodeLayer.HasChildNodes)
for (int i=0; i<nodeLayer.ChildNodes.Count; i++)
if (nodeLayer.ChildNodes[i].Name == "SnapNames")
XmlNode nodeSnapNames = nodeLayer.ChildNodes[i];
XmlNode nodeSnapName = nodeSnapNames.SelectSingleNode(String.Format("SnapName[@Name=\"{0}\"]", strLayer2));
if (nodeSnapName != null)
bIsSnapName = true;
break;
What am I doing wrong? How can I take the nodeLayer object and return the sub node from SnapNames/SnapName where Name = "zzz"?
Thanks.Thanks. I could use that because SnapName only appears inside the SnapNames node. But I was trying to be more specific. For example, this improved code works fine:
XmlNode nodeSnapNames = nodeLayer.SelectSingleNode("SnapNames");
XmlNode nodeSnapName = null;
if(nodeSnapNames != null)
nodeSnapName = nodeSnapNames.SelectSingleNode(String.Format("SnapName[@Name=\"{0}\"]", strLayer2));
I just tried what you said and it does work. But how do we specifically search the "SnapNames" child as opposed to any of the children? Understand? -
DMEE : how to make parent node disappear when child node is empty
Hi Friends ,
Currently i am working on DMEE , I have a problem . When Child node is empty I donot want the parent node to appear in the tree.Here I am uisng a field via exit function module for childnode. so not a fpay* strucutre field to write a condition.
Is there any other way for this ?
Please help.
KomaravoluI'm not sure if this can be done in DMEE tree, but there is BADI DMEE_BADI_01 that can be implemented to perform any kind of postprocessing right before the file is created. I used it, for example, to replace separators with tabs. I believe this can also be used to eliminate the unneeded nodes.
-
Problem while handling Parent and child nodes in CE
Hi all
I am facing a problem with handling Child and Parent nodes in CE.
I have a Table in which I have drop downs. On selecting a value in the drop down, I have to take that value and do some action.
I am trying to access the value in the following ways
wdContext.nodeParent().currentParentElement().nodeChild().currentChildElement().getVaActivity();
wdContext.nodeChild ().currentChildElement().getVaActivity();
When I select the drop down from the first row of the Table the code works fine.
But when I select other rows, it returns the current value of the first row.
The lead selection of the parent always returns u20180u2019 even though you have done some action in row 2,3 etc.
The same code gives the required values in EP 7.0; I.e.: it returns the values form selected row in the table.
Basic problem is that the current value of parent always returns the first row.
Following are the Properties of the nodes
Parent
Collection Cardinality: 0-n
Singletone: true
Child:
Collection Cardinality: 0-n
Singletone: false
Please help
Regards
DeepuHi,
In CE changing dropdown selections doesn't fire table leadselection events. If you want to use a dropdown in a context-driven UI element like a Table, you need to use of event parameter mappings. So here are the steps:
1. Create a new action for the onSelect event of the dropdown (I will write the code for DropDownByIndex), let's call it Select.
2. Add a parameter parentElement whose type is same as the type of the parent node element. So from your example it would be IParentElement. Select the chek-box for "Adapt event-handler parameter". This will add a new parameter to the event-handler method onActionSelect called parentElement.
3. Write this inside wdDoModifyView :
if (firstTime) {
IWDAbstractDropDownByIndex ddi = (IWDAbstractDropDownByIndex) view.getElement("<id of DropDownByIndex>");
ddi.mappingOfOnSelect().addSourceMapping(IWDAbstractDropDownByIndex.IWDOnSelect.NODE_ELEMENT,"parentElement");
3. If you want to set the lead selection of the table to the row where the dropdown is write this inside the event-handler:
wdContext.nodeParent().setLeadSelection(parentElement.index()); //parentElement is the event handler parameter added through the action.
Note that the event parameter IWDOnSelect.NODE_ELEMENT points to the node element that defines the data mapping for the containing row and not the node element of the source for the dropdown. This has been specfically added for such a scenario. All this is well documented [here|http://help.sap.com/javadocs/nwce/current/wdr/com/sap/tc/webdynpro/clientserver/uielib/standard/api/IWDAbstractDropDownByIndex.IWDOnSelect.html#NODE_ELEMENT].
Regards,
Satyajit. -
Problem with childs nodes and automatic key mapping in a Data Object
Hi experts!
I'm doing the service order tutorial from the mobile help at [this link|http://help.sap.com/saphelp_nwmobile71/helpdata/en/21/9b5b924c3b434fba4767731794b029/frameset.htm] and I have a problem...
In the topic "Modeling the Equipment Data Object", says you have to mark the "Automatic Key Mapping" checkbox. So when I had to create a third child node ( the location node ) the system raised an exception with the message "Deselect automatic key mapping flag for more than two-level nodes". I'm trying deselecting the flag and creating the location node, but when I want mark again the automatic key mapping flag, this is disabled.
What can I do to solve this and create the three child nodes with the flag marked? It's a configuration thing?
Any help it's very welcome. Thanks in advance.
Best regards,
Simon.The thing is: Its not allowed to use automatic keymapping if you have more than two levels. This is why the message showed up, and this is why its been disabled.
What automatic keymapping does: Figures out automatically which child node belongs to which parent (by guessing from the field name and type, which fields in the child correspond to which key fields of the parent).
On three levels, this becomes more complicated => Its disabled.
How to do keymapping yourself instead of having the DOE do it automatically: Do 'Explicit keymapping' from each child to its parent. Explicit keymapping is done by clicking on the corresponding menu button in the child node. Here you need to associate child node fields (they need not be key fields of the child, but they are allowed to be that as well) to each of its parent nodes key fields (so that each child can be associated to its parent).
Cheers -
How to open a dialog box while double cliking the JTree child node.
hi
I am new to Swing technology.I want to open a dialog box while double clicking the child node of a tree.Could anyone please send me some examples.mouse listener on the tree, see if the click count is 2 and what node it clicked, open the dialog. MouseEvent can give you the click count and x/y coordinate, JTree can tell you what node is at that coordinate.
-
Create root node and child nodes while downloading data from internal table
Hi all,
i have to down load the details of three materials present in the internal table into
a XML file, the material number must be the root node, ERNAM,AENAM,VPSTA
fields must be its child nodes. in this way i have to display details of three
materials like material1,material2,material3.
how can i do that in 4.6c version.
Thanks,
satish.Hi Satish,
Please look into the following programs. These are sample SAP programs to deal with XML in 46c.
BCCIIXMLT1
BCCIIXMLT2
BCCIIXMLT3
Hope these will helps,
Sumant. -
How to append an xml string as a child node to a dom document
Hi
I have an xml represented as a String. Now I want to add this xml string as a child node to another DOM Document.
Do I have to first parse the xml String into a xml Document and then add the nodes to the existing Document. Is there a simpler way to do this. Any input is appreciated.
Many thanks in advance.radsat wrote:
Hi
I have an xml represented as a String. Now I want to add this xml string as a child node to another DOM Document.
Do I have to first parse the xml String into a xml Document and then add the nodes to the existing Document. yes, this is what you need to do.
Is there a simpler way to do this. Any input is appreciated.no, there really isn't, sorry. -
Regarding : Creation of child nodes in a outlinefield
Hi,
I am facing a few problems in creating a child node. I read elements from an array to populate the outline field. The array has exact definitions as to what should be a parent and child respectively. While I am able to create nodes at the parent level, I am unable to create child nodes for any parent. I discovered that the value for the parent node is getting lost. I have tried to use some of the methods to arrive at the parent node, but to no anvil. Could some one suggest how exactly to get the value of the parent node so that the child node can be assigned to the parent.
Thanks In advance.
Balasubramaniam Sures
[email protected]
P.S : I have seen the examples Simple Outline field and File Browser. No clues from here.I take it that you are traversing through the array and loading each
element into the OutlineField. At the risk of stating the obvious, for
each element you must also identify it's parent. This is necessary to
set the relationship from the child to the parent or vise versa.
If you are already doing this and are still having difficulty, the
problem may be as simple as setting the IsFolder property of the parent
node. Unless this is done, it's child nodes will not be visible.
Van Vuong
Lead Technical Analyst
Office: 972.985.5289
VoiceNow: 972.330.0822
Internet: [email protected]
PAGE NET
From: bala[SMTP:[email protected]]
Sent: Friday, October 03, 1997 12:32 PM
To: '[email protected]'
Subject: Regarding : Creation of child nodes in a outline field
Hi,
I am facing a few problems in creating a child node. I read elements from an
array to populate the outline field. The array has exact definitions as to
what should be a parent and child respectively. While I am able to create
nodes at the parent level, I am unable to create child nodes for any parent.
I discovered that the value for the parent node is getting lost. I have
tried to use some of the methods to arrive at the parent node, but to no
anvil. Could some one suggest how exactly to get the value of the parent node
so that the child node can be assigned to the parent.
Thanks In advance.
Balasubramaniam Sures
[email protected]
P.S : I have seen the examples Simple Outline field and File Browser. No
clues from here. -
LPX-00004 - Problems while inserting xml files in a xmltype column
I've faced two problems while trying to insert xml files into my table containing a xmltype column:
create table xml_test (id number(20),content xmltype)
I use following java code for writing xml docs into db:
conn.setAutoCommit(false);
OraclePreparedStatement stmt = (OraclePreparedStatement)
conn.prepareStatement("INSERT INTO xml_test (id,content) VALUES(?,?)");
File file = new File(file1);
InputStream in1 = new FileInputStream(file1);
Reader r1 = new BufferedReader(new InputStreamReader(in1, "UTF-8"));
int len = 0;
StringBuffer text = new StringBuffer();
while ((len = r1.read()) != -1) {
text.append((char) len);
in1.close();
r1.close();
XMLType poXML1 = XMLType.createXML(conn, text.toString());
for (int i = 1; i <= 1; i++) {
stmt.setInt(1, i);
stmt.setObject(2, poXML1);
stmt.execute();
conn.commit();
1. problem: occures only if a xml schema has been assoicated to the specific xmltype column. it seems that the length of a specific xml tag in the document is limited. but why?
java.sql.SQLException: ORA-22814: attribute or element value is larger than specified in type
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
at test.insertXML(test.java:84)
at test.main(test.java:261)
hier the xml-schema of the xmltype column "content":
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="AUTOR-ID" type="xs:string"/>
<xs:element name="BODY" type="xs:string"/>
<xs:element name="CONTENT">
<xs:complexType>
<xs:sequence>
<xs:element ref="METADATEN"/>
<xs:element ref="BODY"/>
</xs:sequence>
<xs:attribute name="content-id" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="DATUM" type="xs:string"/>
<xs:element name="KEYWORD" type="xs:string"/>
<xs:element name="METADATEN">
<xs:complexType>
<xs:sequence>
<xs:element ref="DATUM"/>
<xs:element ref="TITEL" maxOccurs="unbounded"/>
<xs:element ref="KEYWORD" maxOccurs="unbounded"/>
<xs:element ref="AUTOR-ID"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TITEL" type="xs:string"/>
</xs:schema>
2. problem: hier i have no idea what is happening ... please help
java.sql.SQLException: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00004: internal error "MultiChar overflow"
Error at line 61
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
at test.insertXML(test.java:53)
at test.main(test.java:259)It's hard for me to tell you more without seeing your instance data, but for problem #1, if you look at the underlying SQL types being generated by your schema, you will see that the default SQL mapping for a "string" in your schema is a VARCHAR2(4000) (and I believe this would be only 2000 for a varying width character set like UTF8).
You can specify that you wish this column to be mapped as a CLOB in your schema if this is the problem. Also note that there is a 64K limit on the size of an individual node in XMLType. -
Problem in inserting a node in Treeview.
Hi all,
I'm having a problem in inserting a node in the
treeview always it appends in the end of the
sibling.
Basically on double clicking of any node in the
treeview should create a copy of the double clicked
node and just insert the copy of the doubleclicked
node next to the doubleclicked node instead at the end of the sibling.
if i do this it will to the end of all the siblings.
copyObject = l_SelectedNode.Clone();
copyObject.Parent = l_SelectedNode.Parent;
instead of next to it.
I am trying something like this:
RootNode
|
---CHILD Sibling Node1
| |
----GrandChild1Sibling1
| |
---GrandChild1Sibling2 <<-- double clicking
(GrandChild1Sibling2)
| |
<<-- it must add
(GrandChild1Sibling2_copy)
---GrandChild1Sibling3
| |
---GrandChild1Sibling4
| << -- But it is adding a copy here
at the end of all sibbling..
|
---CHILD Sibling Node2
| |
-------GrandChild2Sibling1
| |
------GrandChild2Sibling2
| |
------GrandChild2Sibling3
| |
------GrandChild2Sibling4
|
i am doing GrandChild1Sibling2_copy.parent =
GrandChild1Sibling2.Parent;
it will always add in the end of all the sibling as
(GrandChild1Sibling5_copy) instead of next to
(GrandChild1Sibling3_copy) Just below the GrandChild1Sibling2.
Is there any simple soln or any ordering factor which i should look for.
Thanx in advance...
Regards,
-PrasadHello,
Check the following link.
SQL error 1653
Hope it helps in solving your problem.
Thanks and Regards,
Sachin
Maybe you are looking for
-
How can I read my old text messages after transfer...
OK, I've got a couple of problems. First of all, I've been unable to send text messages from my 6620. As detailed in this older thread, /discussions/board/message?board.id=messaging&thread.id=14597 ...somebody on Yahoo answers suggested a possible f
-
Transport layer change ?
Is there any function module or class methods to chnge the tansport layer of a package. I need to change the transport layer from a program. Best Regards, Sreeram
-
Will Photoshop Elements 10 work on an iMac with an Intel Dual Core processor?
Will Photoshop Elements 10 work on an iMac with an Intel Dual Core processor?
-
How do i know if the internet is enabled?
Hi Box arrived but don't know if the internet is enabled yet. One email says don't plug in hub until I'm emailed to say it's ready, other (phone call) said it would be ready today. Is there any way of finding out if it's been switched on yet?
-
Error in upgrading to sbo 2007
Hi Dear; I have an add on that works properly on sbo 2005 PL52 when i upgrade to version 2007 i have the following problem: when creating a document, if i add a row using the item desciption cell without passing by item code it replace the previous