Urgent help in searching XML docs
Hi All,
I have started using JDOM and created a XML document after reading the contents from a text file. Now i need to implement a search facility on this XML document. The structure of my XML document is given bellow
<Company ID="C1">
<Name>aa</Name>
<Address>qq</Address>
<Contact_Person>ww</Contact_Person>
<Designation>ee</Designation>
<Phone>123</Phone>
<Fax>456</Fax>
<EMail>acd</EMail>
<Website>axc</Website>
<Business_Type>hfs</Business_Type>
<Operation_Areas>khgd</Operation_Areas>
<Other_Info>csbdcks</Other_Info>
</Company>There are similar company nodes having information about different companies.
The search criteria can be based on any one node e.g search companies by <Location> or <Business_Type> etc. I am planning to use XSL and pass the search parameters. Is the approach right?? Could someone guide me with some code examples .
Thanks in advance..
Nilotpal
If you want to search information in a JDom object, you can use XPath with Jaxen: http://www.jaxen.org/
I never used Jaxen, so I can't help you.
But with XPath you can implement many search facilities.
Similar Messages
-
URGENT HELP ! Search did not help !
*URGENT HELP ! Search did not help !*
I bought my new iPod classic three days ago and until yesterday it worked OK. Every time I plug iPod to my computer I get message "CONNECTED" and I hear that sound in Windows that is saying that something is connected, but almost amidiadly I get the message "EJECTING" and it ejects. I don't see anything in iTunes or My Computer and everything lasts for a few seconds. I reinstalled Windows, so I'm using a fresh copy without any bugs, well if you can call Windows bug free lol USB port to which I'm connecting iPod is 2.0...
I can't even see iPod in My Computer - Properties - Hardware - Device Manager.. And when I leave this windows on and then connect iPod I can see that "xx Apple iPod" appears for a few seconds...
I read that people had similar and same problems, but there is for instance no connected device in Device Menager for me to update and even Disk Mode does not work... I also did not read that someone solved this problem...
Scould I call them and ask them to get another one or what ?
PLEASE HELP ! And Thank You...
Message was edited by: Samael54No I downloaded the fix, but it won't not even install.. I sow that that fix was replaced with a new one, so I subscribed to get that fix, but nothing so far, but I remember installing that fix yesterday and it did not help as well.. I will try to get it to some other computer and restore it without iTunes somehow, but I don't know if this is posible or if it does not work with my PC does not mean it will work on some other
-
Urgent help needed for XML Tags using XMLForest()
Folks
I need some urgent help regarding getting use defined tag in your
XML output.
For this I am using XMLElement and XMLForest which seems to work fine
when used at the SQL prompt but when used in a procedure throws and error
SQL> Select SYS_XMLAGG(XMLElement("SDI",
XMLForest(sdi_num)))
From sdi
where sdi_num = 22261;- WORKS FINE
But when used in a procedure,doesnt seem to work
Declare
queryCtx DBMS_XMLQuery.ctxType;
v_xml VARCHAR2(32767);
v_xmlClob CLOB;
BEGIN
v_xml:='Select SYS_XMLAGG(XMLElement("SDI",
XMLFOREST(sdi_num)))
From sdi
where sdi_num = 22261';
queryCtx :=DBMS_XMLQuery.newContext(v_xml);
v_xmlClob :=DBMS_XMLQuery.getXML(queryCtx);
display_xml(v_xmlClob);
End;
CREATE OR REPLACE PROCEDURE display_xml(result IN OUT NOCOPY CLOB)
AS
xmlstr varchar2(32767);
line varchar2(2000);
BEGIN
xmlstr:=dbms_lob.SUBSTR(result,32767);
LOOP
EXIT WHEN xmlstr is null;
line :=substr(xmlstr,1,instr(xmlstr,chr(10))-1);
dbms_output.put_line('.'||line);
xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
END LOOP;
end;
SQL> /
.<?xml version = '1.0'?>
.<ERROR>oracle.xml.sql.OracleXMLSQLException: Character ')' is not allowed in an
XML tag name.</ERROR>
PL/SQL procedure successfully completed.
SQL>HELP is appreciated as to where I am going wrong?Hi,
if you want to transform something to something else, you should declare, what is your source.
I would prefer to use plain XSL-Transformations, because you have a lot more options to transform your source and you can even better determine, how your output should looks like.
Kind regards,
Hendrik -
Need help on processing XML doc using Java store procedure
I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
--createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
Thank you in advance if anyone can give some hints.I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
--createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
Thank you in advance if anyone can give some hints. -
Urgent help for processing XML stream read from a JAR file
Hi, everyone,
Urgently need your help!
I am reading an XML config file from a jar file. It can print out the result well when I use the following code:
===============================================
InputStream is = getClass().getResourceAsStream("conf/config.xml");
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line); // It works fine here, which means that the inputstream is correct
// process the XML stream I read from above
NodeIterator ni = processXPath("//grid/gridinfo", is);
Below is the processXPath() function I have written:
public static NodeIterator processXPath(String xpath, InputStream byteStream) throws Exception {
// Set up a DOM tree to query.
InputSource in = new InputSource(byteStream);
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
dfactory.setNamespaceAware(true);
Document doc = dfactory.newDocumentBuilder().parse(in);
// Use the simple XPath API to select a nodeIterator.
System.out.println("Querying DOM using " + xpath);
NodeIterator ni = XPathAPI.selectNodeIterator(doc, xpath);
return ni;
It gives me so much errors:
org.xml.sax.SAXParseException: The root element is required in a well-formed doc
ument.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213
at org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XM
LDocumentScanner.java:570)
at org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.endO
fInput(XMLDocumentScanner.java:790)
at org.apache.xerces.framework.XMLDocumentScanner.endOfInput(XMLDocument
Scanner.java:418)
at org.apache.xerces.validators.common.XMLValidator.sendEndOfInputNotifi
cations(XMLValidator.java:712)
at org.apache.xerces.readers.DefaultEntityHandler.changeReaders(DefaultE
ntityHandler.java:1031)
at org.apache.xerces.readers.XMLEntityReader.changeReaders(XMLEntityRead
er.java:168)
at org.apache.xerces.readers.UTF8Reader.changeReaders(UTF8Reader.java:18
2)
at org.apache.xerces.readers.UTF8Reader.lookingAtChar(UTF8Reader.java:19
7)
at org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.disp
atch(XMLDocumentScanner.java:686)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
canner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.
java:195)
at processXPath(Unknown Source)
Thank you very much!
Sincerely Yours
Davidorg.xml.sax.SAXParseException: The root element is required in a well-formed document.This often means that the parser can't find the document. You think it should be able to find the document because your test code could. However if your test code was not in the same package as your real (failing) code, your test is no good because getResourceAsStream("conf/config.xml") is looking for that file name relative to the package of the class that contains that line of code.
If your test code wasn't in any package, put a slash before the filename and see if that works. -
Urgent help importing an XML file
Hi all,
I'm currently exporting my XML files from Magento, the webshop client. However I cannot use the XML task in ETL because I get the error about namedspaces. I can open the XML file itself no problem, it contains a few columns with data, some empty values.
What I do to solve the error is create the script in ETL that converts the XML file so that I can make the SDX schema. The ETL script itself works
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" />
<xsl:template match="/|comment()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*|node()" />
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
But when I open the newly created file he looks really odd: See below for the initial file and the new file (based on how many times I open the file, i get another weird look...). Please help me out it's killing me :)Or you can apply a XSLT transform as per http://blogs.msdn.com/b/mattm/archive/2007/12/15/xml-source-making-things-easier-with-xslt.aspx
Arthur My Blog -
Hi,
Iam using the above said parser to parse an XML & XSL File.
My code looks like this...
XMLParser xmlpar;
While initialising the XMLParser
ecode = xmlpar.xmlinit();
xmlinit() function is returning an error code saying 201 (XMLERR_BAD_ENCODING).
I want to know more about this error & I need u r kind help in debugging this ...
Iam using VC 6.0 IDE ... and have created an project using Win32 Console Application project type.
Thanks in Advance,
Raj.Thanks a Ton. XMLInit worked and is working Fine.
But ... in this statement
ecode = xmlpar.xmlparse((oratext *) xmlFile, (oratext *) 0, flags);
while initialising the xmlFile using the xmlparse function eventhough the file is present in the directory it is giving error 202. The message is ...
LPX-00202:Message 202 not found; No message file for product=XDK, facility=LPX
I have set all the environment variables like
set ORA_NLS33=E:\Oracle\nlsdata
set ORACLE_HOME=E:\Oracle
set ORA_XML_MESG=E:\Oracle\xdk\mesg
Please let me know if I have missed out something ...
Thanks in Advance
Raj. -
*URGENT * Parsing nd Searching XML with DOM
Hi,
I am Juliana, I am a new grad, a new employee and brand new to XML, I am learning to parse XML with the XML parser for PLSQL.
Please anyone help me how to parse the following XML string so that I will display all the session and its time schedule, or if possible display only the session that I want to display.
Thank you very much for any of your help
Juliana
<Student> Id="9130099">
<Class>
<Session>A-100</Session>
<Session>A-200</Session>
<Session>A-300</Session>
<Session>A-400</Session>
<session>A-500</Session>
</Class>
<Time> At:
<At>10:30</At>
<At>12:30</At>
<At>02:30</At>
<At>04:30</At>
<At>05:30</At>
</time>
</Student>thx for the replay
1) i thought of using xpath but wanted to know how to do it over DOM
2) i mean that the 3 <item> have other element inside like that:
<item>
<title>Implementing Service-Oriented Architectures (SOA) with the Java EE 5 SDK</title>
<link>http://java.sun.com/developer/technicalArticles/WebServices/soa3/?feed=JSC</link>
<description>This article presents concepts and language constructs needed to develop a Service-Oriented Architecture composite application in Java EE 5. It then describes an example application designed to solve a business problem.</description>
<date />
</item>and all of them have <title>, <link> etc. I want to get the same values(eg. <title>) from all the 3 <item> and not including the <title> in the begining of xml
3) i am a professional child.....joke....
try to get to your sensitive side...thats way. -
URGENT Help needed in XML Publisher Please...Business critical
Hi
I am having 2 different types of invoices like
1.Normal Invoice
2.Bundled Invoice
Both cases will have different bodies BUT SAME summaries.
So based on the Formula column FLAG (BUNDLED=YES or NO) I would like to
choose a different body like G_NORMAL INVOICE_BODY Or G_BUNDLED_INVOICE_BODY.
The summary for both of them are the same.
Case 1: Normal Invoice Group
<G_INV_TERM>
<G_INVOICE>
<G_LINES>
invoice line details
--------Line1
------- LIne2
------- LIne3
</G_LINES>
<G_SUMMARY>
</G_SUMMARY>
</G_INVOICE>
</G_INV_TERM>
Case 2: Bundled Invoice Group
<G_INV_TERM>
<G_INVOICE>
<G_BUNDLE>
---Bundled Invoice Line
</G_BUNDLE>
<G_SUMMARY></G_SUMMARY>
</G_INVOICE>
</G_INV_TERM>
Based on a condition.Like if BUNDLE=N then do the following:
For Normal Invoice
with <G_INV_TERM> --HEADER
and then invoice lines group <G_LINES> for normal invoice.---BODY
and then FOOTER Summary--<G_SUMMARY>
Based on a condition.Like if BUNDLE=Y then do the following:
with <G_INV_TERM> --HEADER
and then invoice lines group <G_BUNDLE> for normal invoice.---BODY
and then FOOTER Summary--<G_SUMMARY>
In one single template How can I handle Different GROUPS based on a condition.?
Thanks
PrasannaIs this Sample XML ?
<G_INV_TERM>
<BUNDLED>Y</BUNDLED>
<G_INVOICE>
<G_LINES>
<LINE>1 </LINE>
<LINE>2 </LINE>
<LINE>3 </LINE>
<LINE>4 </LINE>
<LINE>5 </LINE>
<LINE>6 </LINE>
<LINE>7 </LINE>
</G_LINES>
<G_BUNDLE>
<BUNDLE>A</BUNDLE>
<BUNDLE>B</BUNDLE>
<BUNDLE>C</BUNDLE>
<BUNDLE>D</BUNDLE>
<BUNDLE>E</BUNDLE>
</G_BUNDLE>
<G_SUMMARY>
Summary For all
</G_SUMMARY>
</G_INVOICE>
</G_INV_TERM> -
Urgent, Help on conversion: xml to flat file
Dear experts,
Here is the scenario, XML FILE ->XI-> JMS
In JMS recevier side, we use localejbs/AF_Modules/MessageTransformBean to convert xml to flat file.
Transform.Class: com.sap.aii.messaging.adapter.Conversion
Transform.ContentType: text/plain;charset=utf-8
xml.conversionType: SimpleXML2Plain
xml.fieldFixedLengths: 5,20,5,8
When input source xml file contents are non-unicode, it works fine.
But when the contents contain unicode characters such as Chinese word, it works but with wrong length in the output flat file. It seems xi treat one Chinese word length is 1. Actually, one chinese word should take 2 bytes.
My question is how to make XI handle unicode characters with correct lengths while conversing to flat file.
Thanks in advance.Jai Shankar
Thanks for your response.
I am already using the standard adapter modules provided by SAP:
localejbs/AF_Modules/MessageTransformBean
Transform.Class: com.sap.aii.messaging.adapter.Conversion
My input file's encoding is UTF-8
"You need to change the encoding scheme according to your input file" , do you mean change the output file's encoding or else?
I can't find the article you mentioned: "Encoding schemes in XI", Would you please give me the link?
Thanks a lot. -
Search XML doc with Intermedia
Is the following query correct for Intermedia? It doesn't return any rows and I know I have some in my table.
SELECT ID
FROM ngtn_transition
WHERE transition_name = 'Negotiate'
AND status = 0
and ( contains (source, '(DESKA WITHIN desk) and (USRA WITHIN user)') > 0 OR
contains (destination,'(DESKA WITHIN desk) and (USRA WITHIN user)') > 0 ) and
( contains (source, 'DESKB WITHIN desk') > 0 OR
contains (destination, 'DESKB WITHIN desk') > 0 );
nullYes, thanks Steve. I loaded ctxsrv as a daemon process and it syncs all DML every few seconds. Very nice, however, I heard ctxsrv causes a lot of index fragmentation?
-
Urgent Help required! - Storing the XML as String instead as a file
Hi,
I need urgent help on this.
I have an XML file. I have used org.w3c.dom to build dom and manipulate the XML file.
I have updated the values for some of the nodes and I have deleted some of the unwanted nodes.
I am able to save the output of the DOM as another XML file using
either transform class or XMLSerializer with OutputFormatter class.
But my requirement is to save the output of the DOM into a String instead of a file.
When I save it in String, I need to have the following XML decalration and DOCTYPE declration also with it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Test SYSTEM "Test.dtd">
Can anyone pls help me in this??
Thanks in Advance. Expecting some inpputs pls....!
Regards,
Gayathri.hi,
i think this is what u want
public static String getXmlString(Document d) {
StringWriter strResponse = null;
try {
OutputFormat format = new OutputFormat(d);
strResponse = new StringWriter();
XMLSerializer serial = new XMLSerializer( strResponse, format );
serial.asDOMSerializer();
serial.serialize(d.getDocumentElement());
catch (Exception e) {
System.out.println(e.toString());
return strResponse.toString();
}HTH
vasanth-ct -
Load XML in intranet ? urgent help please...
Dear friends, I need urgent help: I have a CAYIN screen (which lets me display evetns, etc) and gives me the option of loading/displaying a FLASH (SWF) file, well, I need this SWF to load some XML data ("texto.xml") but seems that when the CAYIN program which executes flash, does not allow the SWF to find the XML in the same folder...
Then I tried many ways to load the XML file with no success till now. Some tries are :
obj_xml.load("\\192.168.0.100\media\texto.xml")
obj_xml.load("\media\texto.xml")
obj_xml.load("texto.xml")
obj_xml.load("../media/texto.xml")
obj_xml.load("\\media\texto.xml")
obj_xml.load("file:\\192.168.0.100\media\texto.xml")
obj_xml.load("..\\192.168.0.100\media\texto.xml")
I guess I am writting something wrong or forgetting something. Would anyone please help me ? because these files are in an internal server "192.168.0.100" (intranet).
Urgent help please, thanks in advance,if the swf is in a directory with subdirectory media which contains texto.xml, use:
obj_xml.load("media/texto.xml") -
URGENT HELP NEEDED ... Tomcat Realm and JRE1.4 plug-in problem
I have tried the Security Realm of Tomcat. Since I do not have
an LDAP server, I decided to use the Tomcat-users.xml file in
Tomcat\conf directory.
I added the following lines of code in the web.xml file.
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<!-- NOTE: This role is not present in the default users file -->
<role-name>webviewer</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Tomcat Manager Application</realm-name>
</login-config>
The <role-name> "webviewer" is added into "Tomcat-Users.xml" as the following:
<tomcat-users>
<user name="test" password="password" roles="webviewer" />
</tomcat-users>
So, now when we type the url: http://localhost:8080/adbpdbre/default.htm, TOMCAT shows a dialog box asking for UserName: and Password:Now, only when we give the username and password, it shows the page. This is exactly what we want.
But the problem now is, this default.htm page, has 5 links to 5 applets. The first time that I click on one of these links, the JRE plug of 1.4 shows a dialog again asking for the username and password. Till I dont provide the username and password the system doesnt go ahead and applet doesnt load. I do not want the JRE to ask me for the username/passwords again..How to avoid this ?
Can you give me some more information on this. Ultimately in the production usage, we will be using LDAP and not Tomcat's memory realm.
URGENT HELP NEEDED ... I need to get back to my client on this.
Help would be v. much appreciated.In the config file, you 're essentially saying that you want Tomcat to prompt for usr/passw on every request (url-pattern = /*) made by a 'webviewer', and that's exactly what Tomcat is doing.
Consider using specific url-patterns & roles for resources to be protected. If for now, all you need is to protect the first page, use a more specific url-pattern.
Just an advice : if you'll be using LDAP in production, do not waste time with Tomcat's Security Realm and the BASIC authentication type, since the two have not much in common. Start reading doc on LDAP, and code a prototype, or even better, a vertical slice of the app (i.e a proof of concept). -
How to search xml file data based on the given keyword from html form
hi,
i'm new to XML. I have this problem regarding searching within a XML file.
the
idea is that my search will be based on the keyword entered
in
by the user from a HTML form. the keyword is then used to search all
the
question nodes and the choice nodes within a XML file. once the match
is
found, i will have to display the results.
But i don't know how to do so - especially the part of searching xml file.
Can
anyone help me in this? Your help is much appreciated.
Edited by: Moti_Lal.D on Apr 4, 2008 7:28 AMyeah.. what i was trying to do is
i have one xml fine. then i have to read all the tag values say
<book>
<title>Java</title>
<author>agarwal</author>
<price>200</price>
</book>
<book>
<title>Xml</title>
<author>saxmann</author>
<price>300</price>
</book>
i can read the tag values like this
File file = new File("dom.xml");
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(file);
NodeList nodes = doc.getElementsByTagName"book");
for (int i = 0; i < nodes.getLength(); i++) {
Element element = (Element) nodes.item(i);
NodeList title = element.getElementsByTagName("title");
Element line = (Element) title.item(0);
what i want is i may give any xml file
like File file = new File("xxx.xml");
(it may be one level/two level/3level tagged one)
then the i should read all the tag values and store them in some array. Then when i enter some character from keyboard (say "a") then it has to show all the tag values starts with "a" and display them.
i guess u understand my problem.
Maybe you are looking for
-
Help: Connecting Tomcat to CA-IDMS Using JDBC Type 4 Drivers (JNDI)
Hi there, I have a rather interesting / complex problem......creating a connection to CA-IDMS from Tomcat using JDBC type 4 drivers (CA provide the type 4 driver). We have a zSeries 9 IBM mainframe running CA-IDMS r16.1, and I need to connect to the
-
How do I fix the orientation of a desktop background photo?
I have a bunch of photos that I'd like to be able to use as my desktop background - all are saved on my computer with the correct "portrait" orientation, but when I open system preferences they weirdly show up in "landscape" orientation. I've tried
-
Password bios hp mini 110-1110el help
HI, when i start the netbook, the sistem ask my a password with this message: Enter CURRENT Password. can help me Pease. thanks best regards This question was solved. View Solution.
-
Multi-choice question - go back and re-answer?
Hello there, cp5. Request was to build an activity where learner is presented 4 questions each with two options. After answering the question, return to the list of 4 questions where their responses are measured accumulatively. After seeing the sum
-
Web Service Installation Problem
Hello, I am working with Java Web services having some prolems need urgent help. The problem is that after installing the web service on the perticular host i got the following error. Where "IResourceAdmin" is the interface for the web service. Error