How to write inline DTD to the xml file?
Hi All,
I have java program which outputs a xml file! Currently I need to alter this program to insert inline DTD code in the output xml file.
I want the xml file to look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE students[
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT ssn (#PCDATA)>
<!ELEMENT student (ssn, firstname)>
<!ELEMENT students (student+)>
]>
<students>
<student>
<ssn>444111110</ssn>
<firstname>Jacob</firstname>
</student>
</students>
Existing file is as below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE students SYSTEM "StudentsDTDfile.dtd">
<students>
<student>
<ssn>444111110</ssn>
<firstname>Jacob</firstname>
</student>
</students>
The DOCTYPE line can be inserted into the xml using transfomer output key but then that always is for external dtd.
It brings in the line <!DOCTYPE name SYSTEM " path"> .
But i need an internal DTD. SO it should look like
<!DOCTYPE name [<ELEMNETS>]>
I am using DocumentBuilder class.
Thanks in advance,
Mathew
Edited by: Mathew_Jacob on Jul 12, 2008 12:49 AM
Or If Labview schema is acceptable, it is fairly straight forward.
Beginner? Try LabVIEW Basics
Sharing bits of code? Try Snippets or LAVA Code Capture Tool
Have you tried Quick Drop?, Visit QD Community.
Similar Messages
-
How to write input data into an xml file
Hi All,
I have some input data and i have to write it
into an xml file.How is it possible send me some related
links regarding this and source code if any.Hi
Try to go through these links.I hope this will help you to solve your problem.
http://www.xml.com/pub/a/2003/07/09/udell.html
Thanks
Mrutyunjaya Tripathy -
How to parse and retrieve records from xml files into columns in Table
Hi
I attached the thing what i tried.
Table to hold the XML COntent:
create table xmlfile(xml_con sys.xmltype);
Inserting Xml file content into the Above table:
insert into xmlfile values(sys.xmltype.CreateXml('<Root><name>RAM</name><age>23</age></Root>'))
SQL> select * from xmlfile;
XML_CON
<Root>
<name>RAM</name>
<age>23</age>
</Root>
SQL> select extractValue(xml_con, '/Root/name') content from xmlfile;
CONTENT
RAM
This one works fine
But if the file content is as below( contains MUltiple Records)
insert into xmlfile values(sys.xmltype.CreateXml('<Root><Record><name>RAM</name><age>23</age></Record><Record><name>SAM</name><age>23</age></Record></Root>'))
SQL> select extractValue(xml_con, '/Root/Record/name') content from xmlfile;
ERROR at line 1:
ORA-19025: EXTRACTVALUE returns value of only one node
Can anyone help me 4 this issue-How to extract multiple records from the XML file inthis manner(from PL/SQL without using JAVA)
OR
If there is anyother way to do this please tell me?SQL> SELECT EXTRACTVALUE (COLUMN_VALUE, '//name') NAME,
EXTRACTVALUE (COLUMN_VALUE, '//age') age
FROM TABLE
(XMLSEQUENCE
(EXTRACT
(XMLTYPE
('<Root>
<Record>
<name>RAM</name>
<age>23</age>
</Record>
<Record>
<name>SAM</name>
<age>23</age>
</Record>
</Root>'
'/Root/Record'
NAME AGE
RAM 23
SAM 23
2 rows selected. -
How to use Xerces to validate an XML file against a DTD
Hi, can anybody tell me how to use Xerces to validate an XML file against a DTD. its urgent. post some sample code. it would be helpful for my project. isupposed to use SAX parser(Xerces)
Thanx in advanceCome on, I googled "xerces validate" and the first link is the Xerces FAQ:
http://xerces.apache.org/xerces-j/faq-general.html
And of course "how to validate" is a Xerces FAQ. Help yourself by doing a little research instead of waiting for other people. -
How to put color combination like red/blue tag in the XML file
Hi experts,
i have developed one program to capture some DATA in one internal table.it contains 2 fields called addition flag and dedletion flag.then i have wriiten the following code for converting the XML file for the above internal table data.i am passing this internal table in the following FM ''SDIXML_DATA_TO_DOM'.But as per our requirement,they need the REd color tag for addition flag and blue Color tag for the deletion flag in the Above XML File for the respective addition data item and deletion data item.how to do???
Any suggestion can be Appreciated.its very urgent
Thanx in advance.
Regards,
HPP.
The code is wriiten for converting internal table to XML file.
DATA: l_dom TYPE REF TO if_ixml_element,
m_document TYPE REF TO if_ixml_document,
g_ixml TYPE REF TO if_ixml,
w_string TYPE xstring,
w_size TYPE i,
w_result TYPE i,
w_line TYPE string,
it_xml TYPE dcxmllines,
s_xml LIKE LINE OF it_xml,
w_rc LIKE sy-subrc.
DATA: xml TYPE dcxmllines.
DATA: rc TYPE sy-subrc,
BEGIN OF xml_tab OCCURS 0,
d LIKE LINE OF xml,
END OF xml_tab.
*XML conversion -internal table to XML Format.
CLASS cl_ixml DEFINITION LOAD.
g_ixml = cl_ixml=>create( ).
CHECK NOT g_ixml IS INITIAL.
m_document = g_ixml->create_document( ).
CHECK NOT m_document IS INITIAL.
WRITE: / 'Converting DATA TO DOM 1:'.
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
name = 'it_prop'
dataobject = it_prop[]
IMPORTING
data_as_dom = l_dom
CHANGING
document = m_document
EXCEPTIONS
illegal_name = 1
OTHERS = 2.
IF sy-subrc = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
sy-subrc.
ENDIF.
CHECK NOT l_dom IS INITIAL.
w_rc = m_document->append_child( new_child = l_dom ).
IF w_rc IS INITIAL.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
w_rc.
ENDIF.
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
document = m_document
IMPORTING
xml_as_string = w_string
size = w_size
TABLES
xml_as_table = it_xml
EXCEPTIONS
no_document = 1
OTHERS = 2.
IF sy-subrc = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
sy-subrc.
ENDIF.
LOOP AT it_xml INTO xml_tab-d.
APPEND xml_tab.
ENDLOOP.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
bin_filesize = w_size
filename = 'C:\prop.XML'
filetype = 'BIN'
TABLES
data_tab = xml_tab
EXCEPTIONS
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.TailOfGon wrote:
Do you want to extract all the data with type='unknown'?
Then try the XPath like this:
resource[type='unknown']/code
Hi,
Yes I want to extract all the data of the type = "unknown", I tried Xpath resource[type='unknown']/code but it didnt work , I still getting all other data of different type .
Thanks,
Ankit G -
How can I skip the XML file's space & "\n" when using a DOM?
This is my xml file below:
<?xml version="1.0" encoding="UTF-8"?>
<inventory>
<item>
<sku>3965</sku>
<describtion>widget</describtion>
<quality>108</quality>
</item>
<item>
<sku>5478</sku>
<describtion>gadget</describtion>
<quality>101</quality>
</item>
<item>
<sku>4575</sku>
<describtion>sprocket</describtion>
<quality>106</quality>
</item>
</inventory>between the <inventory> and the<item>,there is one "\n" and tow "space" ,
then between the <item> and the <sku>,there is ...
on and on...
and this is my java code:
import javax.xml.parsers.*;
import org.w3c.dom.*;
public class DomDemo {
DocumentBuilderFactory dbf = null;
DocumentBuilder df = null;
Document doc = null;
public DomDemo() {
try {
dbf = DocumentBuilderFactory.newInstance();
dbf.setIgnoringElementContentWhitespace(true);
catch(FactoryConfigurationError fce) {
fce.printStackTrace();
try {
df = dbf.newDocumentBuilder();
catch(ParserConfigurationException pce) {
pce.printStackTrace();
public void printXML(Node node) {
short nodeTypeValue;
String nodeType = null;
Node currentNode = null;
nodeTypeValue = node.getNodeType();
nodeType = getNodeType(nodeTypeValue);
System.out.println("NodeType:" + nodeType);
System.out.println("NodeName:" + node.getNodeName());
System.out.println("NodeValue:" + node.getNodeValue());
for(currentNode = node.getFirstChild(); currentNode != null; currentNode = currentNode.getNextSibling()) {
printXML(currentNode);
public String getNodeType(short nodeTypeValue) {
String nodeType = null;
switch(nodeTypeValue) {
case Node.DOCUMENT_NODE:
nodeType = "DocumentNode";
break;
case Node.ELEMENT_NODE:
nodeType = "ElementNode";
break;
case Node.ATTRIBUTE_NODE:
nodeType = "AttributeNode";
break;
case Node.TEXT_NODE:
nodeType = "TextNode";
break;
default:
nodeType = "OtherNode";
return nodeType;
public static void main(String[] args) {
if(args.length == 0) {
System.out.println("Usage:java DomDemo filename");
System.exit(1);
String file = args[0];
DomDemo dd = new DomDemo();
Document doc = null;
try {
doc = dd.df.parse(file);
catch(Exception e) {
e.printStackTrace();
dd.printXML(doc);
}when run the class, the result is below:
NodeType:DocumentNode
NodeName:#document
NodeValue:null
NodeType:ElementNode
NodeName:inventory
NodeValue:null
NodeType:TextNode
NodeName:#text
NodeValue:
NodeType:ElementNode
NodeName:item
NodeValue:null
NodeType:TextNode
NodeName:#text
NodeValue:
It contains a TextNode and its value is " " and a "\n".
I used setIgnoringElementContentWhitespace feature, but it seems didn't work.
How can i solve it?I used setIgnoringElementContentWhitespace feature, but it seems didn't work.
Add a DTD to the XML document for setIgnoringElementContentWhitespace feature. -
How to add a internal dtd to my xml file
I am using the xml parser for PL/SQL, how can add a internal dtd to my xml file..
Thanks in advance...<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jinyu Wang ([email protected]):
Sorry, there is not an API to set internal DTD.
But you can set external DTD by using:
PROCEDURE setDoctype(doc DOMDocument, root VARCHAR2,sysid VARCHAR2, pubid VARCHAR2)<HR></BLOCKQUOTE>
Thanks for your replay...
null -
How to parse the xml file using servlet
My scenario is like this:
<b>FILE-->XI-->J2EE Application</b>
XI sends the xml file to j2ee application. My servlet receives the file in HTTPRequest string.
How to parse that file using servlets.I should get the xml file as it is and should be displayed in the browser.
Can anyone please help me with code, its urgent.
Please help me!Download this java code
http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/work/Echo02.java
in your servlet code you can write
public void doPost(req,resp){
DefaultHandler handler = new Echo02();
handler.parse(req.getInputStream());
Offcourse you will need to modify the code of Echo02 class a bit to suit your requirement which would finally retrun you a string and you can then write it using
respose.getWriter().write(responseString); -
How to overwrite the xml file...
Hi,
can any one help me how to overwrite the xml file.....
~~SkFlash Player cannot write XML files at all. but using
php+flash we could do it . -
I am in hurry,how to save the xml file without attributes
i have the following xml file with attributes,
<?xml version="1.0"?>
<Ve2.Configuration>
<Ve2.Displaymanager>
<type type="combobox">eVeDisplayStandardType</type>
<setCounter type="bool">false</setCounter>
<frames type="textfield">20</frames>
</Ve2.Displaymanager>
</Ve2.Configuration>
but i want to save it without attributes, that means, my saved xml file look like this.:
<?xml version="1.0"?>
<Ve2.Configuration>
<Ve2.Displaymanager>
<type >eVeDisplayStandardType</type>
<setCounter >false</setCounter>
<frames20</frames>
</Ve2.Displaymanager>
</Ve2.Configuration>
how can i do it with java.If you know the format of the XML file, then you can write a straight forward XSL file to transform it.
Paul
www.codetelligence.com -
How to read the attribute of the xml file using jaxb
Thanks,
Buddy as i have a issue i have to read the xml file using jaxb and xml file contains this data and i have read the attribute like name , desc and action for a particular menu name pls tell the code how to do this it will be a great favour to me
thanx in advance
Rasool
<contextmenu>
<menu name='Lead' >
<menuitem name='newlead' desc='New Lead' action='/leads.do?dispatch=insert' />
<menuitem name='editlead' desc='Edit Lead' action='' />
<menuitem name='leadinfo' desc='Lead Information' action='' />
</menu>
<menu name='Cases' >
<menuitem name='' desc='' action='' />
<menuitem name='' desc='' action='' />
<menuitem name='' desc='' action='' />
</menu>
<menu name='Contact' >
<menuitem name='' desc='' action='' />
<menuitem name='' desc='' action='' />
<menuitem name='' desc='' action='' />
</menu>
</contextmenu>What my program do is to get the encoding of XML files and convert them to UTF-8 encoding files, while I need this "encoding" information of the original XML document thus I can convert...
After reading specifications and JDOM docs, the truth turns to be disappointed, no function is provided to get this information in JDOM level 2(the current released one), while it's promissed that this function will be provided in JDOM level API....
Thanx all for your help and attention!!! -
How to edit the existing data in the XML file from java programming.
Hi all
i am able to create XML file with the sample data as below from java programming.
i need sample code on how to edit the existing data in the XML file?
for example
<?xml version="1.0"?>
<mydata>
<data1>
<key1>467</key1>
<name1>Paul</name1>
<id1>123</id1>
</data1>
<data2>
<key2>467</key2>
<name2>Paul</name2>
<id2>123</id2>
</data2>
</mydata>
i am able to insert the data in the XML.
now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code
Regards
Sunil
[points will be always rewardable]hi
u need a parser or validate the xml file for to read the xml file from java coding u need for this
xml4j.jar u can download this file from here
http://www.alphaworks.ibm.com/tech/xml4j
or we can use the SAX(simple API for XML)
some sample applications for this
http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html
http://www.xml-training-guide.com/e-xml44.html
let me know u need any other info
bvr -
How to create xforms binding-excaption of xml file in the xhtml source?
Hello,
is anyone here who could help me?
I've spent plenty of hours by searching the correct and suitable way for creating a binding exception in XForms, but I did not succeed...
My situation is: I've got an XHTML page with XForms and XML (input) file, which describes this page. Whenewer I change the input data in the XML file (for example there are tags <person> and ....</person> if I change it to <peson1> and ...</person1>) after saving the changes and refreshing the page, the XForms will be changed (for example some text fields are missing or they've got white background instead red one, which there was before et cetera). {I hope it is clear till now.....}
My task is: to create a xforms-binding-expression event, which will display an error message (for example: FILE HAVE BEEN CHANGED, CAN NOT DISPLAY THE PAGE PROPERLY) to the user.
i've found some stuff, how to create such message, but i need to know the exact order of commands to make it work, where to insert them, the structure etc, so I can comprehend your advices...
The XHTML file contains of several blocks - bind, model, submission, instance etc - and I do not actually know, where to insert such lines (with message)...I think I should make some bindings with the page loading, but I've got no idea how to get it done, however there are very few sites with such stuff on the internet. I hope this task is no big deal for you gyus, THANK YOU A LOT IN ADVANCEHello,
is anyone here who could help me?
I've spent plenty of hours by searching the correct and suitable way for creating a binding exception in XForms, but I did not succeed...
My situation is: I've got an XHTML page with XForms and XML (input) file, which describes this page. Whenewer I change the input data in the XML file (for example there are tags <person> and ....</person> if I change it to <peson1> and ...</person1>) after saving the changes and refreshing the page, the XForms will be changed (for example some text fields are missing or they've got white background instead red one, which there was before et cetera). {I hope it is clear till now.....}
My task is: to create a xforms-binding-expression event, which will display an error message (for example: FILE HAVE BEEN CHANGED, CAN NOT DISPLAY THE PAGE PROPERLY) to the user.
i've found some stuff, how to create such message, but i need to know the exact order of commands to make it work, where to insert them, the structure etc, so I can comprehend your advices...
The XHTML file contains of several blocks - bind, model, submission, instance etc - and I do not actually know, where to insert such lines (with message)...I think I should make some bindings with the page loading, but I've got no idea how to get it done, however there are very few sites with such stuff on the internet. I hope this task is no big deal for you gyus, THANK YOU A LOT IN ADVANCE -
How to get the XML file if we are using the Product short name.
Hi,
Till now I have used Short name of the Concurrent Program for Code while creating a Data Definition. Now saw a seeded template which has given the Code by Product short name. If we have the concurrent program then it is easy to refer the fields by checking the XML file. In this case how to find the XML file or how to refer all the fields if we have given code with Product short name. I saw this for iReceivables(ARI). Anybody please help me.
Thanks.Hi Siva
Just to clarify, rather than the short name of the conc program there is a shipped data definition that just uses the product short name? What is the data def so I can check it.
Regards, Tim -
OIM Reporting: How to pass a dynamic parameter in the xml file
Hi,
I am generating a custom report in OIM. My stored procedure is ready and I am getting the required data when I query the database. However,while displaying it through the xml file, I need to filter the fetched data by group name. The glitch present here is that the group name is dependent on the resource selected and so the group parameter is dynamic. How can I pass this dynamic group parameter in the xml file to filter the data. Which attributes are to be used. Can anyone please help me out regarding this?
Thanks in Advance,
SKThe OOTB OIM reporting mechanism does not support dependant LOVs, which is
what you are asking for.
Maybe you are looking for
-
Is there a way to create a group email list?
I am trying to set up a group email list so I don't need to restyle addresses every time. Easy to do in Outlook but how do I do it on my IPad?
-
I only have one Apple ID for my iPhone and my iPad and the iPad is definetly new. What can I do?
-
.DMP File Import Troubles.
I am trying to import a .DMP file from Oracle 9i (see below) using the Oracle Database Homepage (Oracle 10g Express Edition) and I received the following, error message: "Your export file is not supported." So, I believe the problem to be with the ch
-
it doesn't exist anywhere I can think of. Draft, Out, In of Mail or in the Lib/Mail folders. But every day or so a message goes out to my old email address that I haven't written. I rebuilt the Mailbox.
-
Asha 308 and MS Exchange client
Hello all, Nokia user since birth (or almost), I desperately searched for a dual-sim product... All I could find was the Asha series. So, foolishly, I bought the Asha 308 and now I realised that there is no MS Exchange client and therefore I can't ma