End of XML file without root element
how can i know when the end of a XML file is reached if there is no root element, im using kxml.
<element id="12" nom="dan"/>
<element id="32" nom="eco"/>
<element id="34" nom="juar"/>i can parse it without no problem but when it reaches the last element it throws an exception when calling to nextTag() method, how can i knwo when stoping reading...
while(???????????)
code....
}
Read the document with DOM, and append the new children, then use an empty transformer to write ti out.
Similar Messages
-
How to use SAX Parseto paser xml without root element
Hello,
I have big a xml file(500M) with without root element. How can I use SAXParse to parse it.A well-formed XML file has a single root element. Your parser can't deal with any other kind. So find the person who produced that file and explain politely that it's no good. (Hitting them with a big stick would be optional.)
You could write a non-XML program that reads it in and creates a new version, wrapped in a single root element, if your supplier can't fix their problem. -
i have an existing file called CDlist.xml which contains of xml database the following nodeset taken from the file:
<CDlist>
<CD>
<artist>john</artist>
<title>first</title>
<number>6</number>
<CD>
<CD>
<artist>mark</artist>
<title>secound</title>
<number>61</number>
<CD>
</CDlist>then i want to write a new nod set to the end of that file without lossing the existing data so if we add the following node set to it :
<CD>
<artist>sarah</artist>
<title>final</title>
<number>4</number>
<CD>then the output result will look like the following :
please tell me how can i do it in java
<CDlist>
<CD>
<artist>john</artist>
<title>first</title>
<number>6</number>
<CD>
<CD>
<artist>mark</artist>
<title>secound</title>
<number>61</number>
<CD>
<CD>
<artist>sarah</artist>
<title>final</title>
<number>4</number>
<CD>
</CDlist>Read the document with DOM, and append the new children, then use an empty transformer to write ti out.
-
Transforming xml file with different elements into HTML
hi all !
i have an xml object that has been generated from database using java. the xml file has numerous elements that have been merged into single file. all elements have been got from different table :-
<?xml version = '1.0' ?>
<ROWSET>
<ROW id= "1">
<EMPID>1</EMPID>
<EMPADDRESS>H 3 STREET 4</EMPADDRESS>
<EMPPHONE>98764653</EMPPHONE>
</ROW>
<ROW id="2">
<EMPID>5</EMPID>
<EMPQUAL>GRADE 12</EMPQUAL>
<EMPGRADE>A</EMPGRADE>
</ROW>
</ROWSET>
(its just a sample data, might not be wel formed)
as it shows that each element "ROW" has data corresponding to different employee and with different details. actually these elemnt are the updates in an employee profile that have to be communicated to a distant located database. what i need is a tranformation into HTML so that the recieving user can view this file as html with relative headings of corresponding tables.
(the schema at both ends is exact replica)
any help in this regards would be obliging.thank you bro!
the xml file has been created by importing multiple files resulted from XSU into a master file in java. we are running a web based project in a distributed environment. so i would need to make this page appear in a web browser with ACCEPT and REJECT command buttons as the receiver is the approving agent. what all i have thought of so far is to create a style sheet with templates of all heading of each table from where the data is coming from and then run a check on what table the data is from and place that specific heading on the entry. the style sheet would be placed at both ends so only the xml file will be transported and transformation would be done auto.
i hope it works. but am not sure wether its the right approach or not. -
Reload web-inf/web.xml file without restarting tomcat
Please help me if any one have a solution .
I am doing development in jsp, servlet. I am using tomcat5 as a webserver.
i want to reload web-inf/web.xml file without restarting tomcat.From the tomcat admin page you can stop/start and refresh individual applications. See the tomcat documentation. Which, when you have a question about tomcat, you should always do first.
-
I am wondering if there is a way to validate XML file without using the <!DOCTYPE... but pass in the location of the schema/DTD file as a parameter to a validating method?
thanksNone that I know of. The only thing close is to use the EntityResolver interface where you can modify the location of the DTD file before it's being loaded and parsed, but that requires a <!DOCTYPE ...> in the XML file.
Good luck. -
Upload of Customs Duty Rates (xml file) without transport request creation
Hi All
Can we upload the Customs Duty Rates (xml file) without transport request directly in the system.
Thanks & Best Regards
KiranHi Kiran,
Please check transaction & program /SAPSLL/TLC_CUSB_UPL in GTS.
This allows you to upload the XML from a local source or an application server path.
I do not think a transport request is required in this scenario.
Best Regards,
Eoin -
Validate xml with complextype schema without root element!
Hi All!
I have a problem that. I want to validate a xml data of complextype but the schema i want to validate is[b] not have root element.
For example:
The schema like that
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="www.thachpn.test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="www.thachpn.test" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="Name">
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
and the xml data i want to validate like this
<?xml version="1.0" encoding="UTF-8"?>
<Name xmlns="www.thachpn.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FirstName>Pham</FirstName>
<LastName>Thach</LastName>
</Name>
My Algorithm is like that:
I create a complextype object by above schema
then i create new element with given name and namespace
after that i use schema of this element to validate xml data.
I use xmlparserv2 lib of oracle
But i can not find how to create complextype from schema or create element with have complextype.
Please help me.
Thanks a lot!<?xml version="1.0" encoding="UTF-8"?>
Modify the schema.
Add a root element.
<xs:schema targetNamespace="www.thachpn.test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="www.thachpn.test" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:element name="Name" type="Name"/>
<xs:complexType name="Name">
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema> -
Insert a xml file without assigning the tablename in the xmldb
hi guys,
here comes a interesting question,
after I registed a xml schema in oracle xml db, oracle create several tables depending on the schema, then I want to insert a xml file that is valided with the register schema and this xml file point to the "schemaurl" .
If its possible to insert this xml file to oracle xmldb without point out the exact table name in the java program ( in oci driver or thin driver ).
BTW, I can copy this xml file to oracle xml db repository, oracle insert it to xml table automatically.
Mark, would you please give me some advice ;-)
ThanksYou can call it from JDBC using thin or thick. Thick is preferred...
package com.oracle.st.xmldb.pm.examples;
import com.oracle.st.xmldb.pm.common.baseApp.BaseApplication;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleResultSet;
import oracle.jdbc.OracleTypes;
import oracle.xdb.XMLType;
public class CreateResource extends BaseApplication {
public CreateResource() {
public void doSomething(String[] Args) throws Exception
OracleCallableStatement statement = null;
String statementText;
statementText =
"declare" +
" res varchar2(5);" +
"begin " +
" if (dbms_xdb.createResource(:1,:2)) then " +
" res := 'TRUE';" +
" else" +
" res := 'FALSE';" +
" end if;" +
" :3 := res;" +
"end;";
XMLType xml;
// In the real world we would get an InputStream from something more interesting that
// an in memeory String
String xmlText = "<Root><Element Attr=\"AttrValue\">A text Node</Element></Root>";
byte[] byteBuffer = xmlText.getBytes();
InputStream is = new ByteArrayInputStream(byteBuffer);
xml = XMLType.createXML(this.getConnection(),is);
statement = (OracleCallableStatement) getConnection().prepareCall(statementText);
statement.registerOutParameter(3,OracleTypes.VARCHAR);
statement.setString(1,"/public/test1.xml");
statement.setObject(2,xml);
boolean res = statement.execute();
String plsqlResult = statement.getString(3);
System.out.println("The result is " + plsqlResult);
statement.close();
getConnection().commit();
getConnection().close();
public static void main (String[] args)
try
CreateResource example = new CreateResource();
example.initializeConnection();
example.doSomething(args);
catch (Exception e)
e.printStackTrace();
} -
Splitting XML Files without namespaces
Hello,
I have a file that looks similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<File>
<Header>
<Location>Phoenix</Location>
<Date>052214</Date>
</Header>
<Bill></Bill>
<Trailer>
<Total>1076</Total>
</Trailer>
</File>
What I would like to do is split the file (<Bill> is repeating) and I understand I should be able to do this with an envelope schema. I've done some research and every example I'm coming across happens to have a namespace in the sample schema.
How can I accomplish the same thing without the namespace?
Do I need to add the namespace using the ESB Toolkit, and if so, am I supposed to add a namespace to the repeating element? I looked into that solution and couldn't understand how to add a namespace to the Bill element, only the root. Unfortunately I trashed
that approach and went with an orchestration. While that is working, it just doesn't seem right if I can accomplish this task in the receive stage.
Any help/encouragement would be appreciated.The problem is that if you split the message on an element that has no namespace, you will need a Schema without namespace (in your case with a root element of "Bill" and no namespace).
Having Schemas without namespaces in BizTalk is bad practice and should, in general and if possible, be avoided.
So what I would do is create a custom Pipeline Component that (either using XDocument, XMLDocument or Regular Expression) appends a namespace to all "Bill" elements and also a namespace to the Root.
Apply the Component in the Decode Stage on your Receive Pipeline so that it is applied BEFORE the disassemble stage, and then create your "Bill" Schema with the newly appended Namespace, and also Apply the Batch namespace to your Envelope Schema.
An Example:
<?xml version="1.0" encoding="UTF-8"?>
<b:File xmlns:b="http://Batch">
<Header>
<Location>Phoenix</Location>
<Date>052214</Date>
</Header>
<c:Bill xmlns:c="http://namespace"></c:Bill>
<c:Bill xmlns:c="http://namespace"></c:Bill>
<c:Bill xmlns:c="http://namespace"></c:Bill>
<c:Bill xmlns:c="http://namespace"></c:Bill>
<Trailer>
<Total>1076</Total>
</Trailer>
</b:File>
Morten la Cour -
Loading XML file with missing elements dynamically through ODI
Hi Guys ,
I have the below xml file with two nodes Employee and Address. On a daily basis , sometimes the address element might not come in from the source xml file , but my interface has columns mapped to address elements, and hence it can fail due to the source element not being found in the file or data might not get loaded due to the 'and' condition in the sql query generated between the employee and address elements. Is there a way where i can load the data dynamically where i can search in the file only for the elements (Employee) present and load data only for those elements dynamically?
XML File:
<?xml version="1.0" encoding="UTF-8" ?>
<EMP>
<Empsch>
<Employee>
<EmployeeID>12345</EmployeeID>
<Initials>t</Initials>
<LastName>john</LastName>
<FirstName>doe</FirstName>
</Employee>
<Address>
<WorkPhone>12345</WorkPhone>
<WorkAddress>Test 234</WorkAddress>
</Address>
</Empsch>
</EMP>
Thanks ,
Revanth TambisettyI was able to resolve it by using left outer joins and referring the table structure from the XSD
-
Adding EOF to XML file without using FCC
Hello Experts,
I have a simple File to File scenario with source and target files being XML and simple mapping (No content conversion necessary). The issue which I face is described below:
File is written by receiver File Adapter on the unix system, a third party Unix script tries to read the file and faces problems which they report is because the file is not ended correctly. When we try to open the files using vi editor, we also get a warning: [Last line is not complete].
As a temporary solution the script is making sure the line is ended correctly. Can you advice me how from PI side I can make sure that the file ends properly. I was thinking to write a shell script and add it as a OS post processing command but I am not sure whether that will work and whether that is the best solution.
Also the file name is generated dynamically using time stamps in the receiver side. Version of PI is 7.0 SP16
Best Regards,
PratikHi,
When PI sends target file to file,it definely wellformed XML,anyway you are sending XML file.
If you are nor using any mapping,,just copying file from one to other,then problem with test data,may be source data doesnot have EOF tag.
check/test in message mapping,it gives valid xml structures in out put,then problem with your data.
Regards,
Raj -
Include attachments in a xml file without using mail adapter
Hello Experts,
Is there a way to include attachments like pdf or excel in a xml file?
It is a file to file scenario in which i have to include the attachment in the output file.
Thanks and regards,
MerrillyHi,
Check this links,
PDF
SAP Network Blog: XI: Read data from PDF file in Sender Adapter
/people/sap.user72/blog/2005/07/31/xi-read-data-from-pdf-file-in-sender-adapter
SAP Network Blog: XI: Generate PDF file out of file adapter
/people/sap.user72/blog/2005/07/27/xi-generate-pdf-file-out-of-file-adapter
EXCEL FILES
SAP Network Blog: XI: Generating Excel files without the Java nor the Conversion agent not possible?
/people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible
SAP Network Blog: Read Excel instead of XML through FileAdapter
/people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter
Regards,
Phani
Reward points if Helpful -
How to include xml file without embedding in flex web application?
Hi
I have a big XML file around 11 mb. I want to include this xml in my web application without embedding.
So anyone have idea to include.
Please suggest me any idea.
ThanksIf you don't want to embed the XML file into a SWF, then the SWF can download the XML file from the server at runtime when it needs it. But there will be a delay while that happens. Maybe it would be better to put the data in the XML file into a database and then access only the parts of it that you need.
Gordon Smith
Adobe Flex SDK Team -
Target XML Files with optional elements
Hi All,
I am using ODI 10.1.3.4. My task is to create an XML file of the following format:
<parent count="2">
<child>
<name>Fred</name>
<age>15</age>
<email>[email protected]</email>
</child>
<child>
<name>Bob</name>
<age>5</age>
*<email />*
</child>
</parent>
I have been able to successfully create a target file. But the file does NOT contain the empty elements. ie the email element for Bob is missing from my target file.
Is there any way to configure the XML connection or the "create xmlfile" command to output the empty element?
Many Thanks
NatAfter speaking to BEA support it appears as though there is a partial solution to this issue. If you add the attributes minOccurs="0" nillable="true" to the elements then the SOAP message is correct. i.e.
<xs:complexType name="SIDSearchCriteriaStructure">
<xs:sequence>
<xs:choice>
<xs:element ref="SIDUniqueReference" minOccurs="0" nillable="true"/>
<xs:element ref="SIDOtherCriteria" minOccurs="0" nillable="true"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
I say that this is only a partial fix because elements cannot have minOccurs and nillable attribtes when they are references (as opposed to named elements - e.g. <xs:element name="SIDDNA" type="RestrictedStringType"/>). This is according to XMLSpy anyway. Don't know whether it's W3C legal though.
Nick
Maybe you are looking for
-
Extracting Zoomed in views from PDFs to create new ones.
I recently purchased Acrobat for use with my small business. We wanted an easy way to go from blueprints in a large PDF to blown up shots of portions of certain pages (each blown up shot being its own page) in a new PDF. I really feel like there i
-
Error while setting up a new employee
Hi All, While we are setting up a employee using administrator responsibiity we are facing some errors There has been an error processing this person The error encountered is ORA-20001 ORA-06508 PL/SQL: could not find program until being called Pleas
-
display has broken and i have to replace my iphone 5 , there is any procedure to do this if yes then please help
-
I made a book in iphoto and for some reason there is a yellow warning triangle at the top of every picture and page (evens pages with only words that do fit in the box). And when I try to preview the book it loads halfway then comes up with a notice
-
BRFplus + BPM + ABAP Webdynpro Architecture
Hi Gurus, We are setting up Data Governance model in our company. As a part of this, we are currently evaluating various options. We are also considering BRF plus solution. Some of our high level requirements are as follows 1. Break SAP transact