Sending an XML file to a hashmap, using one of the elements as a key?
I am looking for a way to read an XML file to a hashmap.
So far I have learned to use javax.xml.parsers.*; tools to read the XML file
and I can send different elements of the XML file to the screen all day.
here is some snippets of what I'm doing now:
public class GLDefaultLoader {
protected String xmlFileName = "gl.xml";
private Document loadXML(String filename) throws Exception {
filename= "gl.xml";
Document doc = null;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
db.setErrorHandler(new com.abcsinc.fwk.dom.MySaxErrorHandler());
doc = db.parse(new File("gl.xml").getAbsolutePath());
} // after this we do variuos catches
// here Im getting started on my hashmap
private HashMap buildGLDefaultsItems(Document doc) throws IOException,
ParserConfigurationException,
SAXException {
HashMap hashMap = new HashMap();
doc.getDocumentElement().normalize();
System.out.println("Root element of the doc is " + doc.getDocumentElement().getNodeName());
NodeList listOfQueries = doc.getElementsByTagName("glDefaultsItem");
int totalQueries = listOfQueries.getLength();
System.out.println("Total number of Queries : " + totalQueries);----------------------------------------
I think I'm going In the right direction but I'm kinda stuck, wallowing in ignorance maybe, lol
front
Similar Messages
-
How to send XML file to https server using POST
Hi, I am having an requirement, that I have to connect to https server and I have to pass an input XML file as a response server will give me output XML file.
The certificate validation part is over, I am using FileInputStream to read the XML file and attaching this to connection.getOutputStream(); but server is throwing me DTD does n't match.
Can any body tell me how to send XML file, I have to use any DOM parser to send the XML file, suggest me and give me sample code.
Thanks,Can anybody give me the solution
-
How to send a XML file from SAP to WEB SERVICE
Hi folks,
i m creating a XML file with purchase order data, while saving the purchase order.now i need to send this XML file to some WEB SERVICE i.e to some perticular address in WEB.
can anyone give the step by step procedure to do this web service configuration? it's really urgent.
points must be awarded.
Thanks & Regards
pabitraHi all,
i need to send some purchase order data from SAP to WEB SERVICE. while saving the purchase order, i want to send some data from SAP to WEB SERVICE ( a perticular address in WEB).
i want to see those datas in xml format in WEB.
Now i am using SAP 4.7 version. Is this web service configuration is possible or not?
In SE37, i can not see the CREATE WEB SERVICE option in utilitities--> More utilities menu.is it possible in 4.7???
can anyone give any suggestion ? it's very urgent.
Thnaks
pabitra -
Can I send an XML file to the server instead of just URL?
I have installed the XML demos on my machine. I am using Oracle 8i. All the demos talks about getting URL and Parameter from the HTML Page, instead of this I want to send my XML file from Java Applet to server. Then do all the searching as is going on right now in the demos. After this I want to send another XML file back from server to client applet.
Client ----->XMLFILE------>SERVER
Client<-----XMLFILE<------SERVER
Do we have any DEMO which shows that how to send request through XML file instead of
"http://MachineName:Port/XSQL/DEMO/emp.xsql?find=A".
I know that we are not using Java Applets in the demos but I will interact this file with applet, it's not a problem.
I would appreciate if anyone who is really knowlegeable about these demos can answer my question.
Thanks,
Raza
nullhttp://forum.java.sun.com/thread.jspa?threadID=5158333
http://forum.java.sun.com/thread.jspa?threadID=5158705
Crossposting is lame. -
How to read from a xml file(in String format) using a java program
hi friends
i have a string , which is xml format. i want read the values and display it.can any one suggest how to read a xml file of string format using a javaprogram
thanksfinal DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
final InputStream documentStream = new ByteArrayInputStream(documentXMLSourceString.getBytes("utf-8"));
final Document document = db.parse(documentStream); -
Import of XML file failed in portal using XML Content and Action
Hi Friends,
I am trying to import the simple XML file which is just creating the folder in the PORTAL_CONTENT using XML CONTENT AND ACTIONS which is one way of creating the portal content. GO TO SYSTEM ADMINISTRATION > TRANSPORT > XML CONTENT AND ACTIONS > IMPORT.
The reason for using this import tool is to upload the backend Business roles, which is not not working on our corporate portal. To test the import functionality I used the following xml file (I got this XML file by exporting the test folder in the portal using the same tool)
<GenericCreator author="XML Creator" version="XML Automatic Creation" mode="clean,execute" report.level="success" createMode="1" default.locale="en" ignore="false">
<Context name="portal_content" objectClass="com.sap.portal.pcd.gl.GlContext"></Context> <Property name="parent1" value="pcd:portal_content"/>
<Context name="com.dri.fldr.im" objectClass="com.sap.portal.pcd.gl.GlContext" create_as="0" parent="$">
<Attributes>
<Attribute name="com.sap.portal.pcm.Description" type="text">
<AttributeValue value="" locale=""/>
<Attribute name="administration" type="string">
<AttributeValue value=""/>
</Attribute>
<Attribute name="Inheritance" type="string">
<AttributeValue value="NONFINAL"/>
</Attribute>
</Attribute>
<Attribute name="com.sap.portal.pcm.Title" type="text">
<AttributeValue value="test" locale=""/>
<AttributeValue value="test" locale="en"/>
<Attribute name="administration" type="string">
<AttributeValue value=""/>
</Attribute>
<Attribute name="mandatory" type="string">
<AttributeValue value="true"/>
</Attribute>
<Attribute name="Inheritance" type="string">
<AttributeValue value="NONFINAL"/>
</Attribute>
</Attribute>
</Attributes>
</Context>
</GenericCreator>
SDN BLOCKED THE XML The above XML file works fine in other portal in the landscape but not in corporate portal ( which is freshly build recently).Following error message is display when i am trying to upload the file
Status Name Action Type Comment
General Extracting root node E:\usr\sap\EPD\JC00\j2ee\cluster\server0\%USERPROFILE%\AppData\Local\Temp\tmp_masscontent4135391959047431276.xml Failed to extract root node
General Extracting root node E:\usr\sap\EPD\JC00\j2ee\cluster\server0\%USERPROFILE%\AppData\Local\Temp\tmp_masscontent4135391959047431276.xml Parsing failed .
Dont know is there a service/ configurations needs to be done to enable this feature?.
Thanks
Edited by: hammad on Sep 4, 2009 5:48 PM
Edited by: hammad on Sep 4, 2009 5:49 PMThe problem statement is not very clear.
Try following this how to guide [https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/207a2141-c870-2910-e080-90c920b24f47&overridelayout=true|How-To]
Best Regards,
Prasanna K -
Unable to add XML files to genericObjects Folders using Webdav - cFolders
Hi All
I am not able to add XML files to genericObjects Folders using Webdav in cFolders
What could be the reason.. When I try to copy, it says "cant read from source file"
Regards,
AbyYes.. I downloaded the ECN.XML file from se80, edited and then used "Uplload and replace"..
Also I did the same thing to add some more vocabulary in the cfx text XML, so that it would reflect correctly to map with Additional attributes in the PDX profile.
Regards,
Aby -
How to load a XML file into a table using PL/SQL
Hi Guru,
I have a requirement, that i have to create a procedure or a package in PL/SQL to load XML file into a table.
How we can achive this.ODI_NewUser wrote:
Hi Guru,
I have a requirement, that i have to create a procedure or a package in PL/SQL to load XML file into a table.
How we can achive this.
Not a perfectly framed question. How do you want to load the XML file? Hoping you want to parse the xml file and load it into a table you can do this.
This is the xml file
karthick% cat emp_details.xml
<?xml version="1.0"?>
<ROWSET>
<ROW>
<EMPNO>7782</EMPNO>
<ENAME>CLARK</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>09-JUN-1981</HIREDATE>
<SAL>2450</SAL>
<COM>0</COM>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW>
<EMPNO>7839</EMPNO>
<ENAME>KING</ENAME>
<JOB>PRESIDENT</JOB>
<HIREDATE>17-NOV-1981</HIREDATE>
<SAL>5000</SAL>
<COM>0</COM>
<DEPTNO>10</DEPTNO>
</ROW>
</ROWSET>
You can write a query like this.
SQL> select *
2 from xmltable
3 (
4 '/ROWSET/ROW' passing xmltype
5 (
6 bfilename('SDAARBORDIRLOG', 'emp_details.xml')
7 , nls_charset_id('AL32UTF8')
8 )
9 columns empno number path 'EMPNO'
10 , ename varchar2(6) path 'ENAME'
11 , job varchar2(9) path 'JOB'
12 , mgr number path 'MGR'
13 , hiredate varchar2(20)path 'HIREDATE'
14 , sal number path 'SAL'
15 , com number path 'COM'
16 , deptno number path 'DEPTNO'
17 );
EMPNO ENAME JOB MGR HIREDATE SAL COM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-1981 2450 0 10
7839 KING PRESIDENT 17-NOV-1981 5000 0 10
SQL> -
when i send a PDF file to out side print, some of the things I aded dose not print.
Is there a way I can "close" the PDF when i finish the work- so' every thing will be printed for sureSend Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
Feedback
Or you can use your Apple ID to register with this site and go the Apple BugReporter. Supposedly you will get an answer if you submit feedback.
Feedback via Apple Developer -
Rows of XML file don't refresh after changes in the file
Hi Guys, Greetings!
I load data from XML to Oracle, use this connection: jdbc:snps:xml?f=C:/xml/test.xml&ro=false&ldoc=true
It's all ok in first loading - 10000 rows was loaded. Then I deleted from XML file a couple of rows but in the Operator I'v looked the same picture - 10000 rows in Step Load data and 10000 rows in Step Insert new rows. The XML must be refresh every 10 minutes for loading. What shall I do for solving this proplem?
Tanks for your helpadd dod=true
C:/xml/test.xml&ro=false&ldoc=true&dod=true -
Can anyone tell me how to send a PDF file so that it opens up in the body of the email itself? Thanks
That is a function of the recipient's e-mail software understanding what your software sent. If it doesn't it will always show as an icon or attachment. It is also a function of both your internet provider and their internet provider accepting messages of that size, and a function of their download attachment settings in their e-mail program. There is no way to guarantee it will appear inline in the attachment. The best you can do is attach with Windows Friendly format. To do that, use the attach toolbar icon that looks like a paperclip, (View menu -> Customize toolbar if invisible) on Mac OS X Mail when composing the message. A checkbox appears in the file dialog box's bottom to make it Windows friendly when you navigate to pick the PDF file. That makes it as universally compatible as possible. It still may not appear inline, but at least you are less likely to be incompatible.
-
I am freelancer. When I tried to upload files on elance it give following error and disable the upload button:using one of the supported browser with latest Adobe flash is required to experience enhanced file upload features.
All plugins are up to date. Flash version 11.7 installed.I assume Firefox 19 worked fine on the site?
Some sites may be mistakenly identifying Firefox 20 as Firefox 2, which is a very old version they probably no longer support. As a test, you could "lie" to the site about your Firefox version and see whether that little deception works.
This take a minute to set up. Here's how:
(1) Select and copy the following preference name to the clipboard:
general.useragent.override.elance''.''com
(2) In a new tab or window, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
(3) In the filter box, type '''override''' and pause while the list is filtered
(4) Make sure '''general.useragent.site_specific_overrides''' is set to its default value of true (or right-click and choose Reset if it is not).
(5) Right-click anywhere in the preference list area and choose
New > String
then paste the preference name you copied. Click OK and enter TEMP or asdf or any text as a temporary placeholder. You should see the preference added in bold. Leave about:config open and switch back to this tab.
(6) Select and copy the following useragent string to the clipboard ''(it's all one line)'':
Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0
(That's Firefox 19 on Windows 7 32-bit)
(7) In about:config, double-click '''general.useragent.override.elance''.''com''' and paste to replace the temporary text with the new useragent string. Click OK, you're done here.
Now try reloading a page where you need to upload (use Ctrl+Shift+r) and test that function again. Any change? -
The log file which can be used to track the HTML preview of HFR Reports
Hi,
Could you please let me know the log file which can be used to track the HTML preview of HFR Reports?
Thanks,
AparnaYou could check the FinancialReporting0.log and FRLogging.log .You could refer the same in the
" http://docs.oracle.com/cd/E17236_01/epm.1112/epm_install_troubleshooting_11121.pdf" page 47. -
I don't own a MAC. I can probably use one at the library. I am trying to publish my book with Apple's ibooks, etc. Since my files are in Word.doc or html; how can I format my book so as to publish it?
www.amessageforthehumanrace.orgUse an aggregator and follow their instructions for formatting.
-
I updated my iPad OS this morning, and now I can no longer use iMessage to send pictures. When I try to get one from the camera roll, it blows up. Is this a known problem?
your ipad explodess? It's in pieces everywhere?
the picture opens and is zoomed in and you cannot zoom out?
Maybe you are looking for
-
Safari Won't open password protected Graphite Filesharing Public folder
Dear people, Using Homepage I made my Public folder available to a small group of people, whom I gave my password. I chose Graphite Filesharing. Starting about half a year ago, I got mor and more complaints from people not being able to Login. The pa
-
Itunes update will not install
itunes does not update. It says a new version is available. Iselect "download new version" but it does not download
-
Is Corporate Governance offered in ECC 6.0 ?
Hi Experts, Is Corporate Governance module provided in ECC 6.0 ? Regards Saurabh
-
Opendirectoryd / fax debug
Hello. I started to observe my kernel log / system konsole for what's going on and I saw opendirectoryd - has made 9 logs of starting something and here's log outputs (first & last) these logs are under "fax" and that's why I get interested, becouse
-
So how do vectors work in Java?
One thing I really don't like about OOP and using people's code is I have no idea what detailed vector math operations are happening, so to save me hours of experimenting, I just assume Vector3D is being used: C = movevec.Magnitude // Affects only C