Single not in XML file
Hi everyone...
i have a small problem...i would like to read one node in my xml file....
What is the easyest way to do that...i tried the following code...but i hot null result..
import java.io.*;
import javax.xml.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
public class myXMLClass{
public myXMLClass(){
try{
File xmlFile = new File("...\\myXML.xml");
DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuild = documentFactory.newDocumentBuilder();
Document documentUsage = documentBuild.parse(xmlFile);
documentUsage.getDocumentElement().normalize();
System.out.println( documentUsage.getDocumentElement().getNodeName());
NodeList serverNode = documentUsage.getElementsByTagName("myTag");
Element myElement = (Element)serverNode.item(0);
String result = myElement.getNodeValue();
System.out.println(result);
catch(Exception ex){
public static void main(String[]args){
new myXMLClass();
}And my XML looks someting like that...
<?xml version="1.0" encoding="UTF-8"?>
<root>
<myTag id = "1">testing</myTag>
</root>
Yes, there is. The following methods are for accessing single nodes:org.w3c.dom.Node.getFirstChild()
org.w3c.dom.Node.getLastChild()
org.w3c.dom.Node.getNextSibling()
org.w3c.dom.Node.getPreviousSibling()
org.w3c.dom.Node.getParentNode()
org.w3c.dom.Document.getDocumentElement()Notes:
1. I have only collected the most frequently used methods, so the above list is not complete. For more information consult the online API docs and tutorials.
2. These methods are useful when you query the data of XML documents that have a fixed structure. When the structure varies, you had better use NodeList because you may not know in advance the position or the number of occurrences of the node you are looking for.
Similar Messages
-
How can I parse an XML string, (not an XML file)?
Hi,
I am using Xerces2 Java Parser 2.4.0,
I wanta parse an XML string, not an XML file, but
in the Parser class there is only following methods:
parse(InputSource source)
parse(java.lang.String systemId)
thankshi
InputSource is = new InputSource(new ByteArrayInputStream(xmlSrc.getBytes()));
HTH
vasanth-ct -
Premiere pro not opening xml files
Hi Everyone,
We are transitioning from Final Cut Pro 7 into Adobe Premiere Pro CC. I have exported all my FCP projects as XML Files. I saved the XML files to an external harddrive that I am using to import files into PP on a PC. When I imported the XML files into PP, I was not able to access any files at all in the project. After looking online for answers, it occurred to me that I would need to backup all the source files along with the XML files.
I am in the process of identifying those source files and copying them to the external harddrive that i will be using to edit on Adobe Premiere Pro. The previous videographer did a shoddy job of organizing files, and I am noticing that some projects and their related scratch disks are often in different locations (different Harddrives, some on the original Mac harddrive). In an effort to keep to make our transition to Premiere Pro as painless as possible, I am backing up all NLE related files (render files, capture scratches, source media files, etc) onto one Harddrive. Is this all necessary?
Is there any blog or article online that i can reference on how to transition from FCP7 to Premiere Pro that addresses source material that is spread out on many storage devices?Hi Mike,
mikebcss wrote:
Is there any blog or article online that i can reference on how to transition from FCP7 to Premiere Pro that addresses source material that is spread out on many storage devices?
Not really, Just know that in FCP, you can move media to a single location using the Media Manager. Once media is moved, a FCP XML file will point to that that drive when opened in Premiere Pro.
Hope that helps,
Kevin -
Can not find xml file in classpath
Hi,
Can someone tell me how I can please or find a xml file in de webdynpro classpath: I have to place a xml and jar files in the classpath. The jar files are found in the application, but I get the following error: com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Unable to read the License file, please verify that you have SyncExLicense.xml file and it exists in the classpath or under com/yash/license folder.
How can I check if this file is available in the classpath.
Richardhi,
have you check that all jar files are present or not.
because when u import par file in to nwds it wont include jar files in that manully you have to import them.
jayesh talreja -
Can not create XML file from MS Access 2003
Hi,
I am getting error as "Error loading in DLL" when I use msaccess_exporter to create XML file for migrations usind Access 2003 DB. Does anyone know about this? If yes, could you please let me know how to resolve it?
Thanks,
KartikHi Daniel,
I believe you are seeing the message "Table'_OracletblDatabase' already exists" because you are attempting to export an MDB file that you previously attempted to export, but that initial export process may not have run to completion. I recommend opening your .MDB file, and delete any "_Oracletbl..." table objects that exist under the list of Table objects. Close the MDB file and carry out the export process again. You should now be able to use the 2000 mde file.
I hope this helps.
Regards,
Hilary -
E-Mailing a PDF Form and not an .xml file
I have created a PDF form for staff to request time off. The form is to be emailed to the Manager for approval. I used the "Submit by E-Mail" button, however, when I hit the Submit by E-Mail button, it submits an .xml file. I have looked through the forum, but have not been able to figure it out. I need help in getting this done asap. I am fairly new at this, therefore will require simple instructions. I have attached the form, if anyone wants to fix this form me, however, I would appreciate getting the instructions on how to do this for future use. Thanks
Thanks, however, I just want the user to be able to hit the Submit by E-mail button, and e-mail the form to the Manager. I believe, that this is what this button should be able to do, except that it converts the file to .XML format.
Still looking for help. thanks -
RH10 not creating XML files in whxdata
We converted from RH7 to RH10 earlier this year, and our application uses the XML files in whxdata to connect help buttons to topics. It seems that RH10 is not creating these XML files, which is breaking this functionality.
Some searching indicates that these files should be created when the primary WebHelp layout is being built. I can't find any settings anywhere that indicates whether or not they should be created.
Is this a consequence of the conversion, or does RH10 not create these files anymore?Hi,
We have updated the script to recursively convert all RH10/11 js inside whxdata and resource folder in to XML format. The steps to use the script is as follows:
2) - Double click on the script.
3) - Provide path of whxdata folder of RH10/11 output. All the js files will be converted to XML and will be placed in My Document\RoboHelp_XML. Now copy all the XML thus created and place it inside whxdata folder of RH10/11 output. If any message to override file is thrown then select not to override. Also, Keep all original js files intact.
4) - Provide path of resource folder of RH10/11 output. Resource js will be converted to XML and will be placed in My Document\RoboHelp_XML. Copy this XML and place it inside resource folder of RH11 output. If any message to override file is thrown then select not to override. Keep all original js files intact.
------------------------------------------------------------------------------------------ --------- Script starts----------------------------------------------------------------------------------- ----------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set wshshell = CreateObject("WScript.Shell")
Documents = wshShell.SpecialFolders("MyDocuments")
startWriting=false
sCurPath = Documents+"\RoboHelp_XML"
if not objFSO.folderexists(sCurPath) then
objFSO.CreateFolder(sCurPath)
end if
set objsCurPath=objFSO.GetFolder(sCurPath)
for each oldFilePath in objsCurPath.Files
objFSO.DeleteFile(oldFilePath)
next
bThrowUI=1
strMyXML=""
message="Provide full folder path where js files are present"+vbcr+"eg. C:\output\whxdata"
title="Robohelp output JS to XML convertor"
if WScript.Arguments.count=1 then
jsFilePath= WScript.Arguments(0)
bThrowUI=0
end if
if bThrowUI=1 then
jsFolderPath = InputBox(message, title, new_build,6000 ,5000)
end if
if jsFolderPath="" then
msgbox "Action cancelled"
Wscript.quit
else
if not objFSO.FolderExists(jsFolderPath) then
msgbox("Specified JS folder could not be found")
Wscript.quit
end if
set jsFolder=objFSO.GetFolder(jsFolderPath)
for each jsFilePath in jsFolder.Files
strMyXML=""
startWriting=false
if lcase(objFSO.getExtensionName(jsFilePath.path))="js" then
xmlfilePath=sCurPath+"\"+Left(jsFilePath.name,Len(jsFilePath.name)-7)+".xml"
if not objFSO.fileexists(xmlfilePath) then
objFSO.CreateTextfile(xmlfilePath)
end if
Set objFile = objFSO.OpenTextFile(jsFilePath, 1)
set writefile=objFSO.OpenTextFile(xmlfilePath,2)
Do Until objFile.AtEndOfStream
strCharacters = objFile.Read(1)
bSkip=false
if strcomp(strCharacters,"<")=0 then
startWriting=true
end if
if startWriting=true then
if strcomp(strCharacters,"\")=0 then
bSkip=true
end if
if strcomp(strCharacters,">")=0 and NOT bSkip then
strMyXML=strMyXML+strCharacters+vbcrlf
end if
if not strcomp(strCharacters,">")=0 and NOT bSkip then
'writefile.strCharacters
strMyXML=strMyXML+strCharacters
end if
end if
Loop
length=len(strMyXML)
writefile.Writeline Left(strMyXML,length-2)
writefile.close
end if
next
end if
if bThrowUI=1 then
msgbox "Required xml file successfully created at "+sCurPath
end if
------------------------------------------------------------------------------------------ --------- Script ends------------------------------------------------------------------------------------- --------------------------------------------------
Thanks and Regards,
Mohd Sameer.
Adobe RH team -
Hi All,
Im working on implementing Oracle PIP with ODI.
Im not able to access an XML file within ODI. The Physical architecture is set to the correct directory, filename etc.
It was working fine before until recently we restarted the agent & re-encoded the passwords for Supervisor & Master Rep accounts.
It now shows "table not found: ORA - account is locked" or "invalid username/password - login denied" error when I try to view the data of the datastores within the Model (whose source is the XML file).
Any thoughts?
Thanks,
RubyDoes you XML file use an external database store ? Maybe the db password in that file wasnt changed
-
JDEV 10.1.3 XML Editor does not load XML file
I am trying to edit a large (300MB+) xml file with JDEV 10.1.3 running on a Windows XP Pro workstation with a 2.8 ghz processor and 1GB of memory. The XML file has application data in it. The file loads just fine into the Oracle database using the XML Developer's toolkit so I don't thing there is anything wrong with the XML.
I'm finding that the XML editor does not load the file. Many minutes elapse, then JDEV appears to simply give up - JDEV is no longer busy. There's no XML data to edit - that window is empty. There are no error messages displayed.
I'm new to JDEV so I need to know if there is an error log file I should examine.
BTW, other XML editors (XML Spy, Stylus Studio, etc) simply run out of memory and lock up the machine - it appears they are tryign to convert the XML file contents into 32-bit unicode in memory, build a list of pointers to impose a DOM-like structure, and then load their editor.Do you really want to manually edit the 300MB file? how much scrolling will you need to do to get to the last row?
In any case it is likely that JDeveloper also runs out of memory - you can try running the [jdev-root]\jdev\bin\jdev.exe file and see if you get any error message in the log window. -
I have a page that rotates through a series of static
graphics with an animated sequence between each static image. I did
not design this and am now having to make a duplicate copy of this
with new colors in the animation and a different XML file to draw
the images and titles from. You can see the working version here:
Working Version
I have gone into the action script where the XML file name is
specified. I have changed the name to the new XML file name. I
re-export the swf file and despite the XML file being in the same
location as the original XML file, this simple change seems to
break the animation and it freezes just before putting up the first
information from the new XML file.
Non-Working
Version
Actionscript is not my strong suit. I have gone through and
compared the code and I can't find anything that would explain this
problem. If anyone has any pointers on what might be causing this,
I would be extremely greatful to hear from you.
Regards,
AndyPlease disregard, found the problem. File was being saved on
local test server and NOT on remote. -
ITunes will not accept XML File
Hello,
I have been trying to upload my normal weekly xml file and iTunes won't accept it. In the past, I copy and paste the previous entry in the xml file, make the upates (name of file, length, date, title, etc.) and then upload the updated file. Been doing that for years. Now, for the last six weeks, I have to recopy the previous week's entry, make the updates and save numerous times. Sometimes iTunes will accept it, sometimes it doesn't. Is there a limit of how many lines you can have in an xml file? When I try to validate it, http://validator.w3.org, i get the following error:
line 8185, column 2: XML parsing error: <unknown>:8185:2: mismatched tag [help]
</channel>
There is a <channel> on line 05, so this error doesn't make sense to me.
Can someone please take a look at the file and help me figure out the problem? I would appreciate it.
Here is the link: http://graceplace.org/media/audio/podcast.xml
Thank you!The problem is just before your first 'item' tag:
<itunes:category text="Religion & Spirituality">
<itunes:category text="Christianity">
</itunes:category>
<item>
In the second line quoted above, you have not closed the tag, so that everything for the rest of the feed is seen as being within that tag - including the closing 'channel' tag, which is where the error has been flagged,
Those lines should read
<itunes:category text="Religion & Spirituality">
<itunes:category text="Christianity" />
</itunes:category>
<item> -
Anonymizer Bean is not working XML file -- ABAP Proxy scenario.
Hi Experts,
Can anybody please help, How can add this line <ns0:ROOT xmlns:ns0="urn:XXX:snc:productactivedata"> to my input xml file?
</ns0:ROOT> to the end of the input xml file. One more thing please, how to remove "standalone="yes" " from this line <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
I have tried with Anonymizer bean settings, I can't able to achieve this, with XSLT mapping could, but I don't know XSLT mapping, can any one help me in this?
Many Thanks
Regards
SanHi Prateek,
If do, like remove namespace in the message type then i get this error.
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>XIServer</SAP:Category>
<SAP:Code area="MAPPING">GENERIC</SAP:Code>
<SAP:P1>com/sap/xi/tf/_MM_EDI_ProAct_One_N_</SAP:P1>
<SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException:</SAP:P2>
<SAP:P3>The element type "D01_PO4" must be terminated by t</SAP:P3>
<SAP:P4>he matching end-tag "</D01_PO4>".</SAP:P4>
<SAP:AdditionalText />
<SAP:Stack>com/sap/xi/tf/_MM_EDI_ProAct_One_N_com.sap.aii.utilxi.misc.api.BaseRuntimeException:The element type "D01_PO4" must be terminated by the matching end-tag "</D01_PO4>".</SAP:Stack>
I have checked the message, xml message format fine. Any help in this please?
Thanks & Regards
San -
How to extract a single colum form XML files and load in a table
Hi below I have a structure of xml files , I just need to extarct <RecordReference>PQPMID:7358</RecordReference>
from file and load in to oracle ..
Please let me know how to do ..??
file content below
HoldingsRecord>
<RecordReference>PQPMID:7358</RecordReference>
<NotificationType>00</NotificationType>
<SerialVersion>
<SerialVersionIdentifier>
<SerialVersionIDType>07</SerialVersionIDType>
<IDValue>1068624X</IDValue>
</SerialVersionIdentifier>
<SerialVersionIdentifier>
<SerialVersionIDType>01</SerialVersionIDType>
<IDTypeName>PMID</IDTypeName>
<IDValue>7358</IDValue>
</SerialVersionIdentifier>
<Title>
<TitleType>02</TitleType>
<TitleText>Pittsburgh Post - Gazette</TitleText>
</Title>
<Publisher>
<PublishingRole>01</PublishingRole>
<PublisherName>Post Gazette Publishing Company</PublisherName>
</Publisher>
<OnlinePackage>
<OnlineServiceName>ProQuest</OnlineServiceName>
<Website>
<WebsiteRole>03</WebsiteRole>
<WebsiteLink>http://proquest.umi.com/pqdweb</WebsiteLink>
</Website>
<HoldingsDetail>
<JournalIssue>
<JournalIssueRole>04</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>19930118</Date>
</JournalIssueDate>
</JournalIssue>
<JournalIssue>
<JournalIssueRole>06</JournalIssueRole>
<JournalIssueDate>
<DateFormat>00</DateFormat>
<Date>20080915</Date>
</JournalIssueDate>
</JournalIssue>
<EpubFormat>10</EpubFormat>
</HoldingsDetail>
</OnlinePackage>
</SerialVersion>
</HoldingsRecord>DECLARE
l_clob CLOB;
l_bfile BFILE;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
l_temp VARCHAR2(1000);
src_csid NUMBER := NLS_CHARSET_ID('UTF8');
dest_offset INTEGER := 1;
src_offset INTEGER := 1;
lang_context INTEGER := dbms_lob.default_lang_ctx;
warning INTEGER;
TYPE tab_type IS TABLE OF gt_pq_pmid%ROWTYPE;
t_tab tab_type := tab_type();
BEGIN
l_bfile := BFileName('XML_DIR', 'SOH_sample.xml');
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
dbms_lob.loadclobfromFile( l_clob,
l_bfile,
dbms_lob.getLength(l_bfile),
dest_offset,
src_offset,
src_csid,
lang_context,
warning);
dbms_lob.close(l_bfile);
dbms_session.set_nls('NLS_DATE_FORMAT','''DD-MON-YYYY''');
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
-- Get a list of all the row nodes in the document using the XPATH syntax.
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'HoldingsRecord/');
FOR cur_stage_xml IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
l_n := dbms_xmldom.item(l_nl, cur_stage_xml);
t_tab.extend;
dbms_xslprocessor.valueOf(l_n,'RecordReference/text()',t_tab(t_tab.last).pq_pmid);
END LOOP;
FOR cur_stage_xml IN t_tab.first .. t_tab.last LOOP
INSERT INTO
gt_pq_pmid (
pq_pmid )
VALUES
(t_tab(cur_stage_xml).pq_pmid);
END LOOP;
COMMIT;
dbms_xmldom.freeDocument(l_doc);
EXCEPTION
WHEN OTHERS THEN
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
raise ;
END;---------- and i am getting below error
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00210: expected '<' instead of 'H'
Error at line 1
ORA-06512: at line 65 -
Can not view .xml files
I am working with office 2013. I was able to open the .xml files in office 2010, it opened in IE 9 just fine. Now I am using 2013, IE 11... How can I view the .xml files?
Hi
Jedi_Administrator,
Is there any error message when you open XML file in Office 2013 or IE 11?
XML file is supported by Office 2013 and IE 11.0.
More reference:
http://technet.microsoft.com/en-us/library/cc179191(v=office.15).aspx
If it’s convenient, you’d better upload a XML file to OneDrive and share the file link here. I’ll analyze this issue as soon as
getting it.
Best regards,
Greta Ge
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Beware the Refractor - Move - does not update xml files - ouch!
better hope you have backups
yes check text file was checked . it moves the java file ok from the package but leaves the xml info the same so now databindings.cpx has a problem. if you run the java file you get everyone's very favorite null pointer error which sends you looking everywhere again.
Also good forbid you have a spelling error in the xml file when you fix it. It will actually creates a new xml file --- why ? --- which creates a null pointer error of course!
So what shell is the null pointer under?
Maybe you are looking for
-
Video card to run 30 inch display for G5 2.5 GHz quad core
I want to purchase the 30 inch HD display for my G5 Quad core 2.5 GHZ machine. Apple states that it needs the nVidia GeForce 6800 card to run. I have the GeForce 6600. Will the 30 inch display run at a lower resolution with this card? If not, could s
-
Hi Xi Gurus, we are using netweaver 2004s & have java.lang.NullPointerException problem when trying to create object with internal communication scenario in Configuration : integration Builder. Though the problem was mentioned in Michal's Xi/PI FAQ
-
Is the reception of iPhone 5c better than 5s.
Was advised at a Telstra store that the reception of the iPhone 5s was worse than that of the 5c. Am thinking of upgrading from 4s. Has anyone experienced this?
-
Date format in 8i Lite ver. 4.0.0.2
Hello, whenever I set the NLS_DATE_FORMAT to 'dd.mm.yyyy' I get the following error when selecting SYSDATE in SQL-Plus or opening a table containing dates in Navigator. Error: OCA-30023: error fetching result set [POL-2416] invalid date/time format C
-
I'm looking for a way to have a JButton in my java applet that will load up a new page from the applet page when it is clicked. Basically I'm making a game, and the registration system will be done in php, so I don't want to create the same registrat