VBScript : the Document object help
Hello everybody
I am unable run following script using the current browsers.
please help
<script language="vbscript" type="text/vbscript">
var1 = 10
var2 = 20
Sum = var1 + var2
document.write("The Sum of two numbers"&_
"var1 and var2 is " & Sum)
</script>
the document object is giving no results.
Not a good script. You need to learn how to use HTML. Running a script like that wil lusually not work.
Start here: http://www.w3schools.com/
<script language="vbscript" type="text/vbscript">
Sub window_onload()
var1 = 10
var2 = 20
Sum = var1 + var2
document.write "The Sum of two numbers var1 and var2 is " & Sum
End Sub
</script>
¯\_(ツ)_/¯
Similar Messages
-
IF_IXML : How can i add encoding with value UTF-8 to the document object??
Hi
i want to create a xml file with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://....">
</OpenSearchDescription>
i did this with the if_ixml interface and rendered the content in a file 'D:\usr\sap\IFD\DVEBMGS01\log\TEST_out.xml
<?xml version="1.0"?>
<OpenSearchDescription xmlns="http://....">
</OpenSearchDescription>
BUT the document attribut(?) encoding="UTF-8"?> is missing!
How can i add encoding with value UTF-8 to the document object?? it should look like:
<?xml version="1.0" encoding="UTF-8"?>
*here is my coding.
TYPE-POOLS: ixml.
CLASS cl_ixml DEFINITION LOAD.
DATA: lo_ixml TYPE REF TO if_ixml,
lo_streamfactory TYPE REF TO if_ixml_stream_factory,
lo_document TYPE REF TO if_ixml_document,
lo_parent TYPE REF TO if_ixml_element,
lo_ostream TYPE REF TO if_ixml_ostream,
lo_renderer TYPE REF TO if_ixml_renderer,
lv_rc TYPE i.
lo_ixml = cl_ixml=>create( ).
lo_streamfactory = lo_ixml->create_stream_factory( ).
lo_document = lo_ixml->create_document( ).
lo_parent = lo_document->create_simple_element( name = 'OpenSearchDescription' "root node
parent = lo_document ).
lo_parent->set_attribute_ns( name = 'xmlns'
value = 'http://....' ).
*rausrendern in file
lo_ostream = lo_streamfactory->create_ostream_uri( system_id = 'D:\usr\sap\IFD\DVEBMGS01\log\TEST_out.xml' ).
lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream
document = lo_document ).
lv_rc = lo_renderer->render( ).
Thanks for help
BrittaUse the following code:
set an document encoding
l_encoding = l_ixml->create_encoding( character_set = 'UTF-8'
byte_order = if_ixml_encoding=>co_none ).
l_success = l_ostream->set_encoding( encoding = l_encoding ).
create a xml renderer
l_renderer = l_ixml->create_renderer( document = l_doc ostream = l_ostream ). -
I am trying to fill out a PDF form from an internet site, but when I go to print it, none of the content prints, only the header of the document. Help!
Instead of printing it, try saving it as a pdf from the print menu, and then printing the pdf out.
-
[CS3] Extending the Document Object Results an Error
I'm trying to extend the Document object:
Document.prototype.myOwnMethod = function() {
/* some code here */
but I'm getting a Document is undefined error in Illustrator CS3
I tried extending the Application object:
Application.prototype.myOwnMethod = function() {
but I don't get any error.
How can I resolve this?
Thanks in advance....
-- Jeffvery old post, but not answered.
PathItem.prototype.nick ="pfad"
will work if a single Path is initialized before:
var p =activeDoc.selection.. or something
,otherwise not
to solve this i create my own obj.:
function Pfad(obj){
this.nick = "bla";
this.ai = obj; // to store the original Obj
var p = new Pfad(pathItem);
//then :
p.nick;
p.ai.fillColor;
my question is: is this the best solution or could it be done better?
thank you
Chris -
Getting the document object cross-window
Hello,
I've been working on this application in which I have 2 windows.
Now the main window needs to make a call to the sub window sending a single function.
I have the following code to create the window:
var options = new air.NativeWindowInitOptions();
options.systemChrome = "none";
options.type = "lightweight";
options.resizable = true;
options.maximizable = true;
var winwid = 600;
var winhei = 500;
var mainWidowPos = new Array();
var mainWindowPos = getTopLeft(winwid,winhei); //This function is to calculate the center of the screen
var windowBounds = new air.Rectangle(mainWindowPos[0],mainWindowPos[1],winwid,winhei);
newHTMLLoader = air.HTMLLoader.createRootWindow(true, options, true, windowBounds);
newHTMLLoader.load(new air.URLRequest(url));
Now that that window is created I need to make a call from window 1 to window 2 (the newly created one, the title of the window is SCR2_BILL).
Maybe this table can clear it up:
Window 1 (main)
Window 2 (created by code)
This code is in window 1 and is being called:
for (var i = 0; i < air.NativeApplication.nativeApplication.openedWindows.length; i++) {
if(air.NativeApplication.nativeApplication.openedWindows[i].title == "SCR2_BILL") {
air.NativeApplication.nativeApplication.openedWindows[i].window.htmlLoader.stage.nativeWindow.hideBill();
function hideBill() {
document.getElementById('bill').style.display = 'none';
The link does not exist because air.NativeApplication.nativeApplication.openedWindows[i].window.htmlLoader.stage.nativeWin dow is not an object. Does anyone know what the object is after openedWindows[i] which I can use to call functions from the document?
Thanks in advance,
Roelof
PS: the code window 2 is executing is working, it has been tested.Hi Scott,
Use ProcessMonitor from Microsoft and look in the logs to see if there are any Access Denied errors. Also look in the IIS logs and Event viewer to see if anything there is being logged.
Anti-virus software logs is another place to look....
Pop up blocker in the Browser maybe or possibly adding the new server name to the trusted list.... Domain permissions possibly...
If you browse the App from the Server does that work?
Don -
Getting null in document object Help me
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource inputSource = new InputSource();
inputSource.setCharacterStream(new StringReader("<?xml version=\"1.0\"?><address></address>"));
System.out.println(inputSource);
Document doc = builder.parse(inputSource);
Getting doc object as null. CAn anyone please find out what could be the error in my code?This works:
* Get DOM document from a string containing XML.
* @param inputStream InputStream to read XML content from.
* @return DOM document or null if failed.
* @throws Exception if failed.
static public Document toDocument(InputStream inputStream) throws Exception {
Document result = null;
if (inputStream != null) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// factory.setValidating(true); //needs error handler
factory.setNamespaceAware(true);
DocumentBuilder db = factory.newDocumentBuilder();
result = db.parse(new InputSource(inputStream));
}//else: input unavailable
return result;
}//toDocument() -
Please assist InDesign CS4 on Windows won`t let me paste anything a copy in the same document
Windows 7 or Vista? See InDesign tools and panels don't respond to mouse clicks (Windows 7/Vista)
-
Re: need help to create document object
Hi there,
I am new to C3PO stuff and would anyone kindly give me a hand? I am trying
to create a Document object out of the Message object, but it always give
me error:
err.description= object required
err.number=438
err.helpcontext= 1000424
here is the actual code using VB
==========================================
Dim objSelectedMessages As Object
Dim objMessage as Object
Set objSelectedMessages = g_C3POManager.ClientState.SelectedMessages
Set objSelectedMessages = objSelectedMessages.Find("(DOCREFERENCE) AND
(<Document Status, STRING> CONTAINS NOT ""Final"")")
For Each objMessage In objSelectedMessages
DoSomething objMessage.Document
Next
==========================================
Everything works great before we upgrade to GroupWise 7(from ver. 6)...
Thanks for reading this post.
Sincerely,
PhilipThanks Michael and Glade, I really appreciate the input.
I am sorry that I should have include the doSomthing method code, here it
is:
here is the actual code using VB
==========================================
private sub CheckDocFinalStatus()
Dim objSelectedMessages As Object
Dim objMessage as Object
Set objSelectedMessages =
g_C3POManager.ClientState.SelectedMessages Set objSelectedMessages
= objSelectedMessages.Find("(DOCREFERENCE) AND
(<Document Status, STRING> CONTAINS NOT ""Final"")")
For Each objMessage In objSelectedMessages
DoSomething objMessage.Document
Next
end sub
private sub doSomething(byval ADocument as object) <-- error occurs here
If ADocument is nothing then
else
end if
end sub
==========================================
The error occurs as soon as I called doSomething Method, it won't allow me
to create the document object at all. Seems to be missing a reference in
my development environment because when I looked at the vb6 intellisense,
there is no child object for the message.document.
I know this is silly but is message.document object part of the GW Object
API, right? I think I am missing something...
And I will definitely install the GW7 SP1 as soon as possible and keep you
guys update how it goes.
Really appreciated.
Thanks,
Philip
PCode2006 wrote:
> Hi there,
> I am new to C3PO stuff and would anyone kindly give me a hand? I am trying
> to create a Document object out of the Message object, but it always give
> me error:
> err.description= object required
> err.number=438
> err.helpcontext= 1000424
> here is the actual code using VB
> ==========================================
> Dim objSelectedMessages As Object
> Dim objMessage as Object
> Set objSelectedMessages = g_C3POManager.ClientState.SelectedMessages
> Set objSelectedMessages = objSelectedMessages.Find("(DOCREFERENCE) AND
> (<Document Status, STRING> CONTAINS NOT ""Final"")")
> For Each objMessage In objSelectedMessages
> DoSomething objMessage.Document
> Next
> ==========================================
> Everything works great before we upgrade to GroupWise 7(from ver. 6)...
> Thanks for reading this post.
> Sincerely,
> Philip -
Getting the document content in a variable??
Hi,
How can I get the entire contents of a document into a string variable? I donot
want to print the contents inline but rather have to get them in a variable. Using
printDoc or printProperty tag?? I guess I will have to use printDoc but then how
can I stop the contents from being displayed in the jsp and how can I put them
in a variable??
Please help me...
Thanx.
PriruaYou should always double-check code put on the newsgroups, even if it's
put there by me :)
It probably should be at the beginning:
<es:forEachInArray array="<%=docs%>" id="adoc"
type="com.bea.p13n.content.document.Document">
<%
byte[] bytes = adoc.getContentBlock(0L, -1L);
Notice 'byte[]' instead of 'bytes[]', the type specified as Document
(Content doesn't have the getContentBlock() method, the sub-interface
Document does), and the 'L's on the numbers to specify that they are
longs to help the compiler find the correct method.
Greg
Prirua wrote:
Hi,
Thanx for your propmt reply. My code looks somethinglike this
<es:forEachInArray array="<%=docs%>" id="adoc" type="com.bea.p13n.content.Content"
<%
bytes[] bytes = adoc.getContentBlock(0, -1); // retrieve all the content
String enc = adoc.getPropertyAsString(null, "encoding");
String str = null;
if (enc != null)
str = new String(bytes, 0, bytes.length, enc);
else // use VM default encoding
str = new String(bytes);
%>
<li>The document title is: <cm:printProperty id="adoc" name="Title" encode="html"
/>
</es:forEachInArray>
But it is giving me these two errors...
C:\bea\wlportal4.0\applications\portal\MyPortal\WEB-INF\_tmp_war_portalDomain_po
rtalServer_MyPortal\jsp_servlet\_portlets\__contentq.java:152: cannot resolve
sy
mbol
symbol : class bytes
location: class jsp_servlet._portlets.__contentq
bytes[] bytes = adoc.getContentBlock(0, -1); // retrieve
all the content //[ /portlets/contentQ.jsp; Line: 19]
^
C:\bea\wlportal4.0\applications\portal\MyPortal\WEB-INF\_tmp_war_portalDomain_po
rtalServer_MyPortal\jsp_servlet\_portlets\__contentq.java:152: cannot resolve
sy
mbol
symbol : method getContentBlock (int,int)
location: interface com.bea.p13n.content.Content
bytes[] bytes = adoc.getContentBlock(0, -1); // retrieve
all the content //[ /portlets/contentQ.jsp; Line: 19]
^
2 errors
Could you plz specify if I have to include some file or something ?
Thanx.
Gregory Smith <[email protected]> wrote:
You will need to call the getContentBlock() method on the Document
object to retrieve the bytes of the document's content. Then, you do
whatever you need to with the bytes. When converting it to a String,
you
should be aware of double-byte-character encodings, and should check
the
Document's encoding metadata attribute, e.g.:
<%
bytes[] bytes = doc.getContentBlock(0, -1); // retrieve all the content
String enc = doc.getPropertyAsString(null, "encoding");
String str = null;
if (enc != null)
str = new String(bytes, 0, bytes.length, enc);
else // use VM default encoding
str = new String(bytes);
%>
In 8.1, the new <cm:getProperty> is able to retrieve the BinaryValue
of
a binary property of a Node.
Greg
Prirua wrote:
Hi,
How can I get the entire contents of a document into a string variable?I donot
want to print the contents inline but rather have to get them in a variable.Using
printDoc or printProperty tag?? I guess I will have to use printDocbut then how
can I stop the contents from being displayed in the jsp and how canI put them
in a variable??
Please help me...
Thanx.
Prirua -
Modify HTML of the document of the rendered page and reload
Currently i am loading a url in javafx through webengine.load(url). My requirement is to keep the styling in tact with the original page. However, once the page is rendered, the fonts are not loaded and i am unable to increase the font sizes. I worked through the following steps to achieve this.
1. Add a listener through getLoadWorker method for web engine and get the document object when the state is SUCCEEDED.
2. Transform the document to a html string which gives me the whole HTML of the page in a string including the css.
3. Then i do a replace on the css part with the actual location of the font files (absolute path url) and reload the html through loadContent method.
With this, i am able to get the fonts loaded properly.
Problem:
1. I end up with a infinite loop when i use the "webEngine.loadContent(string, "text/html")" inside the getLoadWorker method.
2. I tried to do that outside the getLoadWorker method before the webEngine.load(url) but in this case the replace html body string is coming as null.
Any help on how to achieve this?? Below is my code:
webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() {
String htmlBody = null;
@Override
public void changed(ObservableValue<? extends Worker.State> observableValue, Worker.State prevState, Worker.State newState) {
//To change body of implemented methods use File | Settings | File Templates.
//String htmlBody = null;
int count = 0;
if (newState == Worker.State.SUCCEEDED) {
browser.requestFocus();
// Get the document object from Engine.
Document doc = webEngine.getDocument();
try {
// Use Transformer to convert the HTML Object from the document top String format.
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
transformer.setOutputProperty(OutputKeys.METHOD, "html");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
StringWriter outWriter = new StringWriter();
transformer.transform(new DOMSource(doc),new StreamResult(outWriter));
StringBuffer sb = outWriter.getBuffer();
htmlBody = sb.toString();
// Replace the font-family attribute in the style section to the actual URL of the font being used.
htmlBody = htmlBody.replace("font-family: medium", "font-family: url(http://1.10.30.45:8080/fonts/Md.ttf)");
// Load the new HTML string to the Engine.
//webEngine.loadContent(htmlBody, "text/html");
} catch (Exception ex) {
ex.printStackTrace();
webEngine.load(url);
//add the web view to the scene
getChildren().add(browser);James,
I tried the document manipulation but was unable to override the css that was already applied. I downloaded and used jdk 8 which has the latest version of javaFX which fixed the font loading issue. Now i can see all the custom fonts and everything getting loaded as part of css.
However, when i try to capture the state of the worker, it stays in the running and not changing to success. First few instances, the page was loaded successfully but then it stopped. Any idea if this is due to the new javaFX version of jdk8? Below is the code snippet:
webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() {
@Override
public void changed(ObservableValue<? extends Worker.State> observableValue, Worker.State prevState, Worker.State newState) {
//To change body of implemented methods use File | Settings | File Templates.
System.out.println(newState);
if (newState == Worker.State.SUCCEEDED) {
browser.requestFocus();
// Get the document object from Engine.
Document doc = webEngine.getDocument();
System.out.println(doc.getDocumentURI());
webEngine.load(url);
//add the web view to the scene
getChildren().add(browser);
The output is
SCHEDULED
RUNNING
and nothing after that... -
How To Store dom4j.Document Object in MySQL Database?
Hi Everyone, i am currently using dom4j to create an xml document object i wish to hold the object in a mysql database using jdbc, however the document object does not implement serializable, i am having difficulty in storing the document object as a BLOB object within the database, any suggestions?
any help or advice would be greatly appreciated
ThanksConvert the Document object to String and store the XML string in MySQL database.
-
How can I get the Doc object from any other object?
Dear colleagues,
in FrameScript it is dead-simple to get to the document part of any object, just add .Doc to the variable.
How can I achieve the same with ExtendScript? I amtired of passing the document object next to AFrames or Pgfs along into subroutines, because those objects already contain the information about their document. But how do I access this?
Thanks for pointers,
- Michael
PS: Almost the same is true for the page an object lives on. With FrameScript we use .Page, with ExtendScript you have to move up the object tree until you reach the UnanchoredFrame.PageFramePage…
PPS: It would be great to see some convenience properties like .Doc and .Page implemented natively.I'll preface this response by admitting this far from an elegant solution, but I did write a function addressing this question, mostly as an exercise.
If passed an object with an InTextFrame property (Pgf, AFrame, Cell, Fn) that resides in an open document, the function will return the Doc object. Otherwise, it returns undefined.
function getParentDoc(testObj) {
//Get object for current page
try { var curPage = testObj.InTextFrame.FrameParent.PageFramePage; }
catch(er) {return;}
//Step backwards to first page in document
var prevPage = curPage.PagePrev;
while (prevPage.ObjectValid())
curPage = prevPage;
prevPage = prevPage.PagePrev;
//Compare with first pages of open documents
var testDoc = app.FirstOpenDoc;
while (testDoc.ObjectValid())
if (curPage.id==testDoc.FirstBodyPageInDoc.id) return testDoc;
testDoc = testDoc.NextOpenDocInSession;
return;
To your PPS: Rather than seeing the native framework grow bloated to address additional features, I would love to see Adobe and other developers publish libraries of useful functions and class extensions. -
Error saving: The location of the document " DOC NAME " cannot be determined.
I am having issues saving .pages files on to our network drive after upgrading to Mavericks and Pages 5.0.
A bunch of errors and issues occur when editing old or saving new pages files on our local SMB server. Saving files on to my local machine is fine.
I cannot save to the original network location at all. It errors: The location of the document "<DOC NAME>" cannot be determined. The folder in question has permissions that have always worked before the upgrade of mavericks/pages. I can rename the files in question, and save other types of files in to that folder without issue.
When it errors, it provides the option to Save as... this also fails, no matter where I try to save it to - local or network.
The auto-save feature fails for the same reason. This creates several temp folders with blank pages documents in it.
Most disturbingly, it appears to be destroying the original file by renaming it to a temp file, that is henceforth un-usable. Luckily Ive got backups of the documents.
Help!Update:
The new version of Numbers also comes up with the same errors.
The previous version of both Pages and Numbers work absolutely fine still - have had to revert to using these for now. -
XML Document object access problem?
Hi,
I have created a servlet,which will call .sh file, which will call java application.........
this java application is working as a search engine,which will do search in the XML document object...........This is working fine when only one user run this servlet...........But when more than servlet do the same it is not working......... But once first servlet create the Document object,which is main source for serching..........then second servlet will work fine.......same thing with third servlet and so on...... I used the thread.sleep()/synchronize but it is not working...bcoz i am accessing the same application.....Then instead of servlet i tried to run the java application from the Dos prompt..........But i am facing the same problem......So pl guide me bcoz everything is working excluding this..........Becoz this document object creation is taking some time........ i am creating the object shown below
Document doc =parseXmlFile("Article.xml", false);
Element docElem = doc.getDocumentElement();
public static org.w3c.dom.Document parseXmlFile(String filename, boolean validating)
try {
// Create a builder factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(validating);
// Create the builder and parse the file
// org.w3c.dom.Document doc = factory.newDocumentBuilder().parse(filename);
org.w3c.dom.Document doc = factory.newDocumentBuilder().parse(new File(filename));
return doc;
} catch (SAXException e) {
// A parsing error occurred; the xml input is not valid
} catch (ParserConfigurationException e) {
} catch (IOException e) {
return null;
}Hi,
This is my Servlet code..............
package PW.Feed;
import java.io.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.StreamResult;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class PrintDom extends HttpServlet
Document doc;
Element docElem;
Connection Conn=null;
Statement stmt=null,stmt1=null;
ResultSet rs1=null,rs=null;
PrintWriter out;
Vector myVector1=new Vector();
Vector myVector2=new Vector();
String strSql="";
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
res.setContentType("text/html");
out=res.getWriter();
try
String pubtype=req.getParameter("PubType");
String pubDate=req.getParameter("PubDate");
String toDate=req.getParameter("ToDate");
String fromDate=req.getParameter("FromDate");
if(pubDate==null)pubDate="2";
if(toDate==null)toDate="02/09/2005";
if(fromDate==null)fromDate="02/08/2005";
Class.forName("org.firebirdsql.jdbc.FBDriver");
Conn = DriverManager.getConnection("jdbc:firebirdsql:192.168.0.15/3050:D:/FBDatabases/PW1.GDB","SYSDBA","cohezia");
//Conn = DriverManager.getConnection("jdbc:firebirdsql:192.168.0.99/3050:/share/pw1.gdb","SYSDBA","cohezia");
stmt = Conn.createStatement( );
if(pubDate.equals("2"))
strSql="Select sh.ARTICLEID,sh.cuttingsdate,sh.READDATE,sh.headline,sh.SUMMARY,sh.AUTHOR,sh.PAGEFROM,sh.PUB_NAME,sh.READER_NAME,sh.PARENTTITLE,sh.CANMAIL,sh.PUBLICATION_ID,sh.JOURNALIST_ID,sh.ISPDF FROM SCANSHEADER sh,PUBLICATIONS p where sh.publication_id=p.publication_id and sh.readdate>'"+fromDate+"' and sh.readdate<'"+toDate+"' and p.pubtype='"+ pubtype +"' order by sh.ARTICLEID";
else
strSql="Select sh.ARTICLEID,sh.cuttingsdate,sh.READDATE,sh.headline,sh.SUMMARY,sh.AUTHOR,sh.PAGEFROM,sh.PUB_NAME,sh.READER_NAME,sh.PARENTTITLE,sh.CANMAIL,sh.PUBLICATION_ID,sh.JOURNALIST_ID,sh.ISPDF FROM SCANSHEADER sh,PUBLICATIONS p where sh.publication_id=p.publication_id and sh.cuttingsdate>'"+fromDate+"' and sh.cuttingsdate<'"+toDate+"' and p.pubtype='"+ pubtype +"' order by sh.ARTICLEID";
rs=stmt.executeQuery(strSql);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
doc = builder.newDocument();
docElem = doc.createElement("RECORDLIST");
doc.appendChild(docElem);
Element rootElem = doc.createElement("RECORDS");
docElem.appendChild(rootElem);
String artid="";
while(rs.next())
Element artElem = doc.createElement("RECORD");
if((rs.getString("ARTICLEID")).length()>0)artElem.setAttribute("id",rs.getString("ARTICLEID"));
rootElem.appendChild(artElem);
Element rootFieldElem = doc.createElement("FIELDS");
artElem.appendChild(rootFieldElem);
Element eleCuttingDate = doc.createElement("FIELD");
rootFieldElem.appendChild(eleCuttingDate);
eleCuttingDate.setAttribute("fieldName","CUTTINGSDATE");
if((rs.getString("CUTTINGSDATE")).length()>0) eleCuttingDate.appendChild(doc.createTextNode(rs.getString("CUTTINGSDATE")));
Element eleReadDate = doc.createElement("FIELD");
rootFieldElem.appendChild(eleReadDate);
eleReadDate.setAttribute("fieldName","READDATE");
if((rs.getString("READDATE")).length()>0) eleReadDate.appendChild(doc.createTextNode(rs.getString("READDATE")));
Element eleHeadLine = doc.createElement("FIELD");
rootFieldElem.appendChild(eleHeadLine);
eleHeadLine.setAttribute("fieldName","HEADLINE");
if((rs.getString("HEADLINE")).length()>0) eleHeadLine.appendChild(doc.createTextNode(rs.getString("HEADLINE")));
Element eleSummary = doc.createElement("FIELD");
rootFieldElem.appendChild(eleSummary);
eleSummary.setAttribute("fieldName","SUMMARY");
if(rs.getString("SUMMARY")==null){
//out.println("String is null");
else
{eleSummary.appendChild(doc.createTextNode(rs.getString("SUMMARY")));}
Element eleAuthor = doc.createElement("FIELD");
rootFieldElem.appendChild(eleAuthor);
eleAuthor.setAttribute("fieldName","AUTHOR");
if((rs.getString("AUTHOR")).length()>0) eleAuthor.appendChild(doc.createTextNode(rs.getString("AUTHOR")));
Element elePageFrom = doc.createElement("FIELD");
rootFieldElem.appendChild(elePageFrom);
elePageFrom.setAttribute("fieldName","PAGEFROM");
if((rs.getString("PAGEFROM")).length()>0) elePageFrom.appendChild(doc.createTextNode(rs.getString("PAGEFROM")));
Element elePubName = doc.createElement("FIELD");
rootFieldElem.appendChild(elePubName);
elePubName.setAttribute("fieldName","PUBNAME");
if((rs.getString("PUB_NAME")).length()>0) elePubName.appendChild(doc.createTextNode(rs.getString("PUB_NAME")));
Element eleReaderName = doc.createElement("FIELD");
rootFieldElem.appendChild(eleReaderName);
eleReaderName.setAttribute("fieldName","READER NAME");
if((rs.getString("READER_NAME")).length()>0) eleReaderName.appendChild(doc.createTextNode(rs.getString("READER_NAME")));
Element eleParentTitle = doc.createElement("FIELD");
rootFieldElem.appendChild(eleParentTitle);
eleParentTitle.setAttribute("fieldName","PARENTTITLE");
if((rs.getString("PARENTTITLE")).length()>0)eleParentTitle.appendChild(doc.createTextNode(rs.getString("PARENTTITLE")));
Element eleCanMail = doc.createElement("FIELD");
rootFieldElem.appendChild(eleCanMail);
eleCanMail.setAttribute("fieldName","CANMAIL");
if((rs.getString("CANMAIL")).length()>0) eleCanMail.appendChild(doc.createTextNode(rs.getString("CANMAIL")));
Element elePublicationID = doc.createElement("FIELD");
rootFieldElem.appendChild(elePublicationID);
elePublicationID.setAttribute("fieldName","PUBLICATION_ID");
if((rs.getString("PUBLICATION_ID")).length()>0) elePublicationID.appendChild(doc.createTextNode(rs.getString("PUBLICATION_ID")));
Element eleJournlistID = doc.createElement("FIELD");
rootFieldElem.appendChild(eleJournlistID);
eleJournlistID.setAttribute("fieldName","JOURNALIST_ID");
if((rs.getString("JOURNALIST_ID")).length()>0) eleJournlistID.appendChild(doc.createTextNode(rs.getString("JOURNALIST_ID")));
Element eleIspdf = doc.createElement("FIELD");
rootFieldElem.appendChild(eleIspdf);
eleIspdf.setAttribute("fieldName","ISPDF");
if((rs.getString("ISPDF")).length()>0) eleIspdf.appendChild(doc.createTextNode(rs.getString("ISPDF")));
Element rootKeyElem=doc.createElement("KEYWORDS_CODES");
String[] arrCodes=getKeyCodes(rs.getString("ARTICLEID"));
int count1 = myVector1.size();
String[] myArray1=new String[count1];
myVector1.copyInto(myArray1);
int count2 = myVector2.size();
String[] myArray2=new String[count2];
myVector2.copyInto(myArray2);
for(int j=0;j<arrCodes.length;j++)
Element eleKeyword= doc.createElement("KEYWORD_CODE");
eleKeyword.setAttribute("CodeId",arrCodes[j]);
eleKeyword.setAttribute("LongName",myArray1[j]);
eleKeyword.setAttribute("CodeType",myArray2[j]);
rootKeyElem.appendChild(eleKeyword);
artElem.appendChild(rootKeyElem);
Source source = new DOMSource(docElem);
//File file = new File("/share/PrintDom.xml");
StringWriter rw=new StringWriter();
Result result = new StreamResult(rw);
//Result result = new DOMResult();
// Write the DOM document to the file
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
out.println(rw);
catch (ClassNotFoundException e)
out.println("Unable to load Driver Class" + e);
return;
//fileLog.log(e,"PressWatchFrame1.PressWatchFrame1()");
catch (SQLException se)
out.println(se);
catch (Exception e)
out.println(e);
finally{
try{
if(Conn!=null) Conn.close();
catch(SQLException ignored){}
public String[] getKeyCodes(String strArticleId)
Vector myVector=new Vector();
myVector1.removeAllElements();
myVector2.removeAllElements();
try{
stmt1=Conn.createStatement( );
//String strSql1="Select codeid FROM SCANSSUBJECT where articleid='"+ strArticleId +"'";
String strSql1="Select ss.codeid,c.longname,c.codetype FROM SCANSSUBJECT ss,CODES c where ss.codeid=c.codeid and articleid='"+ strArticleId +"'";
rs1=stmt1.executeQuery(strSql1);
String strCodes="";
while(rs1.next())
myVector.add(rs1.getString("codeid"));
myVector1.add(rs1.getString("longname"));
myVector2.add(rs1.getString("codetype"));
}catch (SQLException se)
out.println(se);
int count = myVector.size();
String[] myArray = new String[count];
myVector.copyInto(myArray);
return myArray;
..................Thanx -
How to Save a XML file using Document Object
Hai all,
I am new to XML and i created a application to insert a node in the XML file using org.w3c.dom.Document object. And want to know which method has to be used to store the Document object into a XML fille.The standard way would be to use a transformer with no transformation where the destination is a StreamResult.
something like:
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.transform(new DOMSource(doc), new StreamResult("output.xml"));
Maybe you are looking for
-
I have been trying to get on chat with adobe, since it seems that is the only option? and have not had any success for days, any ideas how to get support???? Thanks! Amy
-
Why does iTunes and my whole computer freeze when syncing songs to phone?
Im trying to sync my iPhone 3gs with iTunes but my laptop keeps freezing after 14 songs why is this? I have recently upgraded to ios5 so im guessing its because of this..how do i solve my problem?
-
There is an error in the process of validating the lookup function in NW
Hi, I got an error in the script logic validation. I write a lookup function and validate the logic, In this one error occurred "Invalid lookup strecture: Invalid appl name" The logic code: *LOOKUP Staff_Additions *DIM Salary="Salary
-
My Xperia M4 Dual ringtone doesnt ring incoming calls. Speaker works fine when I listen music. And sim 1 keeps rejecting calls. If there is anything Sony can do, please resolve.
-
E-MU 0202 USB 2.0 Windows 7 (and 8) driver link
Could someone please pass along a working link to the above driver(s)? Thanx Rich