How to insert one XML document into another
Hi,
I've been working on a simple CMS.
There is a main template that is just a HTML page. The main template has a few extra 'module' tags that indicates places where individual modules have to be placed.
main template: template.xml
<html>
<body>
<div>
<module id="centre"/>
</div>
</body>
</html>module template: module_centre.xml
<div>
<a>This is a MODULE and it may be much more complex</a>
<div>My application has to detect every 'module' tag from the template.xml and insert there XML content from a proper module template.
The result file has to be generated dynamically on a request. The structures of 'modules' can be only defined in module_*.xml files.
The expected result
<html>
<body>
<div>
<div>
<a>This is a MODULE and it may be much more complex</a>
<div>
</div>
</body>
</html>What's the best practice do solve this case?
Pawel
I think I've came up with a better solution.
SRC file
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title></title>
<style type="text/css">
div.c4 {background-color:pink;width:400px;height:50px}
div.c3 {background-color:green}
div.c2 {background-color:blue;width:400px;height:299px}
div.c1 {background-color:red}
</style>
</head>
<body>
<module id="XXX"/>
<div id="main" class="c3">
<div id="top" class="c1"><module id="menu_test"/></div>
<div id="bottom" class="c2"><module id="menu_test2"/></div>
</div>
<div id="footer_container" class="c4"> <module id="menu_footer"/></div>
</body>
</html>MODULE src file
<?xml version="1.0" encoding="UTF-8"?>
<div id="admin_panel_module" style="background-color:orange;width:200px;height:50px">
<p>Control Panel TEST</p>
</div> @param source - NODES from MODULE document
*@param target - TEMPLATE document where MODULES are going to be inserted*
@throws Exception
public static void insertModules(Node source, Document target) throws Exception {
Node importedNodes = target.importNode(source, true);
// Use XPath to find all 'module' nodes in ''
XPath xpath = XPathFactory.newInstance().newXPath();
NodeList nodes = (NodeList) xpath.evaluate("//module", target, XPathConstants.NODESET);
// Remove MODULE node and insert there an XML content from MODULE template
for (int idx = 0; idx < nodes.getLength(); idx++) {
Node editedModuleElement = nodes.item(idx);
// parent of module mode
Node parentNode = editedModuleElement.getParentNode();
// replace <module/> node with imported nodes from 'module' XML document
parentNode.replaceChild(importedNodes, editedModuleElement);
// nodes.item(idx).appendChild(node);
importedNodes = target.importNode(source, true);
}Edited by: maestr0 on May 24, 2010 12:44 AM
Similar Messages
-
Insert One Word Document into another using OLE ABAP
Hi,
I want to insert one word document into another Word Document called by OLE ABAP.
ie.first word document having 6 pages have been displayed and I want first page of
second document as a 7th page.I want to dispaly the entire data in one document.
Hope to get the reply soon.
Thanks & Regards,
Divya.T.code :- DWDM
u can check OLE and OFFICE INTEGRATION tree have so many demo report
Report :- RSOLETT1
Edited by: Krupaji on Feb 18, 2010 2:00 PM -
How to insert a pages document into another pages document?
How can I insert a pages document into another one?
How can I insert 1 page of a document into another document?Open your files & show thumbnails. Sections have a yellow border around all of the pages in that section. Now click on the page in the thumbnail pane & copy. If the file is more than one page & you only want one, you'll need to insert a section break to separate the pages. Then go to your other file, click in the thumbnail pane & paste. The whole copied page will be pasted in. Repeat with another section. Styles will copy over with the sections but headers & footers will not.
-
Hi there,
I am working on my thesis with several Pages documents (for the first time). And I really have searched all over the Internet to find an answer to exactly my question but I cannot find it.
First my question was: How can I import one Pages document into another one? I found the answer on that (I think) and there is nothing else than just make a new section and copy/paste it in.
But then another issue pops up: I cannot [cmd]+A my whole document including the texboxes to paste it in the other Pages document. Then the document will be paste without the textboxes (and I have quite a lot of them in that document) and the text will not be at the right place.
So please explain to me: How I can combine two Pages documents and keep them exactly the way they are? Is that even possible?
I thank you so much in advance!Hi Fruhulda,
I have already tried to mark the textboxes in line but that did not work, and besides then the text and the boxes won't be at the rigt places either. Thank you for your reply . -
How to include one xml file into another
Dear Sir/Madam!
Could you do me a favour and help me to solve the problem like this:
I have one xml file wich describe the common thins of the GUI, and the another will be generated depending on the point the user has selected.
I would be very pleased for any helpful assistance.<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:variable name="xml1" select="document('xml1.xml')"/>
<xsl:variable name="xml2" select="document('xml2.xml')"/>
<xsl:copy-of select="$xml1"/>
<xsl:copy-of select="$xml2"/>
</xsl:template>
</xsl:stylesheet> -
Importing one Pdf document into another.
I am trying to import one Pdf-document into another using a Reference XObject. I am looking at thePDF- specification, and I thought I was doing things the right way, but its not working. The PDF-specification doesen't have an example of how to do this, only an explanation.
Below is the PDF-file I am testing with (if anyone can be bothered looking at it ). The file embeds another pdf-file, and is supposed to show a part of the embedded file at a certain position.
Again, if anyone can be bothered looking at my PDF and see if they can see what I am doing wrong here I would appreciate it.
(There is nothing wrong with the embedded file itself...)
PDF-file embedding another PDF-file and using a Reference XObject to display the embedded file:
%PDF-1.5
1 0 obj
<<
/Type /XObject
/Subtype /Form
/BBox [0 0 100 100]
/Ref <<
/F (4fa27162e72547a00771606.pdf)
/Page 1
>>
>>
endobj
2 0 obj
<<
/Type /Filespec
/F (4fa27162e72547a00771606.pdf)
/EF <</F 3 0 R>>
>>
endobj
3 0 obj
<<
/Type /EmbeddedFile
/Length 854
>>
stream
%PDF-1.5
1 0 obj
<<
/Length 334
>>
stream
q
1 0 0 1 128.10769621539 70.591821183642 cm
1 0 0 1 0 0 cm
1 0 0 1 0 0 cm
1 0 0 1 0 0 cm
1 0 0 1 -128.10769621539 -70.591821183642 cm
/DeviceCMYK CS
1 1 1 1 SCN
/DeviceCMYK cs
0 0.89 0.89 0.05 scn
0.2743205486411 w
2.743205486411 M
0 J
0 j
-1.9202438404877 -2.6517653035306 260.05588011176 146.48717297435 re
h
B
Q
endstream
endobj
2 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources <<
/Font <<>>
/XObject <<>>
>>
/MediaBox [0 0 255.11811023622 141.73228346457]
/Contents [1 0 R]
>>
endobj
3 0 obj
<<
/Type /Pages
/Kids [2 0 R]
/Count 1
>>
4 0 obj
<<
/Type /Catalog
/Pages 3 0 R
>>
endobj
xref
0 5
0000000000 65535 f
0000000010 00000 n
0000000401 00000 n
0000000568 00000 n
0000000624 00000 n
trailer
<<
/Size 5
/Root 4 0 R
>>
startxref
679
%%EOF
endstream
endobj
4 0 obj
<<
/Length 322
>>
stream
q
1 0 0 1 93.268986537973 71.826263652527 cm
1 0 0 1 0 0 cm
1 0 0 1 0 0 cm
1 0 0 1 0 0 cm
1 0 0 1 -93.268986537973 -71.826263652527 cm
55.961391922784 45.628651257302 74.615189230378 52.39522479045 re
W n
1 0 0 1 55.961391922784 42.062484124968 cm
74.615189230378 0 0 55.961391922784 0 0 cm
/XobjectPDF1 Do
Q
endstream
endobj
5 0 obj
<<
/Type /Page
/Parent 6 0 R
/Resources <<
/Font <<>>
/XObject << /XobjectPDF1 1 0 R >>
>>
/MediaBox [0 0 255.11811023622 141.73228346457]
/Contents [4 0 R]
>>
endobj
6 0 obj
<<
/Type /Pages
/Kids [5 0 R]
/Count 1
>>
7 0 obj
<<
/Type /Catalog
/Pages 6 0 R
>>
endobj
xref
0 8
0000000000 65535 f
0000000010 00000 n
0000000144 00000 n
0000000238 00000 n
0000001172 00000 n
0000001551 00000 n
0000001738 00000 n
0000001794 00000 n
trailer
<<
/Size 8
/Root 7 0 R
>>
startxref
1849
%%EOFPDF is a binary format. The most important piece in a PDF file is the cross
reference table. It contains byte offsets to the different objects in a
file. If you insert just one space (which in a true ASCII file will not
change much), you are making all byte offsets after the insertion point
invalid. They now all point to something different than the start of an
object.
Because there is no standard about how line endings are encoded in text
files, every time may add (or subtract) a byte - depending on what computer
system and what editor you use to convert your PDF to fake-ASCII, and then
again what I use to try to convert it back to PDF. If you are using a
Windows system and I'm using a Mac, the cross reference table gets
corrupted. And that's even before the web server does it's magic and
potentially adds data.
If you want somebody to look at your file.
Have you looked at the post I linked to? The settings in Acrobat are
important. You need to enable Reference XObjects, AND you have to declare
the directory where your target file is stored as trusted.
From what I can see in your PDF code, you are doing a whole bunch of cm
operations. You may want to consolidate all those into one operation. I
have not done a detailed analysis, but you could potentially shift your
data off the page. Keep it simple and see if that makes a difference.
Karl Heinz Kremer
PDF Acrobatics Without a Net
[email protected]
http://www.khkonsulting.com -
I dragged a cut out image from one photoshop document into another and now it is blurry. What can I do to prevent this?
What is the resolution of the image that you "dragged"? The resolution is the number in pixels per inch (ppi). If you dragged a significantly lower resolution file into a higher resolution file, it could result in a blurry image.
see below:
For further reading of Key Concepts:
http://www.adobe.com/designcenter-archive/keyconcepts/articles/concept_resolution.html
You can determine the image size by choosing Image > Image Size
below you can see the pixel dimensions of my example image.
Resolution Basics:
Adobe TV- http://tv.adobe.com/watch/creative-sweet-tv/photoshop-resolution-basics/
http://tv.adobe.com/watch/visual-design/getting-started-09-resizing-an-image/
Adobe Help:
http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-7945a.h tml
-janelle -
How to insert one table data into multiple tables by using procedure?
How to insert one table data into multiple tables by using procedure?
Below is the simple procedure. Try the below
CREATE OR REPLACE PROCEDURE test_proc
AS
BEGIN
INSERT ALL
INTO emp_test1
INTO emp_test2
SELECT * FROM emp;
END;
If you want more examples you can refer below link
multi-table inserts in oracle 9i
Message was edited by: 000000 -
Exception when inserting a XML document into database
Hello.
I'm trying to insert the content of a XML document into a database. The problem consists on the exception that is raised when a FK in the XML is not in the database as a PK
How can i catch these exceptions and continuing inserting the rest of the data
Thanks in advance ...I really hope for you this wasn't a production database, as mentioned in the URL, it has been some years ago for me fiddling around this which was btw a supported metalink workaround ONCE (during my Oracle 7 days), but now, I wouldn't be surprised if you now have mixed NLS content in your tables/database and more or less "corrupted" your content.
The initial issue was probably a client one.
BTW
I actually hope it was a production database, maybe then you would learn that way, that you SHOULD NEVER EVER UPDATE DATABASE BASE TABLES directly...
...unless (the only exception) you want to learn something about the internals and don't care that your TEST database gets corrupted.... -
Can I append an XML Document into another?
I have a large xml document which I open into coldfusion (mx
7), and then a smaller group of files that are opened into thier
own xml objects. After some customization of xml text values, I
want to append the smaller xml documents into the larger document
at specific positions within the document tree.
I have the code that I thought would do this, using an
arrayappend function, but what happens is that only the root
element of the smaller (inserted) xml document is placed into the
main document.
Is this possible, or do I need to modify the code so that the
entire tree of xml data that I am appending is created on the
fly?Personally I do this with XSLT.
<cfxml variable="doc1">
<root>
<member id="10">
<name>Ian</name>
<sex>male</sex>
</member>
</root>
</cfxml>
<cfxml variable="doc2">
<root>
<member id="1">
<name>Joe</name>
<sex>male</sex>
</member>
<member id="2">
<name>John</name>
<sex>male</sex>
</member>
<member id="3">
<name>Sue</name>
<sex>female</sex>
</member>
</root>
</cfxml>
<cffile action="write" file="#expandPath("/")#\doc2.xml"
output="#ToString(doc2)#" nameconflict="overwrite">
<!--- METHOD ONE using a depreciated and undocumented
method --->
<cfset newNode = doc1.root.member.cloneNode(true)>
<cfset doc2.changeNodeOwner(newNode)>
<cfset doc2.root.appendChild(newNode)>
<cfdump var="#doc2#" label="Merged by hidden functions"
expand="no">
<!--- METHOD TWO using XSLT --->
<!--- create an xsl docutment--->
<cfoutput>
<cfsavecontent variable="transformer">
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<!--load the merge file -->
<xsl:variable name="emps"
select="document('#expandPath("/")#\doc2.xml')"/>
<!--- this line references and XML file to be combined
with the main file,
I wonder if there is a way to use an XML document in memory
here? --->
<!-- combine the files -->
<xsl:template match="/">
<root>
<!-- select all the child nodes of the root tag in the
main file -->
<xsl:for-each select="root/child::*">
<!-- copy the member tag -->
<xsl:copy-of select="."/>
</xsl:for-each>
<!-- and all the child nodes of the root tag in the merge
file -->
<xsl:for-each select="$emps/root/child::*">
<!-- copy the member tag -->
<xsl:copy-of select="."/>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
</cfsavecontent>
</cfoutput>
<!--- create a combined xml document --->
<cfset doc2 = XMLparse(XMLtransform(doc1,transformer))>
<cfdump var="#doc2#" label="Merged by XSLT"
expand="no"> -
How to retrive one table records into another table by multiple records
how to retrive table X records into another table Y by multiple records (means at once i want display 10 records) in form 6i .
when i am written cursor it is ftching only one record.But i want to display all records at once.
Declare
Cursor cur_name is
select PROTOCOL_NO,DOCNUM,SUBSETSN,REPEATSN,AESEQ,AETERM from coding_ae WHERE PROTOCOL_NO='KP229';
Begin
open cur_name;
loop
fetch cur_name into :PROTOCOL_NO,:DOCNUM,:SUBSETSN,:REPEATSN,:AESEQ,:AETERM;
exit when cur_name%notfound;
next_record;
end loop;
close cur_name;
End;Hi,
Make sure the cursor is in the detailed block. For that use 8GO_BLOCK* built-in. So the code will be
Declare
Cursor cur_name is
select PROTOCOL_NO,DOCNUM,SUBSETSN,REPEATSN,AESEQ,AETERM from coding_ae;
Begin
GO_BLOCK('<detailed_block_name>');
open cur_name;
loop
fetch cur_name into :PROTOCOL_NO,:DOCNUM,:SUBSETSN,:REPEATSN,:AESEQ,:AETERM;
exit when cur_name%notfound;
next_record;
end loop;
close cur_name;
End;Regards,
Manu.
If my response or the response of another was helpful or Correct, please mark it accordingly -
How to insert a PDF document into a Word file?
I'm using Acrobat Standard 9 and Microsoft Word 2010 and I'm unable to insert a PDF document into a Word file. Operating system is Windows 7 Enterprize. Can someone help?
Thanks for the reply, Bill.
Yes, let me elaborate further:
I have a four page document in WORD with instructions. Examples of the instructions are in PDF files. I want to insert each PDF example next to or below each line item in WORD.The PDF will open when clicking on the icon without having a hyperlink attached to it. -
How can I copy/paste a page from one pages document into another pages document?
I have read the directions in the manual, but when I go to the document where I want to put the page the paste function is greyed out. I assume this has something to do with styles, but can't find what to do.
You got it.
Paste is greyed when we try to paste a page from a WP document into the thumbnails area of a Layout one.
It's active if we try to paste in the pages area.
In the document's tool bar, there is an icon with a + symbol at top left.
In WP documents it's named Sections, In Layout ones its named Pages.
Yvan KOENIG (VALLAURIS, France) mercredi 26 octobre 2011 17:50:55
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community -
Help - Inserting an XML document into a Oracle 8i Column (CLOB Type)
Hi JavaGurus,
I am looking for a simple java code which will take my XML document as input and insert the same into a Oracle 8i database's column which is of type CLOB.
Insert statement won't work and I can not use SQL Loader.
Any one?
JKMaybe you can adapt some of the code in Oracle's "LOB Datatype" example, which is a complete working program that stores and retrieves BLOBs and CLOBs.
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.html -
How to upload an XML file into another system
Hi friends,
I have a requirement where I need to upload an XML file into one system
which has been downloaded using another system.
I have tried using the method ' cl_gui_frontend_services=>gui_upload'
to upload the file but it is going for dump.
I have used the method ' w_xml->import_from_file' also,
but it is also going for dump ,because both methods are using the same FM
' GUI_UPLOAD'.
Can any one suggest on this.
Regards,
Bhargavi.D"Here is the Explaination for uploading the XML Format file to sap " through ABAP Program ....
1. Basically you simply have to convert the XML file into the proper IDoc format. There are many ways to achieve this. One solution would be to convert it externally to SAP, e.g. via VB Script or with an XSLT transformation. Or you use the built in SAP functions for importing an IDoc from an XML stream.
2. Uploading a file is either done via GUI_UPLOAD or via the usual way of reading a file from the application server (Open dataset. Read dataset) But what do you mean by "send to external system"? Do you want to convert an IDoc into XML? Then you simply define an XML port with WE21 to send the IDoc out.
Here is an example of code that loads an XML from file and posts it as an IDoc. Please keep in mind that the XML has to be in its canonical format as described in the interface repository: ifr.sap.com (choose the template of the desired IDoc from there as an example).
data: data_tab type table of char1024.
data: XML_STREAM type string.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'D:test.xml'
* FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = DATA_TAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_TABLE_TO_STRING'
EXPORTING
I_TABLINE_LENGTH = '1024'
IMPORTING
E_STRING = XML_STREAM
TABLES
IT_TABLE = DATA_TAB[].
write: / xml_stream color col_total.
data: CONTENT_LENGTH type string.
data: CONTENT_TYPE type string.
data: REMOTE_ADDR type string.
CALL FUNCTION 'IDOC_INBOUND_XML_VIA_HTTP'
EXPORTING
XML_STREAM = XML_STREAM
CONTENT_LENGTH = content_type
CONTENT_TYPE = content_type
REMOTE_ADDR = remote_addr
EXCEPTIONS
NO_IDOCS_SAVED = 1
TAG_ERROR = 2
NO_DATA_RECEIVED = 3
NO_IDOCS_RECEIVED = 4
SEGMENT_ERROR = 5
IDOC_WAS_SEND_SECOND_TIME = 6
OTHERS = 7
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
write: / sy-subrc color COL_NEGATIVE.
ENDIF.
reward points if it is usefull.......
Girish
Maybe you are looking for
-
Time machine backup error in Mavericks
I"m getting backup errors in Mavericks when it tries to back up to the Backups.backupdb folder in my 3TB external backup drive. This happens even when I turn Time Machine off! This is the error I'm getting (taken from the console) when I manually s
-
Final Cut Crashes for apparently no reason
Hi, I am experiencing FCP crashing for no reason, usually when i click on the timeline after, perhaps, using the source viewer. The spinning wheel starts and then never stops - i never get a 'this programme has terminated - send report' messages - ju
-
Dear all, While creating SQVI with logical database ( PNPCE - HR Master Record ), I found error at the time of saving "Global syntax check -> Selection Criteria -> Error in parameter PYPARAID
-
Oracle 8i Installation Repair Fails
I have Oracle 8i installed on my Windows XP Pro laptop. I start the listener service manually. I hadn't used it for a couple of months and tried to start my listener and it failed. So I tried to uninstall/reinstall Oracle (since none of the other Ora
-
Camera won't fonction since iOS 7
Reset 3 times my iPhone 4s, restored it back to manufacturer, did force the reset, and nothing worked... Did the same thing when iOS 6 came out but worked after reseting the whole thing, but not this time. Has anyone else got and solved this issue