Write to an XML doc. --urgent..
Hi..
I am new to XML.Sorry for my simple question.
I am trying to create a Java application which writes to an existing XML document by creating a new element and its value (these values are taken from the Oracle db by JDBC).
Please help...!
null
Here are a couple of sample apps that might interest you:
Flight Finder http://technet.oracle.com/tech/xml/xsql_servlet/index2.htm?Code&files/ffhome.html
XML B2B Hotel http://technet.oracle.com/sample_code/tech/xml/xmlb2b/doc/xb2bhome.html
Enjoy,
-rh
Similar Messages
-
Reading & writting code for XML doc
I need help with writting a java code that will read the XML dopcument below & output it as given below. thanks.
<?xml version="1.0"?>
<!-- Employee expenses by department. -->
<firm>
<!-- Hmmm, suspicious. -->
<dept name="Accounting">
<emp name="Boswell" amt="437.46" />
<emp name="Austen" amt="124.07" />
<emp name="Johnson" amt="184.19" />
<emp name="Boswell" amt="423.99" />
<emp name="Keats" amt="321.14" />
</dept>
<!-- Why so much travel and always to Russia in summer? -->
<dept name="Finance">
<emp name="Tolstoi" amt="224.46" />
<emp name="Turgenev" amt="532.11" />
<emp name="Tolstoi" amt="149.08" />
<emp name="Gogal" amt="643.26" />
<emp name="Tolstoi" amt="265.91" />
</dept>
<!-- Marketing, smarketing -->
<dept name="Marketing">
<emp name="Mishima" amt="754.18" />
<emp name="Kawabata" amt="398.07" />
<emp name="Kawabata" amt="398.07" />
</dept>
<!-- High pay, high stress: deserve to travel -->
<dept name="Technology">
<emp name="Hesse" amt="156.44" />
<emp name="Handke" amt="174.21" />
<emp name="Hesse" amt="365.21" />
<emp name="Hesse" amt="452.33" />
</dept>
</firm>
OUTPUT:
Accounting
Austen --> $124.07
Bosworth --> $861.45
Johnson --> $184.19
Keats --> $321.14
Finance
Gogal --> $643.26
Tolstoi --> $639.45
Turgenev --> $532.11
Marketing
Kawabata --> $796.14
Mishima --> $754.18
Technology
Handke --> $174.21
Hesse --> $973.98
----------------------------------------------------/* INTERFACE */
import java.util.*;
import java.util.regex.*;
abstract public interface XMLInterface {
abstract public void parse(String file_name);
abstract public String getStartTag(String item);
abstract public String getEndTag(String item);
abstract public Map getAttributes(String item);
abstract public int getXMLType(String item);
public static final String start_tagSA =
"<[\\s]*[\\w]+[\\s]*>";
public static final String end_tagSA =
"</[\\s]*[\\w]+[\\s]*>";
public static final String pi =
"<\\?[\\W\\w\\s]*\\?>";
public static final String comment =
"<!--[\\s]*[\\W\\w]+[\\s]*-->";
public static final String elementSA =
"<[\\s]*[\\w\\W]+[\\s]*[]?>";
public static final String attribute =
"[:\\w]+[\\s]*=[\\s]*([\\'|\"])[\\w\\d\\.$\\s]+\\1";
public static final int XML_BAD_TYPE = 0;
public static final int XML_COMMENT = -1;
public static final int XML_ELEMENT = -2;
public static final int XML_PI = -3;
public static final int XML_START_TAG = -4;
public static final int XML_END_TAG = -5;
/* IMPLIMENTATION */
import java.io.*;
import java.util.*;
import java.util.regex.*;
public class ParserXML implements XMLInterface {
public void parse(String file_name) {
readFile(file_name);
compile_patterns();
Iterator it = records.iterator();
while (it.hasNext()) {
String next = (String) it.next();
int type = getXMLType(next = next.trim());
switch (type) {
case XMLInterface.XML_START_TAG:
System.out.println("Start tag: " + next);
String tag = getStartTag(next);
if (tag != null)
System.out.println("\tTag is " + tag);
break;
case XMLInterface.XML_END_TAG:
System.out.println("End tag: " + next);
break;
case XMLInterface.XML_ELEMENT:
System.out.println("Element: " + next);
Map m = getAttributes(next);
if (m != null) {
Set s = m.keySet();
Iterator iter = s.iterator();
while (iter.hasNext()) {
Object key = iter.next();
System.out.println("\tAttribute: " + key + " = " + m.get(key));
break;
case XMLInterface.XML_COMMENT:
System.out.println("Comment: " + next);
break;
case XMLInterface.XML_PI:
System.out.println("Processing instruction: " + next);
break;
default:
System.out.println("Bad XML type: " + next);
break;
public int getXMLType(String item) {
Matcher m = null;
m = start_tagSA.matcher(item);
if (m.matches()) return XMLInterface.XML_START_TAG;
m = end_tagSA.matcher(item);
if (m.matches()) return XMLInterface.XML_END_TAG;
m = elementSA.matcher(item);
if (m.matches()) return XMLInterface.XML_ELEMENT;
m = comment.matcher(item);
if (m.matches()) return XMLInterface.XML_COMMENT;
m = pi.matcher(item);
if (m.matches()) return XMLInterface.XML_PI;
return XMLInterface.XML_BAD_TYPE;
public String getStartTag(String item) {
Matcher m = start_tagSA.matcher(item);
if (m.find())
return m.group();
else
return null;
public String getEndTag(String item) {
return null;
public Map getAttributes(String item) {
Matcher m = attribute.matcher(item);
if (!m.find()) return null;
m.reset();
Map attributes = new HashMap();
int n = 0;
while (m.find(n)) {
String[ ] key_value = m.group().split("=");
attributes.put(key_value[0].trim(), key_value[1].trim());
n = m.end();
return attributes;
private void readFile(String filename) {
records = new ArrayList();
try {
BufferedReader input = new BufferedReader(new FileReader(filename));
String record = null;
while ((record = input.readLine()) != null)
records.add(record);
input.close();
catch(Exception e) {
e.printStackTrace();
System.exit(-1);
private void dump() {
Iterator it = records.iterator();
while (it.hasNext())
System.out.println(it.next());
private void compile_patterns() {
elementSA = Pattern.compile(XMLInterface.elementSA);
comment = Pattern.compile(XMLInterface.comment);
pi = Pattern.compile(XMLInterface.pi);
start_tagSA = Pattern.compile(XMLInterface.start_tagSA);
end_tagSA = Pattern.compile(XMLInterface.end_tagSA);
attribute = Pattern.compile(XMLInterface.attribute);
private List records;
private Pattern elementSA;
private Pattern comment;
private Pattern pi;
private Pattern start_tagSA;
private Pattern end_tagSA;
private Pattern attribute;
/* DRIVER */
class ParseDriver {
public static void main(String[ ] args) {
if (args.length < 1) {
System.out.println("ParseDriver <filename>");
return;
ParserXML parser = new ParserXML();
parser.parse(args[0]); -
Validating xml doc using schema
I was wondering if you can the following validation of an xml document using schema:
<parent>
<child>Jogn</child>
<child>Hanna</child>
<child>Blake</child>
<childCount>3</childCount>
<parent>the childcountValue equals the number of child node. is this possible using
schema or do do i have to use an application to do this?
thanx in advancethanx dvohra, but i already know how to validate schema using a parser.
I'm looking for a way in the schema that specified thhat the total number of child elemnt equals to the integer value of the childTotal element. I don't even know if this is possible. If possible, what (tag) would i use. i don't need answer..hint would be nice.
my other solution is to write an application that use a SAX parser to parse the xml doc. Although this is relatively easy, i would like to keep the validation within on file (the schema)..rather than have it be in the schema and a ContentHandler. -
How to show an XML doc's node?/element in a dynamic textbox?
Hello!
I would like to show an XML doc's node?/element in a textbox. I am importing the XML data from a PHP page. My code looks like this:
var xmlRequest:URLRequest = new URLRequest("adatatvitel.php");
var xmlLoader:URLLoader = new URLLoader(xmlRequest);
xmlLoader.addEventListener(Event.COMPLETE, init);
function init(e:Event):void{
var xmlDoc:XMLDocument = new XMLDocument();
xmlDoc.ignoreWhite = true;
var datasXML:XML = XML(xmlLoader.data);
xmlDoc.parseXML(datasXML.toXMLString());
This program would be a quiz. First I would like to write out the first data: Question with the appropriate Answers. If the player's answer is correct, the program would show the second set. Thanks in advance!
Here is my PHP code:
<?php
require("db.php");
$sql = "SELECT * FROM kerdesvalasz";
$result = mysql_query($sql) or die(mysql_error());
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<datas>";
while($row = mysql_fetch_array($result))
echo '<data>';
echo '<question>'.$row['kerdes'].'</question>';
echo '<answer1>'.$row['valasz1'].'</answer1>';
echo '<answer2>'.$row['valasz2'].'</answer2>';
echo '<answer3>'.$row['valasz3'].'</answer3>';
echo '<answer4>'.$row['valasz4'].'</answer4>';
echo '<correct>'.$row['helyes'].'</correct>';
echo '</data>';
echo "</datas>";
?>Hi Taly,
Florian is right, you need to knwo / set a maximum columns ( i assumed he actually mean column) so that content being displayed will be visible on form.
I would suggest you to reaccess to your solution again if this design and think what if you have 999 columns, how do you want to display the content in form .
I would suggest to transpose your content to display as row in form, and let the content to flow.
This should solve your issue.
Hope this helps.
regards,
Xiang Li -
Problems while writing xml doc to a file
Hi all , in my project (of distributed xml databases) i need to write the xml files from the main server to the clients.
These xml files i had formed by fragmenting one xml doc and i did the fragmentation using ....
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(new DOMSource(root),
new StreamResult(new FileOutputStream(outputFile)));
Now the problem is that on the client where these fragments reside..i m not able to do the indexing of the document properly ie...
some extra text nodes with no values are coming in the index...
i dont know how to deal wid the extra nodes that i m getting after parsing the file and craeting an index for the same..
may be its coz of the transformer func i m using....don know(???)
Note : i m fragmenting the xml files into text files using the above function and then sending thm to the client via sockets.
Also,after fragmenting i am getting sumthng like
<?xml version="1.0" encoding="UTF-8"?>
in all the files..is this a source of any problem....
plz reply soon....You have not described how you "index" the files and what you mean by that.
Are you processing them with SAX or DOM, or one of the variations of those means?
Is there a chance that the "extra" nodes are simply text nodes with newlines ("\n")? There are usually a lot of extra text nodes in a file each containing only one newline.
If you are using SAX, there is no requirement for the parser to collect all of the text inside an element into a single block before calling the characters method. You may get several calls to characters between the start of an element and the end. If you change parsers, you may even get a different number of calls, but the character data will always be the same.
Dave Patterson
As to the <?xml version="1.0" encoding="UTF-8"?> line, that is perfectly fine. It means that your file thinks it is valid XML. Whether or not it REALLY is valid depends on a validation of the file. -
Conversion of xml doc using xsl
hai,
i have a following xml document.i have to write a xsl template which only the content
between the <FUSIONHUB_MESSAGE> AND </FUSIONHUB_MESSAGE> TAGS.
CAN ANY BODY GIVE THE TEMPLATE FOR ME ?
I HAVE WRITTEN A TEMPLATE WHICH IS NOT WORKING PROPERLY.
HERE IS THE XML DOC:
<?xml version="1.0"?>
<FUSIONHUB>
<FUSIONHUB_INFO>
<FUSIONHUB_COMPANY_ID>s0001 </FUSIONHUB_COMPANY_ID>
<FUSIONHUB_REC_COMPANY_ID>r0001</FUSIONHUB_REC_COMPANY_ID>
<FUSIONHUB_MESSAGE_CATEGORY_CODE>m1</FUSIONHUB_MESSAGE_CATEGORY_CODE>
</FUSIONHUB_INFO>
<FUSIONHUB_MESSAGE>
<SALESORDER>
<ROW num="1">
<S_ORDER_NO>o19001</S_ORDER_NO>
<CLIENT_NO>c00001</CLIENT_NO>
</ROW>
<ROW num="2">
<S_ORDER_NO>o19002</S_ORDER_NO>
<CLIENT_NO>c00002</CLIENT_NO>
</ROW>
</SALESORDER>
</FUSIONHUB_MESSAGE>
</FUSIONHUB>
i just want the output like this:
<FUSIONHUB_MESSAGE>
<SALESORDER>
<ROW num="1">
<S_ORDER_NO>o19001</S_ORDER_NO>
<CLIENT_NO>c00001</CLIENT_NO>
</ROW>
<ROW num="2">
<S_ORDER_NO>o19002</S_ORDER_NO>
<CLIENT_NO>c00002</CLIENT_NO>
</ROW>
</SALESORDER>
</FUSIONHUB_MESSAGE>
nullI think your question is wrong.
XML parser is supposed to check for well-formness of a document, meaning make sure all the tags are open/closed properly. Optionally a parser can perform validations on a document based on its DTD. If there is no DTD available there is no validations required.
null -
How to write data to xml file?
Hi,
I have done a project which read data from a web then write in log file.
Now i want to write data in xml file.
how to write?
i read some java and xml tutorial, quite quite difficult.
Who can give a simple example with some comments?
If you also give some tips on learning java web services, i will be very appreciated.
Thanks
Yang BinChoose Xerces2.4 to serialize the DOM object is an option.
javac XercesTest.java -classpath xmlParserAPIs.jar;xercesImpl.jar;.
java -classpath xmlParserAPIs.jar;xercesImpl.jar;. XercesTest test.xml
below is the source file: XercesTest.java
//JAXP
import javax.xml.parsers.*;
import org.w3c.dom.*;
//APACHE SERIALIZE FUNCTION
import org.apache.xml.serialize.*;
class XercesTest
public static void main(String[] args) throws Exception
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse( new File( args[0] ) );
File f = new File( "copy_of_"+ args[0] );
OutputFormat format = new OutputFormat("xml","UTF-8",true ) ;
FileOutputStream fout = new FileOutputStream( f );
XMLSerializer ser = new XMLSerializer(fout, format );
ser.serialize( doc );
hope it's helpful
land -
Create XML docs with hierarchy of tags and attr defined in databaste tables
Hi,
My problem is a little unique one. I want the ability to define the structure of the XML document (i.e. the hierarchy of element tags and attribute names) in the database tables. The values of tags and attributes will also be populated at runtime in tables.
Then write some generic API that reads the structure of the XML document through the database tables and spits out an XML document based on this structure and values stored in the tables.
So, basically, I want the tag names and values both to be values in the database rather than the tag names being the columns in database tables.
With this I should be able to have one procedure/function that can serve the purpose of creating XML documents with different structures by just specifying that structure in the form of database tables.
Almost all the Oracle XML utilities I read about, create XML docs based on a SQL query with tag names being columns in the database tables. Any help will be highly appreciated.
Thanks,
MonikaWhich database release are you using...
The computed constructors feature of XQuery may help.
-Mark -
Error While Loading XMl Doc into Oracle Database 10g
Hi all,
I have a task that , I have to make a utillity by which we can load XML Doc into a Table. While searching on Internet i found following Procedure on ASK Tom
CREATE OR REPLACE
procedure insert_xml_emps(
p_directory in varchar2, p_filename in varchar2, vtableName in varchar2 )
as
v_filelocator bfile;
v_cloblocator clob;
l_ctx dbms_xmlsave.ctxType;
l_rows number;
begin
dbms_lob.createtemporary(v_cloblocator,true);
v_filelocator := bfilename(p_directory, p_filename);
dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
DBMS_LOB.LOADFROMFILE(v_cloblocator, v_filelocator,
dbms_lob.getlength(v_filelocator));
l_ctx := dbms_xmlsave.newContext(vTableName);
l_rows := dbms_xmlsave.insertxml(l_ctx,v_cloblocator);
dbms_xmlsave.closeContext(l_ctx);
dbms_output.put_line(l_rows || ' rows inserted...');
dbms_lob.close(v_filelocator);
DBMS_LOB.FREETEMPORARY(v_cloblocator);
end ;
when i try to run this procedure
BEGIN
insert_xml_emps('XML_LOAD','load.xml','IBSCOLYTD');
END;
it gaves me following Error
ORA-29532: java call terminated by uncaught java exception : Oracle.xml.sql.OracleXMLSQLException:No
rows to modify-- the row enclosing tag missing. Specify the correct row enclosing tag.
ORA-06512: at "SYS.DBMS_XMLSAVE", line 115
ORA-06512: at "EXT_TEST.INSERT_XML_EMPS", line 18
ORA-06512: at line 2
Can anyone describe me this error
Thanks.
Best Regards.SQL> /* Creating Your table */
SQL> CREATE TABLE IBSCOLYTD
2 (
3 ACTNOI VARCHAR2 (8),
4 MEMONOI NUMBER (7,0),
5 MEMODTEI DATE,
6 AMOUNTI NUMBER (8,0),
7 BRCDSI NUMBER (4,0),
8 TYPEI NUMBER (4,0),
9 TRANSMONI NUMBER (6,0)
10 );
Table created.
SQL> CREATE OR REPLACE PROCEDURE insert_xml_emps(p_directory in varchar2,
2 p_filename in varchar2,
3 vtableName in varchar2) as
4 v_filelocator BFILE;
5 v_cloblocator CLOB;
6 l_ctx DBMS_XMLSTORE.CTXTYPE;
7 l_rows NUMBER;
8 v_amount_to_load NUMBER;
9 dest_offset NUMBER := 1;
10 src_offset NUMBER := 1;
11 lang_context NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
12 warning NUMBER;
13 BEGIN
14 dbms_lob.createtemporary(v_cloblocator, true);
15 v_filelocator := bfilename(p_directory, p_filename);
16 dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
17 v_amount_to_load := DBMS_LOB.getlength(v_filelocator);
18 --- ***This line is changed*** ---
19 DBMS_LOB.LOADCLOBFROMFILE(v_cloblocator,
20 v_filelocator,
21 v_amount_to_load,
22 dest_offset,
23 src_offset,
24 0,
25 lang_context,
26 warning);
27
28 l_ctx := DBMS_XMLSTORE.newContext(vTableName);
29 DBMS_XMLSTORE.setRowTag(l_ctx, 'ROWSET');
30 DBMS_XMLSTORE.setRowTag(l_ctx, 'IBSCOLYTD');
31 -- clear the update settings
32 DBMS_XMLStore.clearUpdateColumnList(l_ctx);
33 -- set the columns to be updated as a list of values
34 DBMS_XMLStore.setUpdateColumn(l_ctx, 'ACTNOI');
35 DBMS_XMLStore.setUpdateColumn(l_ctx, 'MEMONOI');
36 DBMS_XMLStore.setUpdatecolumn(l_ctx, 'MEMODTEI');
37 DBMS_XMLStore.setUpdatecolumn(l_ctx, 'AMOUNTI');
38 DBMS_XMLStore.setUpdatecolumn(l_ctx, 'BRCDSI');
39 DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TYPEI');
40 DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TRANSMONI');
41 -- Now insert the doc.
42 l_rows := DBMS_XMLSTORE.insertxml(l_ctx, v_cloblocator);
43 DBMS_XMLSTORE.closeContext(l_ctx);
44 dbms_output.put_line(l_rows || ' rows inserted...');
45 dbms_lob.close(v_filelocator);
46 DBMS_LOB.FREETEMPORARY(v_cloblocator);
47 END;
48 /
Procedure created.
SQL> BEGIN
2 insert_xml_emps('TEST_DIR','load.xml','IBSCOLYTD');
3 END;
4 /
PL/SQL procedure successfully completed.
SQL> SELECT * FROM ibscolytd;
ACTNOI MEMONOI MEMODTEI AMOUNTI BRCDSI TYPEI TRANSMONI
28004125 251942 05-SEP-92 400 513 1 0
28004125 251943 04-OCT-92 400 513 1 0
SQL> -
Setting up a Form Application to write to an XML file on a local computer
First, I'm using Flash CS3, and Actionscript3.
I'm trying to set up a data collection form that will save
the results to a file that can later be imported into a database.
This is going to be in a Kiosk at a tradeshow and it won't have
internet access, so I can't send it to an online PHP or ASP, etc,
script.
The form also has several screens, so i thought I'd try to
use the Form Application (I know I can only have one frame on the
timeline when using this flash template with the data components).
I want to try and write the data to a XML file. All the information
I've found is for importing data from an XML file to a web server
rather than sending data to an XML file on a local computer.
I'm trying to use the XML connector,and an XML file that
resides in the same folder as my Flash file, but so far I've had
very little luck writing to that XML file. Do I need to set up a
dataset to send the form data to that will then send the data to an
XML Connector component that will then send the data to the XML
file. Should I use LoadVars instead, and if I do, will I have to
write to a script, or can it also write to an XML file.
If any one has a better idea to do this, please let me know.
Thanks.Hi,
Flash itself has no filewriting capabilities other then the
SharedObject
stuff.
But why can't you call a php script? You could install
apache, PHP and
MYSQL on the computer running the Flash app and get it all
into the
database in one go.
Otherwise you either need to get going with AIR (Adobe
Integrated
Runtime), or use a wrapper application like Adobe Director
(which has
tons of ways to write to file through it's plethora of
Xtras.) Director
may be 'a bit' hard on your budget if you only use it for
this purpose
though.
The XMLSocket is for connections to some server, local or
remote, not to
a file.
Manno
graphic_pawn wrote:
> First, I'm using Flash CS3, and Actionscript3.
>
> I'm trying to set up a data collection form that will
save the results to a
> file that can later be imported into a database. This is
going to be in a Kiosk
> at a tradeshow and it won't have internet access, so I
can't send it to an
> online PHP or ASP, etc, script.
>
> The form also has several screens, so i thought I'd try
to use the Form
> Application (I know I can only have one frame on the
timeline when using this
> flash template with the data components). I want to try
and write the data to a
> XML file. All the information I've found is for
importing data from an XML file
> to a web server rather than sending data to an XML file
on a local computer.
>
> I'm trying to use the XML connector,and an XML file that
resides in the same
> folder as my Flash file, but so far I've had very little
luck writing to that
> XML file. Do I need to set up a dataset to send the form
data to that will then
> send the data to an XML Connector component that will
then send the data to the
> XML file. Should I use LoadVars instead, and if I do,
will I have to write to a
> script, or can it also write to an XML file.
>
> If any one has a better idea to do this, please let me
know.
>
> Thanks.
>
Manno Bult
http://www.aloft.nl -
Generated XML doc file contains comments from MFC source code
Hello, in my project I use the option /doc to generate XML doc file from my source codes but unfortunately in the output XML file there are mixed also comments from original MFC source codes, see the part of generated xml file:
Is there a solution to ignore these MFC cpp files?
Many thanks
Regards
Petr Stejskal
<?xml version="1.0"?>
<style xmlns="http://www.w3.org/1999/xhtml">@namespace html url(http://www.w3.org/1999/xhtml); :root { font:small Verdana; font-weight: bold; padding: 2em; padding- } * { display: block; padding- } html|style { display: none; } html|span, html|a
{ display: inline; padding: 0; font-weight: normal; text-decoration: none; } html|span.block { display: block; } *[html|hidden], span.block[html|hidden] { display: none; } .expand { display: block; } .expand:before { content: '+'; color: red; } .collapse
{ display: block; } .collapse:before { content: '-'; color: red; } </style><doc><assembly><assembly>
"Console" </assembly></assembly><members><members><member name="T:_RS"><member
name="T:_RS">Reed-Solomon codec control block</member></member><member name="M:MMask_makeMask(System.Int32,System.Byte*,System.Int32,QRecLevel)"><member
name="M:MMask_makeMask(System.Int32,System.Byte*,System.Int32,QRecLevel)">Mode indicator. See Table 2 in Appendix 1 of JIS X0510:2004, pp.107.</member></member><member
name="M:CMFCControlRenderer.IsScaled"><member
name="M:CMFCControlRenderer.IsScaled"><summary><summary>Tells whether this control
renderer works with scaled (resized) images.</summary></summary><returns><returns>Returns TRUE if this control
renderer works with resized (scaled) images.</returns></returns></member></member><member name="M:CMFCControlRenderer.SmoothResize(System.Double)"><member
name="M:CMFCControlRenderer.SmoothResize(System.Double)"><summary><summary>
Smoothly resizes images.</summary></summary><param name="dblScale" /><param
name="dblScale"> Scale ratio.</param><returns><returns>
TRUE if resize succeeds; otherwise FALSE.</returns></returns></member></member><member name="M:CDrawingManager.CreateBitmap_32(HBITMAP__*,System.UInt32!System.Runtime.CompilerServices.IsLong)"><member
name="M:CDrawingManager.CreateBitmap_32(HBITMAP__*,System.UInt32!System.Runtime.CompilerServices.IsLong)"><summary><summary>
Creates a 32 bit bitmap from the specified bitmap.</summary></summary><returns><returns> A handle to created
bitmap, or NULL, if creation fails.</returns></returns><param name="bitmap" /><param
name="bitmap"> A handle to the original bitmap.</param><param name="clrTransparent"
/><param
name="clrTransparent"> An RGB value specifying transparent color of the original bitmap.</param></member></member><member
name="M:CDrawingManager.CreateBitmap_32(CSize!System.Runtime.CompilerServices.IsConst*!System.Runtime.CompilerServices.IsImplicitlyDereferenced,System.Void**)"><member
name="M:CDrawingManager.CreateBitmap_32(CSize!System.Runtime.CompilerServices.IsConst*!System.Runtime.CompilerServices.IsImplicitlyDereferenced,System.Void**)"><summary><summary>
Creates an empty 32 bit bitmap.</summary></summary><returns><returns> A handle to created bitmap, or NULL,
if creation fails.</returns></returns><param name="size" /><param
name="size">Specifies bitmap size.</param><param name="pBits" /><param
name="pBits">When the function returns contains a pointer to bitmap bits.</param></member></member><member
name="M:CDrawingManager.DrawRotated(CRect,CDC*!System.Runtime.CompilerServices.IsImplicitlyDereferenced,System.Int32)"><member
name="M:CDrawingManager.DrawRotated(CRect,CDC*!System.Runtime.CompilerServices.IsImplicitlyDereferenced,System.Int32)"><summary><summary>Rotates
a source DC content inside the given rectangle by +/- 90 degrees</summary></summary><param name="rectDest" /><param
name="rectDest">Destination rectangle</param><param name="dcSrc" /><param
name="dcSrc">The source device content.</param><param name="bClockWise"
/><param
name="bClockWise">TRUE - rotate +90 degrees, FALSE - 90.</param></member></member><member
name="M:AfxRegDeleteKey(HKEY__*,System.Char!System.Runtime.CompilerServices.IsConst*,ATL.CAtlTransactionManager*)"><member
name="M:AfxRegDeleteKey(HKEY__*,System.Char!System.Runtime.CompilerServices.IsConst*,ATL.CAtlTransactionManager*)"><summary><summary>Deletes
the specified registry key.</summary></summary><returns><returns> If the function succeeds, the return
value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h</returns></returns><param name="hKey" /><param
name="hKey">A handle to an open registry key.</param><param name="lpSubKey"
/><param
name="lpSubKey">The name of the key to be deleted.</param><param name="pTM" /><param
name="pTM">Pointer to CAtlTransactionManager object</param></member></member><member
name="M:AfxRegOpenKeyEx(HKEY__*,System.Char!System.Runtime.CompilerServices.IsConst*,System.UInt32!System.Runtime.CompilerServices.IsLong,System.UInt32!System.Runtime.CompilerServices.IsLong,HKEY__**,ATL.CAtlTransactionManager*)"><member
name="M:AfxRegOpenKeyEx(HKEY__*,System.Char!System.Runtime.CompilerServices.IsConst*,System.UInt32!System.Runtime.CompilerServices.IsLong,System.UInt32!System.Runtime.CompilerServices.IsLong,HKEY__**,ATL.CAtlTransactionManager*)"><summary><summary>Opens
the specified registry key.</summary></summary><returns><returns> If the function succeeds, the return
value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h</returns></returns><param name="hKey" /><param
name="hKey">A handle to an open registry key.</param><param name="lpSubKey"
/><param
name="lpSubKey">The name of a key that this function opens or creates.</param><param name="ulOptions"
/><param
name="ulOptions">This parameter is reserved and must be zero.</param><param name="samDesired" /><param
name="samDesired">A mask that specifies the desired access rights to the key.</param><param
name="phkResult" /><param
name="phkResult">A pointer to a variable that receives a handle to the openedkey.</param><param
name="pTM" /><param
name="pTM">Pointer to CAtlTransactionManager object</param></member></member></members>Hi stejsky,
Thank you for posting in MSDN forum.
>>In my project I use the option /doc to generate XML doc file from my source codes but unfortunately in the output XML file there are mixed also comments from original MFC source codes.
Based on your issue, could you please tell me how you use the option /doc to generate XML doc file from your source codes?
If you use the option /doc to generate the XML doc file by right-click the your MFC project->Properties->Configuration Properties->C/C++->Output file->set the Generate XML document files as Yes(/doc) like the following screen shot.
(1)If yes, since we could not reproduce your issue in mu side, so if possible, I suggest you could share me your MFC project so that we will further help you support this issue.
You could upload your MFC project to the OneDrive and then copy link here.
(2)If no, please try the above way to generate XML doc file and then check if you still get same issue.
Best Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Repository event handler doesn't work when inserting an xml-doc via ftp
Hi,
I want to add a 'schemaLocation'-attribute to an XML-document when I load it in the repository. Therefore, I use the precreate-repository event and created a Repository Event Handler (see code extract below).
Everything works fine if I type the following code in SQL Plus:
Declare
v_return BOOLEAN;
Begin
v_return:=DBMS_XDB.createresource('/public/xml/test.xml', XMLType(bfilename('XMLDIR', 'test.xml'),nls_charset_id('AL32UTF8')));
end;Unfortunately, when I try to insert an XML-document via ftp into the /public/xml folder it doesn´t work as expected and no 'schemaLocation'-attribute is added to the new resource.
What's the reason for this strange behavior and how can I solve it?
For your information: I use the Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Thank you very much for your help!!!
Repository Event Handler code extract:_
create or replace
PACKAGE BODY schemalocation AS
PROCEDURE handlePreCreate (eventObject DBMS_XEVENT.XDBRepositoryEvent) AS
XDBResourceObj DBMS_XDBRESOURCE.XDBResource;
var XMLType;
l_return BOOLEAN;
l_xmldoc dbms_xmldom.DOMDocument;
l_docelem dbms_xmldom.DOMElement;
l_attr dbms_xmldom.DOMAttr;
c1 clob;
node dbms_xmldom.DOMNode;
txid varchar2(100);
dDoc DBMS_XMLDOM.DOMDocument;
nlNodeList DBMS_XMLDOM.DOMNodeList;
BEGIN
XDBResourceObj := DBMS_XEVENT.getResource(eventObject);
dbms_lob.createTemporary(c1,TRUE);
var:=DBMS_XDBRESOURCE.getcontentxml(XDBResourceObj);
l_xmldoc := dbms_xmldom.newDOMDocument(var);
l_docelem := DBMS_XMLDOM.getDocumentElement(l_xmldoc);
------ add schemaLocation attribute
l_attr := DBMS_XMLDOM.createAttribute(l_xmldoc, 'xsi:schemaLocation');
DBMS_XMLDOM.setValue(l_attr, 'urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd');
l_attr := DBMS_XMLDOM.setAttributeNode(l_docelem, l_attr);
DBMS_XMLDOM.WRITETOCLOB(l_xmldoc, c1);
------- get the value of the TxId-tag
dDoc := DBMS_XMLDOM.NEWDOMDOCUMENT(c1);
nlNodeList := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(dDoc, 'TxId');
node := DBMS_XMLDOM.ITEM(nlNodeList, 0);
txid:= dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(node));
l_return:=DBMS_XDB.createresource('/public/ok/'||txid||'.xml', XMLType(c1));
END;Marco,
Here's an example of the problem :
create or replace package handle_events
as
procedure handlePreCreate(p_event dbms_xevent.XDBRepositoryEvent);
end;
create or replace package body handle_events
is
procedure handlePreCreate (p_event dbms_xevent.XDBRepositoryEvent)
is
XDBResourceObj dbms_xdbresource.XDBResource;
doc XMLType;
res boolean;
begin
XDBResourceObj := dbms_xevent.getResource(p_event);
doc := dbms_xdbresource.getContentXML(XDBResourceObj);
select insertchildxml(
doc
, '/root'
, '@xsi:schemaLocation'
, 'urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd'
, 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
into doc
from dual;
res := dbms_xdb.CreateResource('/public/xml/result.xml', doc);
end;
end;
declare
res boolean;
begin
res := dbms_xdb.CreateFolder('/public');
res := dbms_xdb.CreateFolder('/public/tmp');
res := dbms_xdb.CreateFolder('/public/xml');
end;
declare
res boolean;
resconfig xmltype;
my_schema varchar2(30) := 'DEV';
resconfig_path varchar2(300) := '/public/ResConfig.xml';
resource_path varchar2(300) := '/public/tmp';
begin
resconfig := xmltype(
'<ResConfig xmlns="http://xmlns.oracle.com/xdb/XDBResConfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/XDBResConfig.xsd http://xmlns.oracle.com/xdb/XDBResConfig.xsd">
<event-listeners set-invoker="true">
<listener>
<description>My event handler</description>
<schema>'||my_schema||'</schema>
<source>HANDLE_EVENTS</source>
<language>PL/SQL</language>
<events>
<Pre-Create/>
</events>
<pre-condition>
<existsNode>
<XPath>/r:Resource[r:ContentType="text/xml"]</XPath>
<namespace>xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd"</namespace>
</existsNode>
</pre-condition>
</listener>
</event-listeners>
<defaultChildConfig>
<configuration>
<path>'||resconfig_path||'</path>
</configuration>
</defaultChildConfig>
</ResConfig>'
res := dbms_xdb.CreateResource(resconfig_path, resconfig);
dbms_resconfig.addResConfig(resource_path, resconfig_path, null);
end;
/Giving the following input XML file :
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>This works :
SQL> declare
2 res boolean;
3 begin
4 res := dbms_xdb.CreateResource('/public/tmp/test.xml',
5 xmltype(bfilename('TEST_DIR','test.xml'), nls_charset_id('AL32UTF8')));
6 end;
7 /
PL/SQL procedure successfully completed.
SQL> select XMLSerialize(document xdburitype('/public/xml/result.xml').getXML()
as clob indent size = 2) result
2 from dual
3 ;
RESULT
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd
"/>With the same document loaded via FTP, we get :
SQL> select XMLSerialize(document xdburitype('/public/xml/result.xml').getXML()
as clob indent size = 2) result
2 from dual
3 ;
ERROR:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00283: document encoding is UTF-16-based but default input encoding is not
Error at line 1
no rows selectedand the content looks like :
< ? x m l v e r s i o n = " 1 . 0 " e n c o d i n g = " u t f - 8 " ? >
< r o o t x m l n s : x s i = " h t t p : / / w w w . w 3 . o r g / 2 0 0 1 / X M L S c h e m a - i n s t a n c e " / >As a workaround, I've found that serializing and re-parsing the document solves the problem :
select insertchildxml(
xmltype(doc.getclobval())
, '/root'
, '@xsi:schemaLocation'
, 'urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd'
, 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
into doc
from dual;
...We then get the expected result after FTP transfer :
SQL> select XMLSerialize(document xdburitype('/public/xml/result.xml').getXML()
as clob indent size = 2) result
2 from dual
3 ;
RESULT
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd
"/>The workaround also works for the DOM version presented above.
Any ideas? -
Java stored proc performance parsing XML docs
Hi
We are using ORACLE 8i(8.1.6). I have a JAVA Stored procedure that parses XML doc and returns tha values. If I am testing on the box, I get an avg. return time of 2 secs. If I have 20 users, my return time for all went to 25 to 35 secs?
Are there any parameters on ORACLE I can modify to increase the performance. We are developing app for 1000 to 1500 users. I dont want to guess the time based on my test with 20 users.
Any help will be greatly appreciated.
Thank You
RajuRaju,
Oracle 8.1.7 should be better choice for you since it does have the XML stuff
natively compiled.
Regarding scaleability the JVM should scale
very well. However let us know what you find.
- Stefan -
How to write and read Xml file from database if possible?
Hi all,
I need to read the .Xml file when receives from Source systems and write the data into the table as well as write in the.xml file thru reading the data from table as per the client needs. I am stranger to this area. Since, please provide some examples how to approach the same.
Thanks in advance !!
Regards.
Vissu.....The XML DB forum is better suited to your question.
It also has a FAQ which details how to read and shred XML into tables as well as other common XML based questions...
XML DB FAQ -
Problem inserting XML doc (character set)
Hi all,
I'm having trouble trying to insert XML either "posting" it (xsql) or "putting" it
(OracleXML putXML).
The error that I get: "not supported
oracle-character-set-174".
The environment is:
Oracle 8i 8.1.5
(NLS_CHARACTERSET EL8MSWIN1253 for greek)
JDK 1.2.2
Apache Web Server 1.3.11
Apache JServ 1.1
XSQL v 0.9.9.1 and
XMLSQL, XML parser v2 that comes with it.
I had dropped all java classes and reloaded
them using oraclexmlsqlload batch file.
But still getting the same error.
The thing that is that I am
able to insert XML doc that was generated
with an authoring tool called W4F that extracts data from HTML pages and map them to
XML document, even with greek characters
in it. But when XML is generated using
an editor or the servlet like the following:
newschedule.xsql like
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="latestschedules.xsl"?>
<page connection="dtv" xmlns:xsql="urn:oracle-xsql">
<xsql:insert-request date-format="DD'/'MM'/'YYYY" table="schedule_details_view"
transform="request-to-newschedule.xsl"/>
<xsql:query table="schedule"
tag-case="lower" max-rows="5" rowset-element="latestschedules"
row-element="schedule">
select *
from schedules
order by schedule_id desc
</xsql:query>
</page>
request-to-newschedule.xsl like
<?xml version = '1.0'?>
<ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0">
<xsl:for-each select="request/parameters">
<ROW>
<SCHEDULE_ID><xsl:value-of select="Schedule_id_field"/></SCHEDULE_ID>
<DESCRIPTION><xsl:value-of select="Description_field"/></DESCRIPTION>
<DETAILS>
<DETAILS_ITEM>
<STARTING_TIME><xsl:value-of select="Starting_Time_field_1"/></STARTING_TIME>
<DURATION><xsl:value-of select="Duration_field_1"/></DURATION>
</DETAILS_ITEM>
<DETAILS_ITEM>
<STARTING_TIME><xsl:value-of select="Starting_Time_field_2"/></STARTING_TIME>
<DURATION><xsl:value-of select="Duration_field_2"/></DURATION>
</DETAILS_ITEM>
<DETAILS_ITEM>
<STARTING_TIME><xsl:value-of select="Starting_Time_field_3"/></STARTING_TIME>
<DURATION><xsl:value-of select="Duration_field_3"/></DURATION>
</DETAILS_ITEM>
<DETAILS_ITEM>
<STARTING_TIME><xsl:value-of select="Starting_Time_field_4"/></STARTING_TIME>
<DURATION><xsl:value-of select="Duration_field_4"/></DURATION>
</DETAILS_ITEM>
<DETAILS_ITEM>
<STARTING_TIME><xsl:value-of select="Starting_Time_field_5"/></STARTING_TIME>
<DURATION><xsl:value-of select="Duration_field_5"/></DURATION>
</DETAILS_ITEM>
</DETAILS>
</ROW>
</xsl:for-each>
</ROWSET>
Hope that someone could help me on this ...
Any advice is highly appreciated.
Thanks in advance
Nicos Gabrielides
email: [email protected]Hi,
How about applying an XSL on the existing XML doc to create another XML doc to filter out the table column not found in the target db table, so that all the columns are matched and then use putXML to load?
Hope that helps.
OTN team@IDC
Maybe you are looking for
-
Gross Weight Unit of Measure (MARA-GEWEI) SAP ECC 6.0
Hi There, We use something called IPC for sales over the Internet. IPC is showing the customers our materials from the material master in KG and we need to show them in LB. The reason this is happening is because the materials are created in Europe a
-
Migration of TIME capsule backups
How do I migrate the old files to new TC so that I do not lose my previous revision history? (I bought a new 1TB time capsule to replace an old 500GB TC. I also want to start using the new larger TC by itself, and don't want to wipe the old TC files.
-
Hi, I have problem wit printing SFCs after releasing the ShopOrder. We have Loftware in use. I have SO qty of 100. Then I release all SFCs. Depending on document settings (print by SFC / SO) I either get 1. One file with all SFCs information 2. One f
-
CREATIVE VISION: M 30GB (NO SOFTWARE)
My friend gave me a 30GB Creative Zen Vision:M & lost the software. It had been opened once. Can I somehow download the software (Installation CD)
-
Standard funtion module to fetch IDOC in xml format
Hi Experts I am not from ABAP background, am working in SAP PI. I have a queay regarding standard function modules in ABAP. I am wrote a java code to fetch IDOC by making a call to the ABAP standard functions. (passing an idoc number and fetching the