Replace text in XML object using a sequence of tags as input
Hi, I need to write an apparently very simple function that replaces a text between tags in an XML object receving as input the sequence of tags to identify the element, but I miss one point.
I travel through the XML tree using a element variable like
Code:
element = element.child(n)
using at each step the tags provided as input to decide the value of "n". Now, when I reach the tags that contain the text to be replaced, what to do? If I use
Code:
element.replace(0, newValue)
I replace the text just in element not in the original object...
For example having
<publishing_date>
<year>2002</year>
<month>Jan</month>
<success_date>
<year>2004</year>
<month>Feb</month>
</success_date>
I want to call a function like
replace(["success_date", "month"], "Mar")
and have an XML object where the second occurence of Feb is replaced with "Mar"
Any suggestion on this easy task?
Thanks a lot
Giuse
Hi Michael, thanks but my question was difference.
I need to make a function to operate with input tags, not with known tags. So I am writing a loop that scans the XML object using the tags provided in input until it reaches the desired tag with the text to be replaced.
That's why I wrote
element = element.child(n)
that I was thinking to use at each step of the loop looking for desired tag.
There I have the problem: if I use
element.replace.... I am changing the text between the tags in the element variable, not in the original XMLObject, and since there are no pointers in JavaScript, how to do that?
I hope to have been more clear now..... did I ?
Thanks and best reagrds
Giuseppe
Similar Messages
-
Hello, I am using an XML file to import text into InDesign page items. Everything works well using the attribute "aid:cstyle = style1" but since the introduction of InDesign groups, our users want to use them but we do not know how to reference them in the xml attribute.
I saw somewhere on the internet that you should use "aid:cstyle = group1:style1" or "aid:cstyle = group1|style1" but both won't work. They simply create a new ungrouped style name "group1:style1" or "group1|style1"
So what is the right formula ?
ThanksTagged Text is nice but all the copy in your page item is one big block, no way to separate and track individual values, say in your page item you have a description and a sale price, you can't update the price without reimporting the description as well. We use many fields inside an individual page item and just as one example we need to be able to update all prices on the page without modifying anything else that shares the page items with the prices. Also XML updates you can trigger an update for the whole document in one operation, while with Tagged Text you have to "place" your text file for each individual page item you are modifying (even with scripting you call the place function as many times as you have page items). So say you have a page or document with 200 boxes across multiple layers that is a lot of individual actions.
Anyway back to my problem.
I've never used Mapping tas to styles before, but running some tests here I clearly don't understand it. If my text is already tagged and I map a style to a tag, it untags all my individual text elements and leaves only the page item tag, and doesn't style my text... I'm going to try and read more on this. -
How to burst reports in text and XML format using API
Hi there,
I need to be able to burst PDF, Excel etc reports and at the same time, generate XML files containing metadata that will accompany the PDF files to their destination. The reason for this, is that the destination requires metadata to class the documents in the content management system.
My issue is that I just cannot get bursting to XML, text or HTML format right. There is very little documentation available around creating reports in these formats using the API's and perhaps someone who has gotten this right can, once and for all, solve this issue where others can find the solution.
Alright, here is some sample supporting documentation (For the sake of the question, I have removed the bursting to PDF, Excel etc. formats and I am just focusing on the XML output):
In my code for bursting, I make use of the following constructor...
DocumentProcessor dp =
new DocumentProcessor("ControlFile.xml", "TestData.xml", "temp");
The ControlFile.xml looks like this...
<?xml version="1.0" encoding="UTF-8"?>
<xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
_<xapi:request select="/DATA/LIST_BRANCH/BRANCH">
___<xapi:delivery>
______<xapi:filesystem id="dst" output="C:\${BRANCH_NAME}.xml"/>
___</xapi:delivery>
___<xapi:document output-type="text" delivery="dst">
______<xapi:template type="xsl-fo" location="Template.xsl"></xapi:template>
___</xapi:document>
_</xapi:request>
</xapi:requestset>
The data in my TestData.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<DATA>
___<LIST_BRANCH>
______<BRANCH>
__________<BRANCH_NAME>BRANCH 1</BRANCH_NAME>
______________ OTHER IRRELEVANT DATA
______</BRANCH>
______<BRANCH>
__________<BRANCH_NAME>BRANCH 2</BRANCH_NAME>
______________ OTHER IRRELEVANT DATA
______</BRANCH>
___</LIST_BRANCH>
</DATA>
In my ControlFile.xml, I reference my XSL file called Template.xsl which should do my transformations into XML. That file looks like:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
__<xsl:output method="xml" indent="yes">
__<xsl:template match="/">
____<METADATA>
_______<BRANCH>
___________<xsl:value-of select="BRANCH_NAME"/>
_______</BRANCH>
____</METADATA>
__</xsl:template>
</xsl:stylesheet>
I have tried about forty variations of the ControlFile.xml and Template.xsl and have had no luck. Among the various error messages that the compiler has reported to me, these are the most common:
[101507_055953158][][EXCEPTION] Error while generating the Document...
[101507_055953158][][EXCEPTION] org.xml.sax.SAXException: element metadata is not supported yet.
[101507_061037084][][EXCEPTION] Error while generating the Document...
[101507_061037094][][EXCEPTION] oracle.xml.parser.v2.XMLParseException: Start of root element expected.
I have managed in some cases to get the API code to compile, but the outputs are empty 0kb files.
I have also exported an XSL-FO file from word, but the output is always PDF even with tweaking.
I have wasted about 9 hours on this problem and it is driving me mad! If anyone has ideas, tips and/or solutions, they would be very welcome.
Thanks in advance,
AndrewFor anyone interested... here it is!
Format Setup:
<TEMPLATE TYPE> DELIMITER_BASED
<OUTPUT CHARACTER SET> iso-8859-1
<NEW RECORD CHARACTER> Carriage Return
Sequences:
<DEFINE SEQUENCE> MetaDataSeq
<RESET AT LEVEL> BRANCH
<INCREMENT BASIS> LEVEL
<END DEFINE SEQUENCE> MetaDataSeq
Format Data Records:
<LEVEL> BRANCH
<MAXIMUM LENGTH><FORMAT><DATA>
<NEW RECORD> FileHeaderRec
16_________________Alpha_____‘<REPORT_SUMMARY>’
22_________________Alpha_____‘<TYPE>1</TYPE>’
255________________Alpha_____'<NAME>’ || BRANCH_NAME || ‘.pdf</NAME>’
255________________Alpha_____'<DESC>NON-MOTOR VEHICLE CLAIMS</DESC>’
10_________________Alpha_____‘<METADATA>’
255________________Alpha_____‘<CONTROL_AREA>MAIN CONTROL AREA</CONTROL_AREA>’
255________________Alpha_____‘<BRANCH_CODE>’ || BRANCH_CODE || ‘</BRANCH_CODE>’
255________________Alpha_____‘<BRANCH_NAME>’ || BRANCH_NAME || ‘</BRANCH_NAME>’
255________________Alpha_____'<DIVISION_CODE>1</DIVISION_CODE>’
255________________Alpha_____‘<DIVISION_NAME>PERSONAL</DIVISION_NAME>’
11_________________Alpha_____‘</METADATA>’
17_________________Alpha_____‘</REPORT_SUMMARY>’
<END LEVEL> BRANCH -
How to search and replace in an xml file using java
Hi all,
I am new to java and Xml Programming.
I have to search and replace a value Suresh with some other name in the below xml file.
Any help of code in java it is of great help,and its very urgent.
I am using java swings for generating two text boxes and a button but i am not able to search in the xml file thru the values that are entered into these text boxes.
Thanks in advance.
**XML File*
<?xml version="1.0" encoding="ISO-8859-1"?>
<student>
<stud_name>Suresh</stud_name>
<stud_age>40</stud_age>
</student>Also i am using SAX Parser in the java program
any help of code or any tutorials for sax parisng is very urgent please help me to resolve this problem
Edited by: Karthik84 on Aug 19, 2008 1:45 AM
Edited by: Karthik84 on Aug 19, 2008 3:15 AMUsing XPath to locate the elements you are after is very easy.
Try something like this:
import java.io.File;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
public class BasicXMLReplaceWithDOM4J {
static String inputFile = "C:/student.xml";
static String outputFile = "C:/studentRenamed.xml";
public static void main(String[] args) throws Exception {
// Read xml and build a DOM document
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().parse(new InputSource(inputFile));
// Use XPath to find all nodes where student is named 'Suresh'
XPath xpath = XPathFactory.newInstance().newXPath();
NodeList nodes = (NodeList)xpath
.evaluate("//stud_name[text()='Suresh']", doc, XPathConstants.NODESET);
// Rename these nodes
for (int idx = 0; idx < nodes.getLength(); idx++) {
nodes.item(idx).setTextContent("Suresh-Renamed");
// Write the DOM document to the file
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(new DOMSource(doc), new StreamResult(new File(outputFile)));
}- Roy -
Trouble importing an XML that uses DPX sequences
We are doing an offline edit using a DPX sequence. We're testing now to ensure that an XML of the sequence when we're done will work. (Our DPX is in HD, and the online house will be taking a 4K DPX version of the same piece - identical except for the resolution - for the online.) However, when we start up a new project and import the XML to test it out, it isn't making the edits to the DPX sequence that we made. Everywhere there is an edit, it just starts the DPX sequence at the beginning again. This is the same exact HD DPX sequence that we used when we made the edits.
Here is the original project:
http://img607.imageshack.us/img607/1802/i2ht.jpg
Here is what it looks like when we create an XML from that project and import it into a new project:
http://img14.imageshack.us/img14/6389/swfw.jpg
The text block you see in the thumbnail for the videos in the sequence is the slate at the top of the DPX sequence, so you can see that it's just starting at the beginning of the DPX sequence every time there's a cut. What should we be doing differently?My apologies Jim. My understanding - which was probably incorrect - was that the XML schema that was in use by FCP7, which has since been implemented for use in Smoke, Resolve, Premiere, etc., was developed by Apple. Thanks for educating me!
XML as currently coded cannot convey sequences created from image-sequence-based media.
What has been an issue for me and a few others, which may be in play here, is relinking to media coming from a third party grading session. Smoke, Hiero, Resolve, SpeedGrade can all conform DPXs to an EDL or XML using timecode (independent of reel name, clip name, etc) while Premiere as yet does not. Premiere's relinking struggles if there's any disparity between the source file names and the file names it's relinking to. It would be great to see some more flexibility there, such as timecode-based relinking coupled with optional fields for partial clip name and partial reel name relinking.
Since the original post refers to a third party vendor doing the finish on the project, simply relinking in Premiere may not be an option. If the vendor in question is going to be conforming in either Smoke, Flame or Hiero, just sending an EDL over will just about guarantee a successful conform. I'd contact them and find out what they prefer.
Cheers!
Jon -
Help with Replacing text in a file using a vbscript
I have the following script which I am wanting to
1. Take the prf file and read it
2. Edit a line in the outlook .prf file replacing it with the text I have asked it to replace which is the full name of the user pulled from the currently logged on user
The problem I am seeing is that when the temp file is being generated it is throwing off the formatting of the file hence the script doesn't work. Can anyone help me please.
set objSysInfo = CreateObject("ADSystemInfo")
struser = objSysInfo.Username
set objUser = GetObject("LDAP://" & strUser)
strFullName = objUser.Get("displayName")
Const ForReading=1
Const ForWriting=2
Set objFSO = CreateObject("Scripting.FileSystemObject")
folder = "C:\test"
'filePath = folder & "file.txt"
filePath = "c:\test\test2007_3.prf"
Set myFile = objFSO.OpenTextFile(filePath, ForReading)
Set myTemp= objFSO.OpenTextFile(filePath & ".tmp", ForWriting, True)
Do While Not myFile.AtEndofStream
myLine = myFile.ReadLine
If InStr(myLine, "MailboxName=%UserName%") Then
myLine = "&strFullName"
End If
myTemp.WriteLine myLine
Loop
myFile.Close
myTemp.Close
objFSO.DeleteFile(filePath)
objFSO.MoveFile filePath& ".tmp", filePath
ChristopherSorry Irv,
Here is the code I have and then after that is the prf file. I think there is an issue with the file structure because if I take a regular text file and add the lines in there myself it replaces the lines, but with the prf file or even the prf file as a
text file it gives me the invalid argument message
Const filePath = "c:\test\test2007_3.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set myFile = objFSO.OpenTextFile(filePath)
fileText = myFile.ReadAll()
myFile.Close
fileText=Replace(fileText,"%UserName%","THIS_IS_THS_REPLACEMENT_TEXT")
Set myTemp= objFSO.OpenTextFile(filePath, 2, True)
myTemp.Write fileText
myTemp.Close
;Automatically generated PRF file from the Microsoft Office Customization and Installation Wizard
; Section 1 - Profile Defaults
[General]
Custom=1
ProfileName=Somthing
DefaultProfile=Yes
OverwriteProfile=Yes
ModifyDefaultProfileIfPresent=false
DefaultStore=Service1
; Section 2 - Services in Profile
[Service List]
ServiceX=Microsoft Outlook Client
ServiceEGS=Exchange Global Section
Service1=Microsoft Exchange Server
ServiceEGS=Exchange Global Section
; Section 3 - List of internet accounts
[Internet Account List]
; Section 4 - Default values for each service.
[ServiceX]
CachedExchangeMode=0x00000002
CachedExchangeSlowDetect=true
[ServiceEGS]
CachedExchangeConfigFlags=0x00000900
MailboxName=%UserName%
HomeServer=
RPCoverHTTPflags=0x0027
RPCProxyServer=
RPCProxyPrincipalName=
RPCProxyAuthScheme=0x0001
[Service1]
OverwriteExistingService=No
UniqueService=Yes
MailboxName=%UserName%
HomeServer=
OfflineAddressBookPath=%USERPROFILE%\local settings\application data\microsoft\outlook\
OfflineFolderPathAndFilename=%USERPROFILE%\local settings\application data\microsoft\outlook\outlook.ost
AccountName=Microsoft Exchange Server
DefaultAccount=TRUE
;[ServiceX]
;FormDirectoryPage=
;-- The URL of Exchange Web Services Form Directory page used to create Web forms.
;WebServicesLocation=
;-- The URL of Exchange Web Services page used to display unknown forms.
;ComposeWithWebServices=
;-- Set to true to use Exchange Web Services to compose forms.
;PromptWhenUsingWebServices=
;-- Set to true to use Exchange Web Services to display unknown forms.
;OpenWithWebServices=
;-- Set to true to prompt user before opening unknown forms when using Exchange Web Services.
; Section 5 - Values for each internet account.
; Section 6 - Mapping for profile properties
[Microsoft Exchange Server]
ServiceName=MSEMS
MDBGUID=5494A1C0297F101BA58708002B2A2517
MailboxName=PT_STRING8,0x6607
HomeServer=PT_STRING8,0x6608
OfflineAddressBookPath=PT_STRING8,0x660E
OfflineFolderPathAndFilename=PT_STRING8,0x6610
[Exchange Global Section]
SectionGUID=13dbb0c8aa05101a9bb000aa002fc45a
MailboxName=PT_STRING8,0x6607
HomeServer=PT_STRING8,0x6608
RPCoverHTTPflags=PT_LONG,0x6623
RPCProxyServer=PT_UNICODE,0x6622
RPCProxyPrincipalName=PT_UNICODE,0x6625
RPCProxyAuthScheme=PT_LONG,0x6627
CachedExchangeConfigFlags=PT_LONG,0x6629
[Microsoft Mail]
ServiceName=MSFS
ServerPath=PT_STRING8,0x6600
Mailbox=PT_STRING8,0x6601
Password=PT_STRING8,0x67f0
RememberPassword=PT_BOOLEAN,0x6606
ConnectionType=PT_LONG,0x6603
UseSessionLog=PT_BOOLEAN,0x6604
SessionLogPath=PT_STRING8,0x6605
EnableUpload=PT_BOOLEAN,0x6620
EnableDownload=PT_BOOLEAN,0x6621
UploadMask=PT_LONG,0x6622
NetBiosNotification=PT_BOOLEAN,0x6623
NewMailPollInterval=PT_STRING8,0x6624
DisplayGalOnly=PT_BOOLEAN,0x6625
UseHeadersOnLAN=PT_BOOLEAN,0x6630
UseLocalAdressBookOnLAN=PT_BOOLEAN,0x6631
UseExternalToHelpDeliverOnLAN=PT_BOOLEAN,0x6632
UseHeadersOnRAS=PT_BOOLEAN,0x6640
UseLocalAdressBookOnRAS=PT_BOOLEAN,0x6641
UseExternalToHelpDeliverOnRAS=PT_BOOLEAN,0x6639
ConnectOnStartup=PT_BOOLEAN,0x6642
DisconnectAfterRetrieveHeaders=PT_BOOLEAN,0x6643
DisconnectAfterRetrieveMail=PT_BOOLEAN,0x6644
DisconnectOnExit=PT_BOOLEAN,0x6645
DefaultDialupConnectionName=PT_STRING8,0x6646
DialupRetryCount=PT_STRING8,0x6648
DialupRetryDelay=PT_STRING8,0x6649
[Personal Folders]
ServiceName=MSPST MS
Name=PT_STRING8,0x3001
PathAndFilenameToPersonalFolders=PT_STRING8,0x6700
RememberPassword=PT_BOOLEAN,0x6701
EncryptionType=PT_LONG,0x6702
Password=PT_STRING8,0x6703
[Unicode Personal Folders]
ServiceName=MSUPST MS
Name=PT_UNICODE,0x3001
PathAndFilenameToPersonalFolders=PT_STRING8,0x6700
RememberPassword=PT_BOOLEAN,0x6701
EncryptionType=PT_LONG,0x6702
Password=PT_STRING8,0x6703
[Outlook Address Book]
ServiceName=CONTAB
[LDAP Directory]
ServiceName=EMABLT
ServerName=PT_STRING8,0x6600
UserName=PT_STRING8,0x6602
UseSSL=PT_BOOLEAN,0x6613
UseSPA=PT_BOOLEAN,0x6615
EnableBrowsing=PT_BOOLEAN,0x6622
DisplayName=PT_STRING8,0x3001
ConnectionPort=PT_STRING8,0x6601
SearchTimeout=PT_STRING8,0x6607
MaxEntriesReturned=PT_STRING8,0x6608
SearchBase=PT_STRING8,0x6603
CheckNames=PT_STRING8,0x6624
DefaultSearch=PT_LONG,0x6623
[Microsoft Outlook Client]
SectionGUID=0a0d020000000000c000000000000046
FormDirectoryPage=PT_STRING8,0x0270
WebServicesLocation=PT_STRING8,0x0271
ComposeWithWebServices=PT_BOOLEAN,0x0272
PromptWhenUsingWebServices=PT_BOOLEAN,0x0273
OpenWithWebServices=PT_BOOLEAN,0x0274
CachedExchangeMode=PT_LONG,0x041f
CachedExchangeSlowDetect=PT_BOOLEAN,0x0420
[Personal Address Book]
ServiceName=MSPST AB
NameOfPAB=PT_STRING8,0x001e3001
PathAndFilename=PT_STRING8,0x001e6600
ShowNamesBy=PT_LONG,0x00036601
; Section 7 - Mapping for internet account properties. DO NOT MODIFY.
[I_Mail]
AccountType=POP3
;--- POP3 Account Settings ---
AccountName=PT_UNICODE,0x0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;--- POP3 Account Settings ---
POP3Server=PT_UNICODE,0x0100
POP3UserName=PT_UNICODE,0x0101
POP3UseSPA=PT_LONG,0x0108
Organization=PT_UNICODE,0x0107
ReplyEmailAddress=PT_UNICODE,0x0103
POP3Port=PT_LONG,0x0104
POP3UseSSL=PT_LONG,0x0105
; --- SMTP Account Settings ---
SMTPServer=PT_UNICODE,0x0200
SMTPUseAuth=PT_LONG,0x0203
SMTPAuthMethod=PT_LONG,0x0208
SMTPUserName=PT_UNICODE,0x0204
SMTPUseSPA=PT_LONG,0x0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0x0010
SMTPPort=PT_LONG,0x0201
SMTPSecureConnection=PT_LONG,0x020A
ServerTimeOut=PT_LONG,0x0209
LeaveOnServer=PT_LONG,0x1000
[IMAP_I_Mail]
AccountType=IMAP
;--- IMAP Account Settings ---
AccountName=PT_UNICODE,0x0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;--- IMAP Account Settings ---
IMAPServer=PT_UNICODE,0x0100
IMAPUserName=PT_UNICODE,0x0101
IMAPUseSPA=PT_LONG,0x0108
Organization=PT_UNICODE,0x0107
ReplyEmailAddress=PT_UNICODE,0x0103
IMAPPort=PT_LONG,0x0104
IMAPUseSSL=PT_LONG,0x0105
; --- SMTP Account Settings ---
SMTPServer=PT_UNICODE,0x0200
SMTPUseAuth=PT_LONG,0x0203
SMTPAuthMethod=PT_LONG,0x0208
SMTPUserName=PT_UNICODE,0x0204
SMTPUseSPA=PT_LONG,0x0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0x0010
SMTPPort=PT_LONG,0x0201
SMTPSecureConnection=PT_LONG,0x020A
ServerTimeOut=PT_LONG,0x0209
CheckNewImap=PT_LONG,0x1100
RootFolder=PT_UNICODE,0x1101
[INET_HTTP]
AccountType=HOTMAIL
Account=PT_UNICODE,0x0002
HttpServer=PT_UNICODE,0x0100
UserName=PT_UNICODE,0x0101
Organization=PT_UNICODE,0x0107
UseSPA=PT_LONG,0x0108
TimeOut=PT_LONG,0x0209
Reply=PT_UNICODE,0x0103
EmailAddress=PT_UNICODE,0x000C
FullName=PT_UNICODE,0x000B
Connection Type=PT_LONG,0x000F
ConnectOID=PT_UNICODE,0x0010
Christopher -
Reading XML object from Request object
Hi,
We are using Flash in our web application in which we are sending an XML object using HTTP post method to a JSP where we need to parse the XML object and get the values. Can anyone tell how we can do it?In fact we are not getting error in our page. following is the error
Error: 500
Location: /team/par/getData10.jsp
Internal Servlet Error:
java.lang.IllegalArgumentException
at javax.servlet.http.HttpUtils.parseQueryString(HttpUtils.java:151)
at javax.servlet.http.HttpUtils.parsePostData(HttpUtils.java:254)
at org.apache.tomcat.util.RequestUtil.readFormData(RequestUtil.java:101)
at org.apache.tomcat.core.RequestImpl.handleParameters(RequestImpl.java:719)
at org.apache.tomcat.core.RequestImpl.getParameterValues(RequestImpl.java:259)
at org.apache.tomcat.core.RequestImpl.getParameter(RequestImpl.java:250)
at org.apache.tomcat.facade.HttpServletRequestFacade.getParameter(HttpServletRequestFacade.java:223)
at org.apache.jasper.servlet.JspServlet.preCompile(JspServlet.java:437)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:480)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread -
How to create a xml object dynamically
Hi all,
In my current project the database is returning the query result in xml string format(using oracle's DBMS-XML package).
Now I need to use this xml string and build a xml object and transform it into XSLT and then in a servlet and then pass it to the browser and display it using xsl stylesheets.
Can some one help me in building an xml object using a string( the xml string is in the xml format i.e in <..> format) and then transform it into xslt in the servlet and send across to the browser.
Any hands on code or references to the code will be most favourable.
any help regarding this issue will be most appreciated. Pls do reply as early as possible as I do not have much time to implement this.
Thanking in advance for your kind help.
Srinivas.What's an "xml object"?
If you want to transform it using XSLT (transforming it "into" XSLT doesn't make much sense), you can transform direct from the string. Like this:try {
TransformerFactory xformFactory = TransformerFactory.newInstance();
Source xsl = new StreamSource("your.xsl");
Transformer stylesheet = xformFactory.newTransformer(xsl);
Source request = new StreamSource(new StringReader(yourXMLString));
Result response = new StreamResult(out);
stylesheet.transform(request, response);
catch (TransformerException e) {
System.err.println(e);
}By the way, if you haven't seen this code before then I suggest you go and read ERH's book about XML with Java:
http://www.cafeconleche.org/books/xmljava/chapters/index.html -
Pulling particular attributes from the XML Object
Hi !
My requirement is onChange of a value from the first drop down, particular values needs to load in the second drop down. Values that needs to pull are designed in XML Object as Map entries Key,Pair Values.
We can pull the first drop down values from the XML Object using Rule library and find the following code snippet ;
<block>
<set name='appData'>
<invoke name='getExtension'>
<invoke name='getObject'>
<ref>ctx</ref>
<invoke name='findType' class='com.waveset.object.Type'>
<s>Configuration</s>
</invoke>
<s>Config_SDD_ReferenceData</s>
</invoke>
</invoke>
</set>
<ref>appData</ref>
</block>
Here, Config_SDD_ReferenceData.xml is the file where the map entries are written and the ref name is appData. Later in BPE the code "appData.units" are referred in ValueMap property.
But we are stuggling to populate the second drop down values based on the valu selected in the first drop down.
Please find the XML Object also;
<Attribute name='units'>
<Map>
<MapEntry key='1' value='units1'/>
<MapEntry key='2' value='units2'/>
<MapEntry key='3' value='units3'/>
</Map>
</Attribute>
Thanks in advance.u could use removeChild() method of the node interface....get the parent node named 'xxxxxx' from the DOM and perform a removeChild operation on it specifying the senderID, receiverID and dateTimeStamp Nodes as arguments to the method....
Hope this helps
VP -
Internal.text parsed by XML object ?
Is it possible to use the XML object to parse internal xml
instead of loading an external file?
I am writing an application that converts arrays &
objects into xml.
In my development, I am displaying the xml in a text field on
the stage. In testing I want to read this text field as a xml file.
Currently I copy and past the xml from flash into the external xml
file (with notepad) then reload the xml file with
sample_xml.load("xml/sample_1.xml");
Can I point to the text field in flash to get the xml parsing
instead of the external file?
ThanksActually two ways:
var myXML:XML = new XML(myTextField.text)
or
var myXML:XML = new XML();
//maybe:
myXML.ignoreWhite=true;
//and later...
myXML.parseXML(myTextField.text); -
I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
I have 5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
[email protected]This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
!####.jpg!
h2. "Name####"
Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
Back of the Painting In Progress </p> </body> </html>
Warmest regards,
Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/ -
Special characters in XML built using the DOM object
I am using the DOM object to build xml but I am having problems with special characters. I have a Element object that I create attributes in. Most special characters like the &, ", or ' are translated for me (amp; quot;, acute; put a & in front of those, if I do it here the browser will translate them into the logical character) but I am having a problem with the � character. The DOM object does not translate this. If I do it my self to(eacute; same here add a & in front) before adding the string to the attribute then the DOM object translates it to (amp;eacute; add a & in front of the amp; not in front of the eacute;). As you can see the DOM object translates the & instead of recognizing that it is a HTML character. Can anyone give me a hand?
I am building this XML in a servlet so ,right, DOM does process XML (even though a valid HTML file can be loaded into a DOM object) but if you build XML using DOM then write the XML out using PrintWriter and Transformer objects this will cause the XML to print out in your browser. If you view source on this XML you will see that the DOM object has translated all special characters to there &xxxx; equivalent. For a example: when the string (I know "cool" java) gets loaded into a attribute using the DOM object then wrote back out it looks like (I know &xxx;cool&xxx; java) if you view the source in your browser. This is what it should do, but the DOM object is not change the � to the "&xxxxx;". This servlet is acting as a gateway between a Java API and a windows asp. The asp will call the servlet expecting to get XML back and load it directly into a DOM object. When the windows DOM object gets the xml that I am returning in this servlet is throws a exception "invalid character" because the � was not translated to &xxxx; like the other characters were. According to the book HTML 4 in 24 hours (and other references) the eacute; or #233; are how you say "�" in HTML or XML. How do you say it?
-
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")); -
Use Powershell to replace text with image in Word document
I have a powershell script that uses a Word document as a template to create signatures that I am pushing out to my organization.
The document is populated with text formatted the way I want the signature to look, that I then do a FindText and ReplaceText on. This works fine for replacing text with text, but I can't figure out how to properly replace some of the holder text with
an image and a link. I found a few posts about adding images to word documents, but none that seem to work properly in this scenario.
Any insight would be greatly appreciated, thanks!Dear BOFH,
You are correct that method I outlined is not for inserting an image into a signature block (which would be in Outlook, not Word). The links you post do certainly deal with outlook signatures, well done... Except that the question was about how to
use a Powershell script to replace text in a Word document with an image. Sure it was framed in the context of creating signatures, but the poster expressed that they already had a method of generating and replacing text, and just needed to know, as
I did, how to do the thing they actually asked.
Please BOFH... Please forgive my audacity in hoping to find a reference (any reference) to how to replace Word text with images via Powershell in a thread titled "Use Powershell to replace text with image in Word document".
This is certainly a scripting question, and even something as simple as "You will need to call the .NET methods for the Word find/replace functionality. Please ask in the Word forums for the correct method to use.
If you need help on calling .NET methods look HTTP ://here"support you offered combined with the contempt you offer in response to my actual substantive help to the actual question asked.
BOFH, you are not better than us, just more arrogant.
Can you please start your own question as this one has been closed. Please see scripting guidelines.
We cannot guarantee you satisfaction as this is a user supported forum. The is no SLA for community support. Perhaps if you posted a better worded question as a new topic someone might be able to help you resolve your issue.
The topic you are posting on is closed and answered.
¯\_(ツ)_/¯ -
BC4J Objects with PKs based on two columns using multiple sequences
I have implemented a BC4J object that is based on a DB table that has two columns as the primary key. For example Table A's primary key is Group and ID and there is a DB sequence for each Group.
I use the BC4J object using servlets and JSPs and I have been able to implement an Update form.
I now want to implement a Create (New) form. I've read forum postings and info on the help regarding using the SequenceImpl class to override the EntityImpl object's create method as shown below:
protected void create(AttributeList attributeList)
super.create(attributeList);
SequenceImpl mySeq = new SequenceImpl("MY_SEQ",getDBTransaction());
setMyObjectId(mySeq.getSequenceNumber());
But as you can see I need to know the value of the group attribute before I can get the next value sequence:
For new EO belonging in Group1 I need sequence from "GROUP1_SEQ", Group 2 from "GROUP2_SEQ", etc.
I would like to put this code in the Entity Object where it belongs. I guess my problem is simply how to create a new row in the View Object with a passed parameter which is the value of Group.
Thanks in advance!Angelo:
How is the EO suppose to receive the group id? Is it from the view row? If so, the VO can pass that group id to the EO through the attribute list and calling the
public Row createAndInitRow(AttributeList nvp);
API.
Example code would be:
ViewObject myVO;
// myVO is initialized
AttributeList nvp = new oracle.jbo.NameValuePairs();
// GroupID is the attr name of the Group ID
nvp.setAttribute("GroupID", <some-value>);
Row row = myVO.createAndInitRow(nvp);
If you do that the create(AttributeList attributeList) method of the EO will receive the GroupID value coming from the VO.
Then, you can use that for your sequence.
Thanks.
Sung
Maybe you are looking for
-
Hi, I have the following issue: When an existing contract is changed by adding a new line, the price is not taken from the Info Record. An Info Record for the vendor, the material and the purchasing organisation exists. Is there a possibility to man
-
Photoshop CC 2015 Keeps Failing to Install: Problem With a Patch
Hi all, I tried to install Photoshop. I got pretty far but then the installing stopped and bright orange letters popped up saying Installation Failed or something similar to that. I clicked on the Learn More link next to the message. It said there w
-
hi guys, In my app i am using a ad control.It works fine in windows phone 7 .But in windows phone 8 it causes crash my app.I used a ad_errorOccured event and there it says capabilities missing(ID_CAP_MEDIAIB).But I have checked all the capabilities i
-
Catching runtime errors and show message
Hello: How do i catch runtimes errors and send a message back to the user to see? Imagine i violate a PK when writing to a database, what is the stabdard way to catch that and inform the user? Thanks.
-
How to guide: Avoid, that ERP In & Outbound Docs are planned in same FO
Document can be found in SDN: https://cw.sdn.sap.com/cw/community/sce/external/blog/2012/01/25/how-to-avoid-that-erp-inbound-docs-po-inbound-delivery-out-docs-are-planned-in-the-same-freight-order-or-freight-booking