Flex - Convert html escapes to string
i want to convert this
Error #1083: The prefix "http " for element "//www.c.com::a " is not bound.
to this
Error #1083: The prefix "http" for element "//www.c.com::a" is not bound.
thanks
Regular expressions.
Similar Messages
-
Converting HTML Escaping to Unicode Escaping characters in Java
Hi,
I am getting some HTML escaping for special characters like pound, space, dollar etc. from database in HTML escaping format as ' £ ® etc.which I want to convert their Unicode equivalent escaping as U00A3,U0026. Java only convert & to & (U0026) but rest of the characters are not getting converted. If there is any API or way to do this please reply.
Note : I cant change Database as there are already thousands of records & My front end only needs Java to do all these conversions I cant change that also.I have posted a method that does what you want. It was a long time ago since I wrote it and you should probably use a StringBuilder instead of a StringBuffer if you are going to use it in Java 5 or later. You can find the method in this thread:
http://forum.java.sun.com/thread.jspa?threadID=652630 -
Convert HTML to "word string"`?
HI, I am using C#.I have a template word doc that contains key tags of the format [FIELD_0],
[FIELD_1], etc...
I load this document in memory, and then replace those tags with the correct string values.
When I am done, I return it to the user.
This is working fine.
However, now I have a case where one of my string is html format (bold, italic, bullets),
I am wondering how can I convert this "Hmtl string" into "word doc string" ???
Thanks.Then You can try this free DOC library(http://www.e-iceblue.com/Introduce/word-for-net-introduce.html),download and add reference to your project then add the following code
Document doc = new Document("sample.docx");
TextSelection selection = doc.FindString("[FILED_0]", true, true);
TextRange range = selection.GetAsOneRange();
int index = range.OwnerParagraph.ChildObjects.IndexOf(range);
Document htmldoc = new Document();
StringReader sr = new StringReader("<b>hello </b><i>world</i>");
htmldoc.LoadHTML(sr, XHTMLValidationType.None);
foreach (Section section in htmldoc.Sections)
foreach (Paragraph p in section.Paragraphs)
foreach (DocumentObject obj in p.ChildObjects)
range.OwnerParagraph.ChildObjects.Insert(index++, obj.Clone());
range.OwnerParagraph.ChildObjects.Remove(range);
doc.SaveToFile("replace1.docx", FileFormat.Docx); -
Displaying unicode or HTML escaped characters from HTTPService in Flex components.
Here is a solution on the Flex Cookbook I developed for
displaying data in Flex components when the data comes back from
HTTPService as unicode of HTML escaped data:
Displaying
unicode or HTML escaped characters from HTTPService in Flex
components.Hi again Greg,
I have just been adapting your idea for encountering
occasional escaped characters within a body of "normal" text, eg
something like
hellô sunšine
Now, the handy String.fromCharCode(charCode) call works a
dream if instead of the above I have
hellô sunšine
Do you know if there is an equivalent call that takes the
named entities rather than the numeric ones? Clearly I can just do
some text substitution to get the mapping, but this means rather
more by-hand work than I had hoped. However, this is definitely a
step in a useful direction for me.
Thanks,
Richard
PS hoping that the web page won't simply outguess me and
replace all the above! Basically, the first line uses named
entities and the second the equivalent numbers... -
Convert HTML special characters to String
Hi,
I'm looking for an easy way to convert HTML special characters (like "ö") to String.
Any Ideas how implement this? ThanksHi,
I'm looking for an easy way to convert HTML special
characters (like "�") to String.
Any Ideas how implement this? Thankswell im assuming that you mean that when you are working with java you will be getting a ? instead of the character you want. assuming that you are reading and writing to this html file. if not well maybe this can stil help : BufferedReader inFile = new BufferedReader(new InputStreamReader(new FileInputStream(fileName),"ISO8859-1"));
PrintWriter outFile = new PrintWriter(new OutputStreamWriter(new FileOutputStream(fileName2), "ISO8859-1")); basically you need to make sure that ou define ISO8859-1 as the encoding. -
Strip html tags from string & convert ampelsand charachters
hello, i'm converting html into xml, and i need to convert html code & content into xml content, withouth the html tags ...
so, for example, I strip this out of an html file:
<A NAME="b_betreft"></A>STUDIEOPDRACHT "UITBREIDING VIPA NAAR MEERDERE SUBSECTOREN" HERVERDELING VASTLEGGINGS- EN VEREFFENINGSKREDIETEN VAN HET VIPA VOOR HET JAAR 1999 ONTWERPBESLUIT VAN DE VLAAMSE REGERING TOT HERVERDELING VAN BASISALLOCATIES VAN DE BEGROTING VAN HET VLAAMS INFRASTRUCTUURFONDS VOOR PERSOONSGEBONDEN AANGELEGENHEDEN VOOR HET BEGROTINGSJAAR 1999<A NAME="e_betreft">
and i want to get rid of the "<A NAME="b_betreft"></A>" & "<A NAME="e_betreft">", are there classes that can do this ???
probably there are, i know in php there are ..., how about java ???
also i'll need to correct stuff like:
Financiële => Financi�le
Comité=>Comit�
you see, then, i'm done, cool ...
thanks dudesssssshello, i'm converting html into xml, and i need to
convert html code & content into xml content,
withouth the html tags ...Why didn't you continue to post in your other thread?
http://forum.java.sun.com/thread.jspa?threadID=777660
It's not nice to create multiple threads with the same question.
Kaj -
Convert a UTF-8 string to ISO-8859-1 string
Hello. As you can see from my other post, I am working on internationalization. I could not find an appropriate entry in the forum already.
I want to convert form data (submitted from an HTML UTF-8 charset page) from the UTF-8 format to ISO-8859-1 format. How do I do that?
I.e.
String utfFormat="視聴者";
String isoFormat="";
// Do magic here
System.out.println(isoFormat); // out: "しての" (or whatever it is)
Can you help?
Dailysun
nullAs I said in the other thread (did you read that, BTW?), you shouldn't have to bother with actual character-set conversions. You just tell the InputStream what the Charset is when you read it in, and the OutputStream what Charset to use when you write it out.
What you're doing is escaping characters by replacing them with numeric entity references--the opposite of what you asked in the other thread. The process is just as simple: cast the char to an int, convert that to a string with String.valueOf(int), and add the "&#" and ";". You can use a regex-based approach like I did over there, but going in this direction, it will be just as easy without them.
Hiwa, check out that other thread; I think you'll find it amusing (in light of that second link you posted). -
Avoid HTML Escapes in Java properties
In using Java properties, I have the following string in the Java property file:
prop1=Click the <a href=#>Help</a> link.
which unfortunately becomes:
Click the & lt ;a href=#>Help & lt ;/a> link.
when the property is printed out (sorry, I put in spaces to have & and ; render correctly).
How should I AVOID having HTML Escape chars put into the property listCome again? besides your question being hardly readable thanks to that formatting, I don't understand it. What do properties have to do with HTML? Properties aren't HTML and Java doesn't convert them.
I don't know what "printing them out" means either. How do you print them where? -
Problem with converting html to pdf using LiveCycle ES Java API
I am using this code to convert html to pdf.
* 1. adobe-generatepdf-client.jar
* 2. adobe-livecycle-client.jar
* 3. adobe-usermanager-client.jar
* 4. adobe-utilities.jar
* 5. wlclient.jar
import java.io.File;
import java.util.Properties;
import com.adobe.idp.Document;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
import com.adobe.livecycle.generatepdf.client.GeneratePdfServiceClient;
import com.adobe.livecycle.generatepdf.client.HtmlToPdfResult;
public class ConvertHTML {
public static void main(String[] args)
try{
//Set connection properties required to invoke LiveCycle ES
Properties connectionProps = new Properties();
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "t3://localhost:7001");
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,Service ClientFactoryProperties.DSC_EJB_PROTOCOL);
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "WebLogic");
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
//Create a ServiceClientFactory instance
ServiceClientFactory factory = ServiceClientFactory.createInstance(connectionProps);
//Create a GeneratePdfServiceClient object
GeneratePdfServiceClient pdfGenClient = new GeneratePdfServiceClient(factory);
//Get an HTML document to convert to a PDF document a
String inputFileName = "http://www.adobe.com";
//String inputFileName = "C:\\Documents and Settings\\venkat\\Desktop\\Adobe.htm";
String securitySettings = "No Security";
String fileTypeSettings = "Standard";
System.out.println("one");
//Convert HTML content to a PDF document
HtmlToPdfResult result = pdfGenClient.htmlToPDF2(inputFileName, fileTypeSettings, securitySettings, null, null);
System.out.println("two");
//Get the newly created document
Document createdDocument = result.getCreatedDocument();
//Save the PDF document as a PDF file
createdDocument.copyToFile(new File("C:\\test.pdf"));
catch (Exception e) {
System.out.println("Error OCCURRED: " + e.getMessage());
e.printStackTrace();
I can able to compile this class but while running i am getting error like below.
Error OCCURRED: Internal error.
ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.
at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.doSend(EjbMessageDispatcher.java
:160)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispat
cher.java:57)
at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
at com.adobe.livecycle.generatepdf.client.GeneratePdfServiceClient.htmlToPDF2(GeneratePdfSer
viceClient.java:666)
at ConvertHTML.main(ConvertHTML.java:84)
Caused by: java.rmi.RemoteException: Remote EJBObject lookup failed for 'ejb/Invocation'; nested exc
eption is:
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 203 completed: No
at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initialise(EjbMessageDispatcher.
java:101)
at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.doSend(EjbMessageDispatcher.java
:130)
... 4 more
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 203 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.writeErrorSend(Unknown Source)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.writeErrorSend(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.writeLock(Unknown Source)
at com.sun.corba.se.impl.encoding.BufferManagerWriteStream.sendFragment(Unknown Source)
at com.sun.corba.se.impl.encoding.BufferManagerWriteStream.sendMessage(Unknown Source)
at com.sun.corba.se.impl.encoding.CDROutputObject.finishSendingMessage(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.finishSendingRequest(Unknown Sour
ce)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete1(Unkno
wn Source)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(Unknow
n Source)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.is_a(Unknown Source)
at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source)
at weblogic.corba.j2ee.naming.Utils.narrowContext(Utils.java:126)
at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFact
oryImpl.java:94)
at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFact
oryImpl.java:31)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:41)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initJndiContext(EjbMessageDispat
cher.java:213)
at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.getJndiContext(EjbMessageDispatc
her.java:226)
at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initialise(EjbMessageDispatcher.
java:87)
... 5 more
can u plz give me some way to do the convertion.Yes Sir.....Thanks for ur suggestion.....
But i didn't find exact solution..well..yes i found some but not exactly there were not in the way i required...I jus need to convert HTML to PDF using iText API for java.....I already used some classes in that like HTMLParser.....etc..
So Any thing else...Any one...Sure can help me in this................ -
convert html to word document ,
I tried poi-3.0.2-FINAL,Apache POI - HWPF - Java API to Handle Microsoft Word Files
it is not working...My actual goal is convert html file into word document,
i posted into forum, some people are suggested HWPF just look,
I tried one by one program i not getting any answer for example one program,
HWPFDocument doc = new HWPFDocument (new FileInputStream ("c:\\temp.doc"));
Range r = doc.getRange();
System.out.println("Example you supplied:");
System.out.println("---------------------");
for (int x = 0; x < r.numSections(); x++)
Section s = r.getSection(x);
for (int y = 0; y < s.numParagraphs(); y++)
Paragraph p = s.getParagraph(y);
for (int z = 0; z < p.numCharacterRuns(); z++)
//character run
CharacterRun run = p.getCharacterRun(z);
//character run text
String text = run.text();
// show us the text
System.out.print(text);
// use a new line at the paragraph break
System.out.println();
}catch(NullPointerException exception){
exception.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
java.io.IOException: Invalid header signature; read 5789751444030890300, expected -2226271756974174256 -
Strange problem in converting between XML to string and vice versa
i have an application that needs to send an XML document
over the wire. For this reason, I need to convert the
doc into a String at the sending side and back to Doc
at the receiving side. This document is stored in a "CLOB"
column in a table in the database. I use XDK to retrieve
this entire row (including the CLOB - hence this is an XML
document which has a column that itself is an xml document in
string format - this is just the clob read in by XDK).
Thus the row looks like
<ROWSET>
<ROW>
<col1> A <col1>
<CLOB_COL> ..clob value of an xml doc..</CLOB_COL>
</ROW>
</ROWSET>
When I convert this document into String and back, one of the "<"
tags in the clob column document gets changed to "<" and hence
the parsing fails! I have used the latest label of the XDK build
to get the latest parser jar but still i have the same problem.
I am using the following routines for the conversion.
/* for converting document to string */
public static String convertToString(XMLDocument xml) throws
IOException
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
xml.print(pw);
String result = sw.toString();
return result;
/* for converting string to document */
public static XMLDocument convertToXml(String xmlStr)
throws
IOException,SAXException
ByteArrayInputStream inStream = new
ByteArrayInputStream(xmlStr.getBytes());
DOMParser parser = new DOMParser();
parser.setPreserveWhitespace(false);
parser.parse(inStream);
return parser.getDocument();How do you get the XML document? Do you use XSU? You can use:
String str = qry.getXMLString();
to get the result XML document in String.
XSU will escape all of the < and >. Or the the XML document in
one of the column will make the result XML doc not well-formed.
Not quite understand your problem. You can send me your test
case.
i have an application that needs to send an XML document
over the wire. For this reason, I need to convert the
doc into a String at the sending side and back to Doc
at the receiving side. This document is stored in a "CLOB"
column in a table in the database. I use XDK to retrieve
this entire row (including the CLOB - hence this is an XML
document which has a column that itself is an xml document in
string format - this is just the clob read in by XDK).
Thus the row looks like
<ROWSET>
<ROW>
<col1> A <col1>
<CLOB_COL> ..clob value of an xml doc..</CLOB_COL>
</ROW>
</ROWSET>
When I convert this document into String and back, one of the "<"
tags in the clob column document gets changed to "<" and hence
the parsing fails! I have used the latest label of the XDK build
to get the latest parser jar but still i have the same problem.
I am using the following routines for the conversion.
/* for converting document to string */
public static String convertToString(XMLDocument xml) throws
IOException
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
xml.print(pw);
String result = sw.toString();
return result;
/* for converting string to document */
public static XMLDocument convertToXml(String xmlStr)
throws
IOException,SAXException
ByteArrayInputStream inStream = new
ByteArrayInputStream(xmlStr.getBytes());
DOMParser parser = new DOMParser();
parser.setPreserveWhitespace(false);
parser.parse(inStream);
return parser.getDocument(); -
Converting html file into zip file and send email attaching zip file
Hi Experts,
I am trying to send email with attachment(html). Which contains more than 7MB. So, It is throwing an error like Size exceeded.
So, Now i need to compress the data for less than 7MB.
I decided to convert HTML File into ZIP File.
Kindly suggest me to convert the HTML file into ZIP file and sending email with attached ZIP file.
Correct answer rewarded,
Thanks & Regards,
N. HARISH KUMARHi Experts,
*// HTML_TAB converting into ZIP File
DATA : zip_tool TYPE REF TO cl_abap_zip,
filename TYPE string ,
filename_zip TYPE string .
DATA : t_data_tab TYPE TABLE OF x255,
bin_size TYPE i,
buffer_x TYPE xstring,
buffer_zip TYPE xstring.
filename = text-007. "'HTML_TAB
*describe the attachment
DESCRIBE TABLE html_tab LINES tab_lines.
bin_size = tab_lines * 255.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = bin_size
IMPORTING
buffer = buffer_x
TABLES
binary_tab = html_tab.
IF sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*create zip tool
CREATE OBJECT zip_tool.
*add binary file
CALL METHOD zip_tool->add
EXPORTING
name = 'FSSAI_MAIL.HTML'
content = buffer_x.
*get binary ZIP file
CALL METHOD zip_tool->save
RECEIVING
zip = buffer_zip.
CLEAR: t_data_tab[],bin_size.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = buffer_zip
IMPORTING
output_length = bin_size
TABLES
binary_tab = html_tab.
Thanks & Regards,
N. HARISH KUMAR -
how to escape <,> in xml string to < ,
>.is it possible to convert the entire xml string into this
format
ex:
<root> <sample><id> 89
</id></sample></root>
this has to be converted into
< root>. < sample>. <
id>. 89 < /id>. < /sample>.
< /root>.myString="<root> <sample><id> 89
</id></sample></root>";
myString.split("<").join("<"); -
Hi,
As the subject stats i am trying to convert HTML tables to an array. It is a desktop application basically to performs a http request and is returned with a HTML table. I cant change the way the data is returned. (The data is from FDM remote server and is hard coded).
here is a sample of the table. The table layout will remain the same, only the contents (files) will change.
<table width="100%" border="1">
<tr>
<td>File name<br> </td>
<td>Size<br> </td>
<td>URL<br> </td>
</tr>
<tr>
<td>notepad2.zip</td>
<td>258 KB</td>
<td><a href="http://www.flos-freeware.ch/zip/notepad2.zip">http://www.flos-freeware.ch/zip/notepad2.zip</a></td>
</tr>
<tr>
<td>TeddyGuess.zip</td>
<td>308 KB</td>
<td><a href="http://myhost.com/Guess.zip">http://myhost.com/Guess.zip</a></td>
</tr>
</table>So ive started and looking at my code i cant help but think there has to be a smarter way!!
public String getCompletedDownloads() {
String tableString = makeRequest("compdlds.req");
tableString = tableString.replaceAll(
"</td><td>Size<br> </td><td>URL<br> </td></tr>", "");
tableString = tableString
.replaceAll(
"<table width=\"100%\" border=\"1\"><tr><td>File name<br> ",
tableString = tableString.replaceAll("</table>", "");
tableString = tableString.replaceAll("<a href=\"", "");
tableString = tableString.replaceAll("\"", "");
return tableString;
}Please any help would be great.camickr wrote:
You could use a ParserCallback. It notifies you every time it finds a new HTML tag. Simple example:
[http://forums.sun.com/thread.jspa?forumID=57&threadID=696560]
Rob, you rock. I was thinking about how to parse some table data from a HTML page for a pet project just yesterday. Didn't know about the ParserCallback, but it seems to be a perfect fit for what I want to do. :-D -
Disable html escaping mode - Basic
4.2.1
Hi,
Our application runs within our network and hence no security worries as such. It's also not a critical application.
In 4.2.1, there is the html escaping mode with only two options basic and extended. Even with Basic it escapes & < and >. IS there a way to disable that? We have parameter passing where some items have & in their names. and they seem to be getting skipped.
I pass parameters when user clicks on a link in a report(using standard link features) which creates the URL. But looks like the names which have & have those removed.
Thanks,
Ryanryansun wrote:
4.2.1
Our application runs within our network and hence no security worries as such. It's also not a critical application.
In 4.2.1, there is the html escaping mode with only two options basic and extended. Even with Basic it escapes & < and >. IS there a way to disable that?No. It's required by the HTML specification.
We have parameter passing where some items have & in their names. and they seem to be getting skipped.
I pass parameters when user clicks on a link in a report(using standard link features) which creates the URL. But looks like the names which have & have those removed.As '&' is a URL-reserved character it must be encoded in order to be passed in a URL parameter, for example using the <tt>apex_util.url_encode</tt> API.
As has been recommended before, the simple way to avoid problems in this area is not to pass string data values as URL parameters. Pass simple numeric or alphanumeric key values, and use these to retrieve additional information using computations and processes on the target page.
Maybe you are looking for
-
HT201322 swipe and hide app options doesn't work on my ipad2, how can I get it to work?
I have followed the directions to swipe and hide apps from the purchased apps history on my ipad2 but when I swipe the app in the list nothing happens, any help please? I have managed to hide purchased app in itunes on my PC but that hasn't synced wi
-
I'm having some troubles, i've finally installed the oracle forms and reports 11G on my machine and have no problem with oracle forms 11g but when i try to open the report builder i get and error. the error i get is : REP 50125: rwbuilder.conf:java.l
-
Can we delete some files (movies or video) to make some new space
So if we can could you explain me how cause if i sync a movie and 1 month later i want to take it of for more space for another movie, would that be possible??? Thx in advanced Darck
-
I know its not the proper place to ask servlet questions, but I am really left thinking. I am developing a login application and I wanto to display the error messages in the login.jsp, which are thrown by the LoginServlet. I justw ant to display my c
-
Unable to Set Custom Paper size setting of 15 (width) x 12 (Height) using J
Hi, I am unable to print the report using the custom paper size setting of 15 (width) x 12 (Height) with printer friendly fonts so that we can print on Line or dot matrix printer. This problem is not solved from last 3 months and we dont