I need to get the complete element including tag. How to parse this xml?
I am sure there should be some solution to this. I have XML file like this
<test>
<data value="123" color="RED">
<type>single</type>
</data>
<data value="13323" color="BLUE">
<type>double</type>
</data>
</test>
I need to parse this XML and get the data element(s). The problem is that I need to get the complete data element include tags like
"<data value="123" color="RED"><type>single</type></data>". I need to parse the complete XML file and get every data element including tag and send it to another upstream process.
Any solution to this will be appreciated. I am little familiar with SAX. Is there any solution around using xerces SAX parser.
Other solution is also appreciated.
Thanks
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(srcFile);
NodeList list = document.getElementsByTagName("data");
Node node = list.item(0); // Loop this
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DOMSource source = new DOMSource(node);
StreamResult result = new StreamResult(outputstream);
transformer.transform(source, result);
Using XSLT will be lot easier.No it won't. Extending DefaultHandler is easy.Do you really think so?
Hardly 10-15 lines.
Similar Messages
-
I need to get the latest version of Adobe Reader. Is this still free? How can I receive automatic upgrades?
Of course the free Reader is still available: http://get.adobe.com/reader/
To get automatic updates set the Updater in the Reader Preferences. -
On both the listing of gmails and the size of the font when gmails are opened, the font size is smaller than prior to upgrading to Firefox 4. I did not change any settings. I cannot see where I can change this back to larger fonts. Help?
The page may have been zoomed out. With Gmail on display try using the keyboard shortcut Control+0 (zero) to reset page zoom.
For more details on using page zoom see https://support.mozilla.com/kb/Page+Zoom -
I downloaded the zip file for the 6.7 update and unzipped it. I double clicked on the .exe file and it would not install. What do I need to get the update installed?
Is this the 6.7 camera raw updater you tried?
It's specifically for pse 10 on windows.
Adobe - Photoshop Elements : For Windows : Camera Raw 6.7 update for Elements 10
What camera do you have? -
I need help getting the license number for Adobe Photoshop Elements. However, It doesn't recognize me as an authorized user. Can someone help?@
I am having the same problem...did you ever fix it?
-
How to get the complete path of the file that is selected using FormFile
i m working on struts..
i hv used FormFile like
<html:file property="xsdpath" value="Browse" />
need to get the whole path that i will select using browse button
for example d:\foldername\filename.java
but FormFile Api has a method getFileName(); which returns the filename, for getting the absolute path wat has to be done.
please reply bak soon
thanks in advancehere i use formfile <html:file> just to allow the
user to select a xml file .
so i need to get the whole path of the selectedfile
to parse the xml file.No you dont.
You would definitely benefit from further reading on
file upload.
<html:file> tag renders an HTML <input> element of
type file.
When a user uploads a file, this file is sent as a
stream of data, which a program (jsp/servlet) on the
server, reads and stores the data back in the form
of a file on the server.
Any server program that needs to parse the file,
should do so on the file stored on the server.
There's no point in knowing the absolute path of the
file on the client machine. If a server program can
parse a file on the client machine, why upload the
file in first case ? Get the drift ?
i also want to show my user the path he hadselected.
If you have such a requirement, then yes.
But it sounds weird to me. If you see my response
above, you will realize that the server has a copy of
the client's file uploaded and then parsed. What if
the client has changed his file after upload ?
cheers,
ram.I also have a requirement to get the whole filepath of the file selected and place this information into a table. From FormFile I can only retreive the absolute filename
Any suggestions would be helpful.
Thanks, dam -
How to get the context element of a F4 help of a column in ALV table?
Hello!
I know to get the context element of the current row normally through
lo_el = WDEVENT->get_context_element( 'CONTEXT_ELEMENT' ).
or: lo_el = lo_nd->get_element( index = r-parm->index ).
But this time, I have a F4 help on the cell of a column. After clicking on the F4 help I need to get the current context element. Do you have any idea, to help me?
Many thanks!
regards
MeerHello,
Kindly close the thread if your query is resolved now.
Thanks
Pradeep -
I need to get the tagName after a node of the first child of the Root
Hi All,
I need to get the TagName of the Node immediete after the Root. I won't know what is the TagName, and based on the Tagname only I can process the records.
For example I might receive a SALES object or a MARKETING object wrapped under the root.
eg.
<PARENT>
<SALES>
</SALES>
</PARENT>
or
<PARENT>
<MARKETING>
</MARKETING>
</PARENT>
I tried to using like this
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
File file = new File("c:/example.xml");
document = documentBuilder.parse(file);
Node node = document.getDocumentElement().getFirstChild();
System.out.println("node Name:" +node.getNodeName());
System.out.println("node Value:" +node.getNodeValue());
It returns only something like #text, but I need the response like 'SALES'.
Can anyone let me know if im missing something somewhere.
thanks in advance,
HarishThat's because the first child of the document element is that whitespace text node between <PARENT> and <SALES>. You need to scan through the children of the document element until you find one that is an Element node.
-
Okay, so I try to download and every time it says "There was an error creating a temporary file that is needed to complete the installation".
Anyone know how to fix this?
Please help. I can't get it to work. I've tried uninstalling and it says the same thing. Is there anyway anyone can help me?HELP!!!! PLEASE!!!!!
-
When bookmarking a page, I can't get the complete list of bookmark folders to drop down in order to select any folder in which to bookmark page. The 'Folder:' bar has 'Bookmarks Menu' showing. The arrow on the bar drops down 5 recent folders to which pages have been saved, but the pop down arrow to the right of the bar just opens to show the three categories and 'New Folder' button. What do you set to get whole list of folders in Bookmarks to drop down?
To all, embarrassingly enough, I have discovered that I didn't know how to expand the three categories including 'Bookmarks Menu' in the 'Bookmark This Page' pop up interface. It was expanded by default on the initial Firefox opening and first page bookmark attempt. Next use it only showed categories. I clicked and double clicked the 'Bookmarks Menu' line, but failed to see the small, shaded triangle used to expand/collapse list. If it appears collapsed, just tap triangle at left of line to see all folders. It seems to open the same way after I do it for first time. Sorry for the inconvenience, and thanks for all the attempts to help.
-
How to get the second element in XML Response with same name
Hi All,
I am struck at this point, I have written a sample HTTP client which sends a request to the HTTP Server. In response to the request made the HTTP Server gives response in the XML format. eg: -
<?xml version="1.0"?>
<parent>
<node1> Value1 </node1>
<node1> Value2 </node1>
<node2> Value3 </node2>
</parent>
In the HTTP Client I am getting the value of node1 using the following statement: -
if (node instanceof Element && "node1".equals(((Element)node).getName()) )
String node1 = node.getStringValue();
System.out.println("Product Code:"+node1);
This is always returning the first node1 value i.e. <node1> Value1 </node1>.
The requirement is, I also need to get the <node1> Value2 </node1> value also. So can anyone tell me hw can I get the <node1> Value2 </node1> value. please tell me the piece of code that I should add to get the <node1> Value2 </node1>.
My Mode is something like this: -
try
Document document = (Document)DocumentHelper.parseText(response);
List<Node> transactionNodeList = document.selectNodes( "//parent" );
for(Node singleNode:transactionNodeList)
for(int i=0,j=0;i< ((Element)singleNode).nodeCount();i++ )
Node node = ((Element)singleNode).node(i);
if (node instanceof Element && "node1".equals(((Element)node).getName()) )
node1= node.getStringValue();
System.out.println("Air Way Bill Number:"+node1);
if (node instanceof Element && "node1".equals(((Element)node).getName()) )
node1= node.getStringValue();
System.out.println("Product Code:"+node1);
Thanks in AdvanceDocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder db=factory.newDocumentBuilder();
Document doc=db.parse(new File(ur xml file"));
Element root=doc.getDocumentElement();
System.out.println("root "+root.getNodeName()); -
HT1212 need to get the "iPad is disabled" off my iPad so I can use it
need to get the "iPad is disabled" off my iPad so I can use it
How can I unlock my iPad if I forgot the passcode?
http://www.everymac.com/systems/apple/ipad/ipad-troubleshooting-repair-faq/ipad- how-to-unlock-open-forgot-code-passcode-password-login.html
iOS: Device disabled after entering wrong passcode
http://support.apple.com/kb/ht1212
How can I unlock my iPad if I forgot the passcode?
http://tinyurl.com/7ndy8tb
How to Reset a Forgotten Password for an iOS Device
http://www.wikihow.com/Reset-a-Forgotten-Password-for-an-iOS-Device
Using iPhone/iPad Recovery Mode
http://ipod.about.com/od/iphonetroubleshooting/a/Iphone-Recovery-Mode.htm
Saw this solution on another post about an iPad in a school environment. Might work on your iPad so you won't lose everything.
~~~~~~~~~~~~~
‘iPad is disabled’ fix without resetting using iTunes
Today I met my match with an iPad that had a passcode entered too many times, resulting in it displaying the message ‘iPad is disabled – Connect to iTunes’. This was a student iPad and since they use Notability for most of their work there was a chance that her files were not all backed up to the cloud. I really wanted to just re-activate the iPad instead of totally resetting it back to our default image.
I reached out to my PLN on Twitter and had some help from a few people through retweets and a couple of clarification tweets. I love that so many are willing to help out so quickly. Through this I also learned that I look like Lt. Riker from Star Trek (thanks @FillineMachine).
Through some trial and error (and a little sheer luck), I was able to reactivate the iPad without loosing any data. Note, this will only work on the computer it last synced with. Here’s how:
1. Configurator is useless in reactivating a locked iPad. You will only be able to completely reformat the iPad using Configurator. If that’s ok with you, go for it – otherwise don’t waste your time trying to figure it out.
2. Open iTunes with the iPad disconnected.
3. Connect the iPad to the computer and wait for it to show up in the devices section in iTunes.
4. Click on the iPad name when it appears and you will be given the option to restore a backup or setup as a new iPad (since it is locked).
5. Click ‘Setup as new iPad’ and then click restore.
6. The iPad will start backing up before it does the full restore and sync. CANCEL THE BACKUP IMMEDIATELY. You do this by clicking the small x in the status window in iTunes.
7. When the backup cancels, it immediately starts syncing – cancel this as well using the same small x in the iTunes status window.
8. The first stage in the restore process unlocks the iPad, you are basically just cancelling out the restore process as soon as it reactivates the iPad.
If done correctly, you will experience no data loss and the result will be a reactivated iPad. I have now tried this with about 5 iPads that were locked identically by students and each time it worked like a charm.
~~~~~~~~~~~~~
Try it and good luck. You have nothing more to lose if it doesn't work for you.
Cheers, Tom -
How to get the list element label ? Please help
Dear all
I have a problem.
I need to get the current list element lable
for example
the emp_list displays the employee_name and return the employee_id
I need the following:
when_list_change , i need to put the label of the selected element in a text item :EMP_NAME_TEXT
I can put the put the element value easily when the user select an element
:EMP_NAME_TEXT := :emp_list ;
I need to put the label not the value
please helpHi,
Try out the get_list_element_label built-in function.....
Find info in the on-line help.....
Regards,
Simon -
I need to get the current assignee for a given request using SOA's java api
I'm developing a spring app that interfaces with Oracle SOA suite and executes the actions such as approving requests using the api. I need to get the current assignee for each SOA Task this is dispalyed in the OIM console so it is getting it from somewhere. I tried getApprovers in the ITaskService api but this returns an empty list
I have checked it once again and there indeed are links for ALUI components for Solaris on SPARC at edelivery.oracle.com. (Officially ALUI supports Solaris on SPARC only)
If you have looked at Solaris x86, then you must not have found them. Please make sure that you are selecting the righ platform. Also, make sure that you click on the Aqualogic media pack so as to get the lists of the components included in it. (Point to Note: You need to go to the next level)
For whichever component you are not able to find, try looking for it in the Metalink (My Oracle Support) if you have a support contract. -
I purchased Photoshop elements and downloaded the 32 bit version, but I received an error saying I need to download the 64 bit version. How do I do that?
You can get it from here:
Download Photoshop Elements products | 13, 12, 11, 10
Maybe you are looking for
-
Macbook Pro (17-inch, Mid 2009) external monitor static
I've had this problem ever since I bought my macbook pro a year and a half ago. I like to connect my macbook pro to a Sony Bravia TV (model: KDL-26P3000) via an HDMI cable and mini displayport to hdmi adapter. Every few minutes or so the image turns
-
User Exit to stop the creation of PO
Dear All, I have a typical problem , we have 2 servers both running on ECC 6.0. I tried creating a PO and I kept a break point in the exit EXIT_SAPMM06E_013 (INCLUDE ZXM06U44 ) in server1 and the control stops here and I can check all the values from
-
I would like to use the windows explorer open dialog box instead of the adobe open dialog box. How can I change that?
-
Anyone seen this problem with Excel 2003?
We're developing a Microsoft Excel-based app. The help system uses HTML Help (.chm) format, and works just fine with Excel 2007 and 2010. However, since a lot of potential users out there are still using older versions, we've been asked to adapt the
-
Creating PS Network header with one activity
I need to create to a projekt the network header with one activity. so I want top proceed the following coding: CALL FUNCTION 'BAPI_PS_INITIALIZATION'. CALL FUNCTION 'BAPI_BUS2002_CREATE' EXPORTING i_network = gs_network