Parse THIS!!! XML can't contain HTML (anchor tags)????
Is there a way to parse XML that has HTML tags and special characters within it?
<br><br>
I've been searching for days for a solution with no joy.
<br>
The Oracle scripts I wrote below work fine as long as only alphanumeric characters are in the XML doc.
<br><br>
Here's what I'm doing...I'm page scraping several dynamic websites using ColdFusion. I remove all the unneeded HTML...and replace the remaining HTML with XML tags.
<br><br>
I then want to pass this XML (see below) variable (cfxml) to Oracle so it can be parsed and loaded into the database. If I remove the anchor tags and the CDATA tags...the code works fine....but I want the anchor tags loaded into my table.
<br><br>
Anyone have any suggestions....preferably a solution so I can stop pulling my damn hair out.
<br><br>
<br>
Oracle Scripts<br>
<br>
create or replace procedure LoadXML (cfxml in varchar) AS
<br>
begin<br>
insert into JOBS (xmldoc) values <br>(xmltype.createxml(cfxml));<br>
end;
<br><br>
create or replace trigger job_bifert as<br>
begin<br>
if (:new.xmldoc is null) then<br>
return;<br>
end if;<br>
select <br>
xmltype.getstringval(:new.xmldoc.extract('/recordset/row/title/text()')),<br>
xmltype.getstringval(:new.xmldoc.extract('/recordset/row/company/text()')),<br>
xmltype.getstringval(:new.xmldoc.extract('/recordset/row/location/text()'))<br>
into :new.title, :new.company, :new.location<br>
from dual;<br>
end;<br>
<br>
<br>
Sample XML being sent to Oracle via ColdFusion
<br>
<br>
<?xml version="1.0" encoding="iso-8859-1"?><br>
<recordset><br>
<row><br>
<date><br>
<![CDATA[
Jul 27
]]><br>
</date><br>
<title><br>
<![CDATA[
< a href="http://jobsearch.monster.com:80/getjob.asp?JobID=32472300&AVSDM=2005%2D07%2D28+02%3A36%3A26&Logo=1&q=cold fusion&cy=US&sort=dt">ASP.NET Technical Program Manager with Marketing Savvy< /a>
]]><br>
</title><br>
<company><br>
<![CDATA[
Excell Data
]]><br>
</company><br>
<location><br>
<![CDATA[
< a onClick="popMMLL('WA','Redmond'); return false;" href="http://jobsearch.monster.com:80/896">WA-Redmond< /a>
]]><br>
</location><br>
</row><br>
</recordset>
Hi:
You can parse HTML tags inside the Database using JTidy library.
Load JTidy to the sys schema using loadjava with grant to public or into your own schema.
The you can parse HTML tags in a CDATA section creating a Tidy parser. Look at this code as example, its part of DBPrism CMS XForms actions and it process an HTMLArea HTTP Post action. See the method updateContent(CLOB post_xml):
http://cvs.sourceforge.net/viewcvs.py/dbprism/cms-2.1/src/com/prism/cms/frontend/PageActions.java?rev=1.5&view=auto
The CLOB arguments is an XML XForm instance document, the content node has the HTML tags to be parsed wrapped by CDATA tags:
So the String content are the HTML tags.
Once the document is parsed by JTidy it is converted to a valid XML and it will be accepted by the XMLType instance.
Best regards, Marcelo.
Similar Messages
-
ICal [Exchange calendar]: "This calendar can only contain to do items"
Hi, after SL upgrade I cannot add/edit any longer my exchange accounts calendar in iCal. It only says that "This calendar can only contain to do items".
I have tried to delete the account and reset it but it didn´t solve the issue.
We are using Kerio Mail Server as Exchange solution.
Should I wait for 10.6.1 to fix this or is there a work around?It was my fault, because this problem really a Kerio Mail Server faliure!
http://discussions.apple.com/thread.jspa?threadID=2159279&tstart=0
Message was edited by: pagocs -
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.
ThanksDocumentBuilder 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. -
HTML DB HTML (Anchor Tag)
Hello everyone,
I have a target of icon which enables me to open a Web page located in a repertory of my network.
I would like to be able according to the place that I am in my application, to reach a place in page HTML (ANCHOR tag).
I put in page HTML of the anchors such as <A NAME="Zoom">
I tested in the target of icon: J:\PROJ\T-bord\LIV_01\relnotes0.3.2.html<a ref="#Zoom"> "target=_blank".
The page opens, but it is not placed at Zoom inking. Can you say to me if there is another way of being able to regulate my problem?
Thank you very much! Bye.Hello Vikas,
I will try to reformulate my question with less ambiguity.
I have in the heading of each page of my application an image with a bond to open a file .PDF.
The file contains many information and I would like that by opening this file outward journey at a precise place in the file.
I did not see how proceeding to do that with a file PDF.
I then thought of modifying file PDF in format HTML.
With this format, I can place at various places, anchors(ex : A NAME="Zoom"), in order to use them in my application HTML dB.
At the time when I open file HTML, I want to place myself at the place that I want in the file without being obliged to traverse all the file to go to seek my information.
In the properties of the image in HTML dB, I placed in the section of the target of icon the address of the file and also the name of the anchor to be located at a precise place of my file: J:\PROJ\T-bord\LIV_01\relnotes0.3.2.html a ref="#Zoom" "target=_blank"
My file opens but at the beginning of the file. It is not occupied of the anchor to locate me at the desired place.
I seek how to make?
Thank you.
Message was edited by:
timiche
Message was edited by:
timiche
Message was edited by:
timiche -
How can parse this xml tag " Cell ID="0" Type="String" Afghanistan cell "
Hi,
I have to parse this type of xml file.
so how can i parse this type of xml file like
<Row ID="1">
<Cell ID="0" Type="String" >Afghanistan</Cell>
<Cell ID="1" Type="Number" >93</Cell>
<Cell ID="2" Type="Number" >0</Cell>
<Cell ID="3" Type="Number" >1</Cell>
</Row>You haven't given us enough information. Is this for iPhone or Mac OS X? What language are you using? etc.
-
Hi,
my xml file has this structure:
<config>
<settings>
<engine>ON</engine>
<monitor>OFF</engine>
<debug>ON</engine>
</settings>
<rules>
<rule>
<scope>...</scope>
<action>...</action>
</rule>
<rule>
<scope>...</scope>
<action>...</action>
</rule>
<rule>
<scope>...</scope>
<action>...</action>
</rule>
</rules>
</config>
What is now the best and most performant way to read in this xml file?
I don't really know very much of xml yet, so if you can help me, thanks.if ur xml is big enough its good to go for sax parser or else use DOM..
regards
Shanu -
Method call in html anchor tag
I have read about how to place a hyperlink in JTable cell in other threads. i have a method called Details() which has a mouse pressed event which responds on left click on the first column cells of my JTable. then i get the column and row positions and open up a JDialog.
so Now i have to show the first column cells as hyperlinks(underlined and handcursor on visit).
i have done something like this,
setText( "<html><a href=\"\">" + (String)(value==null?"":value ) +"</a></html>"); this makes the cell values blue colored as well as underlined as soon as the table is loaded.
how can i make it behave like a hyperlink ? that is colored, underlined and handcursor only when mouse is placed on it.
Can i have the call to Details() method inside the anchor tag which i have shown above?
Thanks,Well what do you know, I was doing everything correctly.
Firefox does not allow local file links from a web page.
http://kb.mozillazine.org/Firefox_:_Issues_:_Links_to_Local_Pages_Don%27t_Work -
Hi Guys
I have the following xml file.
<scms:TokenDescription xmlns:scms="http://www./schema/2003/07/Passage/scms.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="SID33322800" ATR="asdfafasdfdafdasfsda" FormatVersion="1.0">
<Token SerialNumber="123456789" SmartChipSN="3232323232">
<KeySetVersion>99</KeySetVersion>
<SecurityDomainAID>fdfasfsadfsdaf</SecurityDomainAID>
<AuthenticationKey>fdasfdasfdsafsda</AuthenticationKey>
<MACKey>fdasfdsafdsaf</MACKey>
<KeyEncryptionKey>asdfasdfasdfsdafa</KeyEncryptionKey>
<DefaultPUK>fdsafsdafsdfdsafasd</DefaultPUK>
</Token>
</scms:TokenDescription>I have managed to read the xml fine and bind it manuall to an object as follows:
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse (new File("xml.xml"));
NodeList keySetVersion = firstPersonElement.getElementsByTagName("KeySetVersion");
Element firstNameElement = (Element)keySetVersion.item(0);
NodeList textFNList = firstNameElement.getChildNodes();
System.out.println("keySetVersion : " +
((Node)textFNList.item(0)).getNodeValue().trim());My Question is can anyone tell me how i can read this part of the xml from this document the serial number and smartChipSN
<Token SerialNumber="123456789" SmartChipSN="3232323232">Try this code,
Nodelist nList = doc.getElementByTagName("Token ") ;
Element node = (Element)nList.item(0);
To read the values of "SerialNumber" and "SmartChipSN", you can use getAttribute method.
String serailNo = node.getAttribute("SerialNumber");
String chipSN = node.getAttribute("SmartChipSN"); -
Parsing this XML file with namespace
I need to parse the following XML structure:
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfTitles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://example.com/">
<Titles>
<articleID>123</articleID>
<articleTitle>Title 1</articleTitle>
</Titles>
<Titles>
<articleID>456</articleID>
<articleTitle>Title 2</articleTitle>
</Titles>
<Titles>
<articleID>789</articleID>
<articleTitle>Title 3</articleTitle>
</Titles>
</ArrayOfTitles>
I am using this code:
var ns:Namespace = new Namespace("http://example.com/");
var strings:XMLList = xml.ns::Titles;
for each(var str:XML in strings)
trace(str);
But the output still has the namespace in each node.Well, I have to say openning a new file writer every time you write a block of characters is pretty horrible, why not just use one buffered writer for the whole operation. I can't see the memory leak, but I think this would run agonisingly slowly.
-
How to Parse this XML File and require below mentioned value as output using powershell script
Need values for below as an output for below xml file so help me with the script:
Under Criteria Tag-
TimeStamp Display Value
OID corresponding to display value for nodes "Criterion"
Under Report Body Tag--
name in Report Section and OID value
<?xml version="1.0" encoding="UTF-8"?>
<ReportOutput>
<ReportHead>
<Report name="Execution Action" type="detailedchanges_rpt">
<Description></Description>
</Report>
<Criteria>
<TimestampCriterion name="date" displayvalue="08/10/14 23:08">
<Timestamp displayvalue="08/10/14 23:08">1412780929000</Timestamp>
</TimestampCriterion>
<MatchCriterion name="approvalId" displayvalue="Not applied" operator="contains" />
<MatchCriterion name="promotionComment" displayvalue="Not applied" operator="contains" />
<SelectCriterion name="changeWindow" displayvalue="Not applied" />
<SelectCriterion name="auditEvents" displayvalue="(Any)">
<String>auditEventAny</String>
</SelectCriterion>
<SelectCriterion name="attributeDisplay" displayvalue="Changed attributes">
<String>changed</String>
</SelectCriterion>
<SelectCriterion name="versionCompare" displayvalue="Version with current baseline">
<String>disabled</String>
</SelectCriterion>
<BooleanCriterion name="showContentDiff" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayUsers" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayPackages" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayCustomProperties" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="strictPackageMatch" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayCriteriaAtEnd" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<SelectCriterion name="elementExists" displayvalue="Not applied" />
<IntegerCriterion name="maxLinesPerBlock" displayvalue="10">
<Integer>10</Integer>
</IntegerCriterion>
<NodesCriterion name="nodes" displayvalue="TripwireENT.demo.net">
<OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
</NodesCriterion>
<MatchCriterion name="nodeName" displayvalue="Not applied" operator="contains" />
<CustomPropertiesCriterion name="nodeProps" displayvalue="Not applied" />
<RulesCriterion name="rules" displayvalue="Critical System Files">
<OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
</RulesCriterion>
<MatchCriterion name="ruleName" displayvalue="Not applied" operator="contains" />
<MatchCriterion name="elementName" displayvalue="Not applied" operator="contains" />
<CustomPropertiesCriterion name="elementProps" displayvalue="Not applied" />
<CustomPropertiesCriterion name="versionProps" displayvalue="Not applied" />
<AttributesCriterion name="attributes" displayvalue="Not applied">
<Integer name=".missingImpliesFailure">1</Integer>
</AttributesCriterion>
<ContentCriterion name="content" displayvalue="Not applied" />
<MatchCriterion name="auditEventUserName" displayvalue="Not applied" operator="contains" />
<IntegerCriterion name="changeType" displayvalue="Added, Modified, Removed">
<Integer>7</Integer>
</IntegerCriterion>
<SeverityRangeCriterion name="severity" displayvalue="1 - 10000">
<Integer name="min">1</Integer>
<Integer name="max">10000</Integer>
</SeverityRangeCriterion>
<BooleanCriterion name="currentVersionsOnly" displayvalue="Yes">
<Boolean value="true" />
</BooleanCriterion>
<TimeRangeCriterion name="timeRange" displayvalue="All time" />
<PackagesCriterion name="packages" displayvalue="Not applied" />
<SortCriterion name="sortNodes" displayvalue="Name, ascending" isascending="true">
<String>name</String>
</SortCriterion>
<SortCriterion name="sortRules" displayvalue="Name, ascending" isascending="true">
<String>name</String>
</SortCriterion>
<SortCriterion name="sortElements" displayvalue="Name, ascending" isascending="true">
<String>name</String>
</SortCriterion>
<SortCriterion name="sortVersions" displayvalue="Date, descending" isascending="false">
<String>date</String>
</SortCriterion>
</Criteria>
</ReportHead>
<ReportBody>
<ReportSection name="TripwireENT.demo.net" category="node">
<OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
<String name="typeName">Windows Server</String>
<ReportSection name="Critical System Files" category="rule">
<OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
<String name="typeName">Windows File System Rule</String>
<ReportSection name="C:\Temp" category="element">
<OID>-1y2p0ij32e8dr:-1y2p0ij32e586</OID>
<ReportSection name="08/10/14 22:48" category="version">
<OID>-1y2p0ij32e8du:-1y2p0ij32e3ho</OID>
<Integer name="changeType">1</Integer>
<String name="changeTypeName">Added</String>
<Integer name="severity">10000</Integer>
<String name="severityName">High</String>
<Timestamp name="changeTime" displayvalue="08/10/14 22:48">1412779682000</Timestamp>
<String name="approvalId"></String>
<ReportSection name="attributes" category="attributes">
<ReportSection name="DACL" category="added">
<String name="observed">Inherits Entries: true
NT AUTHORITY\SYSTEM, Access Allowed:
Standard rights:
Full Control
Modify
Read & Execute
List Folder Contents
Read
Write
Delete
Read Control
Write DAC
Write Owner
Synchronize
Specific rights:
Full Control
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders / Append Data
Write Attributes
Write Extended Attributes
Directory Delete Child
Read Permissions
Change Permissions
Take Ownership
Header flags:
Object Inherit
Container Inherit
Inherited
BUILTIN\Administrators, Access Allowed:
Standard rights:
Full Control
Modify
Read & Execute
List Folder Contents
Read
Write
Delete
Read Control
Write DAC
Write Owner
Synchronize
Specific rights:
Full Control
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders / Append Data
Write Attributes
Write Extended Attributes
Directory Delete Child
Read Permissions
Change Permissions
Take Ownership
Header flags:
Object Inherit
Container Inherit
Inherited
BUILTIN\Users, Access Allowed:
Standard rights:
Read & Execute
List Folder Contents
Read
Read Control
Synchronize
Specific rights:
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Read Permissions
Header flags:
Object Inherit
Container Inherit
Inherited
BUILTIN\Users, Access Allowed:
Specific rights:
Create Folders / Append Data
Header flags:
Container Inherit
Inherited
BUILTIN\Users, Access Allowed:
Specific rights:
Create Files / Write Data
Header flags:
Container Inherit
Inherited
CREATOR OWNER, Access Allowed:
Generic rights:
Generic All
Specific rights:
Full Control
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders / Append Data
Write Attributes
Write Extended Attributes
Directory Delete Child
Read Permissions
Change Permissions
Take Ownership
Header flags:
Object Inherit
Container Inherit
Inherit Only
Inherited
</String>
</ReportSection>
<ReportSection name="Group" category="added">
<String name="observed">TRIPWIREENT\None</String>
</ReportSection>
<ReportSection name="Owner" category="added">
<String name="observed">BUILTIN\Administrators</String>
</ReportSection>
<ReportSection name="Read-Only" category="added">
<String name="observed">false</String>
</ReportSection>
<ReportSection name="SACL" category="added">
<String name="observed">(null)</String>
</ReportSection>
<ReportSection name="Type" category="added">
<String name="observed">Directory</String>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
<ReportSection name="C:\Windows\System32\drivers\etc\hosts" category="element">
<OID>-1y2p0ij32e8dr:-1y2p0ij32e4kp</OID>
<ReportSection name="08/10/14 23:08" category="version">
<OID>-1y2p0ij32e8du:-1y2p0ij32e3hk</OID>
<Integer name="changeType">2</Integer>
<String name="changeTypeName">Modified</String>
<Integer name="severity">10000</Integer>
<String name="severityName">High</String>
<Timestamp name="changeTime" displayvalue="08/10/14 23:08">1412780929000</Timestamp>
<String name="approvalId"></String>
<ReportSection name="attributes" category="attributes">
<ReportSection name="SHA-1" category="modified">
<String name="expected">de375d8a456a7345323babee88975ca567a2d5c4</String>
<String name="observed">3c5520382f91cb1cd898fee2da4eba3fa338d982</String>
</ReportSection>
<ReportSection name="Size" category="modified">
<String name="expected">829</String>
<String name="observed">854</String>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
<ReportSection name="reportTotals" category="reportTotals">
<Integer name="summary.nodeCount">1</Integer>
<Integer name="summary.ruleCount">1</Integer>
<Integer name="summary.elementCount">2</Integer>
</ReportSection>
</ReportBody>
</ReportOutput>Hi Ritehere,
I know this is simple but am beginner in Powershell Script so I was looking for logic to go through however the output you provided is not what i am looking for and your script is too complicated, as under timestamp i wanted display value and correspoding
to display value the OID name and then name value correspoding to that OID. May be u got it wrong.
Thanks anyways. -
Action bindings for html anchor tags
I've used this code to use a link in the same way you would use a button:
<a href="theAnswers.do?event=create&Arg0=<c:out value=${bindings.Create.enabledString" />">
<img height="26" width="34" src="insert.GIF"/>
It works for several operations except for Commit and Rollback.
This is what i tried for a commit:
<a href="theAnswers.do?event=commit&Arg0=<c:out value=${bindings.Commit.enabledString" />">
can anyone help?
thanxHi:
You can parse HTML tags inside the Database using JTidy library.
Load JTidy to the sys schema using loadjava with grant to public or into your own schema.
The you can parse HTML tags in a CDATA section creating a Tidy parser. Look at this code as example, its part of DBPrism CMS XForms actions and it process an HTMLArea HTTP Post action. See the method updateContent(CLOB post_xml):
http://cvs.sourceforge.net/viewcvs.py/dbprism/cms-2.1/src/com/prism/cms/frontend/PageActions.java?rev=1.5&view=auto
The CLOB arguments is an XML XForm instance document, the content node has the HTML tags to be parsed wrapped by CDATA tags:
So the String content are the HTML tags.
Once the document is parsed by JTidy it is converted to a valid XML and it will be accepted by the XMLType instance.
Best regards, Marcelo. -
How different Web Services can use a class which parses an XML file
I am using RAD6.1 for developing and deploying web services.As I am using 15 web Services which uses a common class which is used to parse an XML file.As this XML file should be parsed only once and should be used by all the web services.I have made this common class as Singleton but it works as singleton for only one webservice and for other web service again it is parsing the xml file.I want to parse this xml file only once and used by all the web services.In my case tis file is parsed 15 times for 15 web services, but it should be parse donly once and used by all 15 services.Please give me the solution.
Thanks and Regards
SayeeduzzamanHello,
the 15 Webservices should have a static attribute which contains the xml:
private static String xml;
then initialise the xml like this:
if (xml == null)
xml = parseIt();
else
//do nothing, XML already initialised!
} -
I need to parse large xml file which contains following tag. The size of the file is upto 10MB-50MB or more.
<departments>
<department>
<a_depart id="124">
<b_depart id="Bss_253">
<bss_depart id="253">
<attributes>
<name_one>abc</name_one>
</attributes>
</bss_depart id="253">
</b_depart id="Bss_253">
</a_depart id="124">
</department>
<department>
<a_depart id="124">
<b_depart id="Bss_254">
<mss_depart id="253">
<attributes>
<name_one>abc</name_one>
<name_two>xyz</name_one>
</attributes>
</mss_depart>
</b_depart>
</a_depart>
</department>
<department>
<a_depart id="124">
<b_depart id="Bss_254">
<mss_depart id="255">
<attributes>
<name_one>abc</name_one>
<name_two>xyz</name_one>
</attributes>
</mss_depart>
</b_depart>
</a_depart>
</department>
<department>
<a_depart id="125">
<b_depart id="Bss_254">
<mss_depart id="253">
<attributes>
<name_one>abc</name_one>
<name_two>xyz</name_one>
</attributes>
</mss_depart>
</b_depart>
</a_depart>
</department>
I want to get the infomation for that xml file. like mss_depart id=233, building xpath dyanmically for every id and loading
that using dom4j. which is very very slow.
Is there any other solution for that to read the data using sax parser only.
I want to execute the xpath or data for the following way.
//a_depart/@id ------> all the ids of a_depart tags if it returns 3 values say 123,124,125
after that i want to execute
//a_depart[@id='123']/b_depart/@id like this ...to retrive the values of all the levels ...
I am executing following xpath for every unique ids at all levels.
List l = doc.selectNodes(xPathForID);
List l1 = doc.selectNodes(xPathForAttributes+attributes.get(j)+"/text()");
But it is very slow and taking lot of time.
Is there any other way to solve this problem. If any please mail me it is urgent.
I am using jdk1.4 and jdk1.5
Is there any support for sax parser to execute xpath in jdk1.5 direclty, with out using dom4j
Thanks in advance....I doubt you will find a preexisting solution to your problem.
SAX is usually recommended for processing big files (where "big" is undefined"). It works on big files by avoiding the messy problem of storing the data -- that is left as an exercise to you.
DOM (and its variants) works by building a Document object as the head of the tree of objects for the entire contents. With DOM, you can then use XPath, because there is something to search that is already in memory. To use XPath, you seem to have two choices, build a DOM-ish tree, or if you can find an XPath processor (I'm not sure if one exists) that can process the XML file directly, but it will be slow, since you are looking for "all" occurences of an attribute, and this means you have to read the entire file each time.
It might be worth exploring a hybrid approach -- use SAX to get some information, and build your own objects to store the data. Maybe a HashMap as the main index. But, that will keep you from using XPath, since you do not have the data structures it expects.
A third alternative would be to look at JAXB. It builds Java code from a Schema of your data and then when you import the data, it creates the necessary objects and fills in values. But, I don't think XPath woll work there either.
Dave Patterson -
Liquid data--how to parse the xml which is generated on the fly
I am using liquid data for retreiving data from database which I am able to do
but the problem is that it generates the xml on the fly and prints the response
in xml format in html document .My need is that I want to parse this xml and use
the data on need basis in my jsp document.
I am usig following weblogic workshop 8.1 tags in my jsp :
<lds:query name="bdemo_cust_info" server="t3://localhost:7001">
<lds:param name="cust_name" value="<%=\"MCD\"%>"/>
</lds:query>;
Please help??
Thaks and Regards,
Ajay Jindalhi Ajay
You can create a Liquid Data Control and display it using NetUI - or see the QueryClient
example in weblogic\samples\liquiddata\ejbAPI and create an XML Bean from the
result.
- Mike
"ajayjidal" <[email protected]> wrote:
>
I am using liquid data for retreiving data from database which I am able
to do
but the problem is that it generates the xml on the fly and prints the
response
in xml format in html document .My need is that I want to parse this
xml and use
the data on need basis in my jsp document.
I am usig following weblogic workshop 8.1 tags in my jsp :
<lds:query name="bdemo_cust_info" server="t3://localhost:7001">
<lds:param name="cust_name" value="<%=\"MCD\"%>"/>
</lds:query>;
Please help??
Thaks and Regards,
Ajay Jindal -
Hi all,
I am new to java can anyone say me how should i parse this xml,
<employees>
<employee id="1" name="Alan" superiorid="007" username="Alanmarx" pwd="Alan123"/>
<employee id="2" name="Peter" superiorid="1" username="PeterD" pwd="Peter123"/>
</employees>
ThankxHere is a link to an example:
[XML Parsing|http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html]
Maybe you are looking for
-
Connecting mac book pro wirelessly with hp printer
I am unable to connect my new mac book pro with my hp G85xi wirelessly. I am able to connect utilizing my other pc computers (laptop and desktop; this is my first mac). Could anyone provide help with this?
-
Hello, What I want is for a new row to be inserted each time the last column has finished being edited. I add the data in each row to a Vector() after every row. I get an ArrayIndexOutOfBoundsException when I want to insert a new row. Do you know why
-
Netbean 5.5.1 + VWP is too slow when big project.
I have a project contains around 180(up) pages. This project is upgraded from Createor2 to Netbeans 5.5.1+VWP. In Creator2, It's very hard to maintain this project, waste much time in waiting. I heard many people say VWP is better then Creator2. In V
-
Can I buy an album except for one song?
Sometimes I buy songs from Amazon mp3 just because it's cheaper and then download them onto iTunes. I fell in love Imagine Dragons and bought their song Bleeding Out from Amazon and bought Radioactive from iTunes. The thing is, I want to buy the albu
-
How to scale an image displayed on JButton
Hi all, I has a panel contains 42 buttons of the same size arranged with GridLayout manager. I try to display some images on the buttons. But the problem is that the image bigger than buttons. Is it possible to scale the image to fit the size of butt