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
Nat
After 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
Similar Messages
-
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
-
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. -
Sending XML Files with Certificate
Hello everybody.
I need develop an abap program for sending XML files with a certificate.
How I can create this certificate?
Somebody have an idea?
Thank you everybody.
NelsonMikael,
This sounds like one of the many quirks (perhaps bugs) related to how FrameMaker handles non-FM files in books. The current book model doesn't play well with XML files as chapters and this seems like yet another problem. Apparently, if an xref does not target another .fm file in the book, Frame assumes that the target file is not in the book and therefore will not be in the book PDF.
There have been discussions here about this in the past. The solution that I use is to run an API client before publishing that converts all XML files to .fm files, and redirect all xrefs appropriately. Then, book features work as expected and PDFs come out as normal. This is not feasible, however, without the automation from the API client.
There may be some who would say that the best approach is to use XML and books the way that the designers did account for... that is, the whole book becomes an XML document with entity references to the separate chapters. In my work, though, this model was not appropriate... rather, I needed a binary FM book to act like a book, except with XML files as chapters. So, I think I understand your situation.
Is API programming or FrameScript an option for you? I think it may be the only way to get what you are looking for.
Russ -
Create xml file with values from context
Hi experts!
I am trying to implement a WD application that will have some input fields, the value of those input fields will be used to create an xml file with a certain format and then sent to a certain application.
Apart from this i want to read an xml file back from the application and then fill some other context nodes with values from the xml file.
Is there any standard used code to do this??
If not how can i do this???
Thanx in advance!!!
P.S. Points will be rewarded to all usefull answers.
Edited by: Armin Reichert on Jun 30, 2008 6:12 PM
Please stop this P.S. nonsense!Hi,
you need to create three util class for that:-
XMLHandler
XMLParser
XMLBuilder
for example in my XML two tag item will be there e.g. Title and Organizer,and from ur WebDynpro view you need to pass value for the XML tag.
And u need to call buildXML()function of builder class to generate XML, in that i have passed bean object to get the values of tags. you need to set the value in bean from the view ui context.
Code for XMLBuilder:-
Created on Apr 4, 2006
Author-Anish
This class is to created for having function for to build XML
and to get EncodedXML
and to get formated date
package com.idb.events.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.idb.events.Event;
public class XMLBuilder {
This attribute represents the XML version
private static final double VERSION_NUMBER = 1.0;
This attribute represents the encoding
private static final String ENCODING_TYPE = "UTF-16";
/*Begin of Function to buildXML
return: String
input: Event
public String buildXML(Event event) {
StringBuffer xmlBuilder = new StringBuffer("<?xml version=\"");
xmlBuilder.append(VERSION_NUMBER);
xmlBuilder.append("\" encoding=\"");
xmlBuilder.append(ENCODING_TYPE);
xmlBuilder.append("\" ?>");
xmlBuilder.append("<event>");
xmlBuilder.append(getEncodedXML(event.getTitle(), "title"));
xmlBuilder.append(getEncodedXML(event.getOrganizer(), "organizer"));
xmlBuilder.append("</event>");
return xmlBuilder.toString();
/End of Function to buildXML/
/*Begin of Function to get EncodedXML
return: String
input: String,String
public String getEncodedXML(String xmlString, String tag) {
StringBuffer begin = new StringBuffer("");
if ((tag != null) || (!tag.equalsIgnoreCase("null"))) {
begin.append("<").append(tag).append(">");
begin.append("<![CDATA[");
begin.append(xmlString).append("]]>").append("</").append(
tag).append(
">");
return begin.toString();
/End of Function to get EncodedXML/
/*Begin of Function to get formated date
return: String
input: Date
private final String formatDate(Date inputDateStr) {
String date;
try {
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat("yyyy-MM-dd");
date = simpleDateFormat.format(inputDateStr);
} catch (Exception e) {
return "";
return date;
/End of Function to get formated date/
Code for XMLParser:-
Created on Apr 12, 2006
Author-Anish
This is a parser class
package com.idb.events.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import com.idb.events.Event;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
public class XMLParser {
Enables namespace functionality in parser
private final boolean isNameSpaceAware = true;
Enables validation in parser
private final boolean isValidating = true;
The SAX parser used to parse the xml
private SAXParser parser;
The XML reader used by the SAX parser
private XMLReader reader;
This method creates the parser to parse the user details xml.
private void createParser()
throws SAXException, ParserConfigurationException {
// Create a JAXP SAXParserFactory and configure it
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
saxFactory.setNamespaceAware(isNameSpaceAware);
saxFactory.setValidating(isValidating);
// Create a JAXP SAXParser
parser = saxFactory.newSAXParser();
// Get the encapsulated SAX XMLReader
reader = parser.getXMLReader();
// Set the ErrorHandler
This method is used to collect the user details.
public Event getEvent(
String newsXML,
XMLHandler xmlHandler,
IWDMessageManager mgr)
throws SAXException, ParserConfigurationException, IOException {
//create the parser, if not already done
if (parser == null) {
this.createParser();
//set the parser handler to extract the
reader.setErrorHandler(xmlHandler);
reader.setContentHandler(xmlHandler);
InputSource source =
new InputSource(new ByteArrayInputStream(newsXML.getBytes()));
reader.parse(source);
//return the results of the parse
return xmlHandler.getEvent(mgr);
Code for XMLHandler:-
Created on Apr 12, 2006
Author-Anish
This is a parser class
package com.idb.events.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import com.idb.events.Event;
Created on Apr 12, 2006
Author-Anish
*This handler class is created to have constant value for variables and function for get events,
character values for bean variable,
parsing thr date ......etc
package com.idb.events.util;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import java.util.*;
import com.idb.events.Event;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
public class XMLHandler extends DefaultHandler {
private static final String TITLE = "title";
private static final String ORGANIZER = "organizer";
IWDMessageManager manager;
private Event events;
private String tagName;
public void setManager(IWDMessageManager mgr) {
manager = mgr;
This function is created to get events
public Event getEvent(IWDMessageManager mgr) {
manager = mgr;
return this.events;
This function is created to get character for setting values through event's bean setter method
public void characters(char[] charArray, int startVal, int length)
throws SAXException {
String tagValue = new String(charArray, startVal, length);
if (TITLE.equals(this.tagName)) {
this.events.setTitle(tagValue);
if (ORGANIZER.equals(this.tagName)) {
String orgName = tagValue;
try {
orgName = getOrgName(orgName);
} catch (Exception ex) {
this.events.setOrganizer(orgName);
This function is created to parse boolean.
private final boolean parseBoolean(String inputBooleanStr) {
boolean b;
if (inputBooleanStr.equals("true")) {
b = true;
} else {
b = false;
return b;
This function is used to call the super constructor.
public void endElement(String uri, String localName, String qName)
throws SAXException {
super.endElement(uri, localName, qName);
/* (non-Javadoc)
@see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
This function is used to call the super constructor.
public void fatalError(SAXParseException e) throws SAXException {
super.fatalError(e);
This function is created to set the elements base on the tag name.
public void startElement(
String uri,
String localName,
String qName,
Attributes attributes)
throws SAXException {
this.tagName = localName;
if (ROOT.equals(tagName)) {
this.events = new Event();
public static void main(String a[]) {
String cntry = "Nigeria";
XMLHandler xml = new XMLHandler();
ArrayList engList = new ArrayList();
engList = xml.getCountries();
ArrayList arList = xml.getArabicCountries();
int engIndex = engList.indexOf(cntry);
System.out.println("engIndex :: " + engIndex);
String arCntryName = (String) arList.get(engIndex);
System.out.println(
">>>>>>>>>>>>>>>>>>>>" + xml.getArabicCountryName(cntry));
Hope that may help you.
If need any help , you are most welcome.
Regards,
Deepak -
Creating XML files with the DME
Hi All,
I'm working on an integration project between my company and HSBC, they are requesting that we supply our AP payment files for foreign currency in XML format.
I have some limited experience with the DME and know it can create XML files, however, the elements available for XML files are different to standard flat files. Also it doesnt seem like I can create files with multiple levels? e.g.
<InitgPty>
......... <Id>
............... <OrgId>
...................... <BkPtyId>ABC00103003</BkPtyId>
.............. </OrgId>
........ </Id>
</InitgPty>
Does anyone have any documentation or experience with creating XML files with DME?
thanks
Phil.Hi,
Please ask any Implementation team in ABAB or Report painter team with your friends,
Thanks and REgards
N.Soma Sundaram -
Combine several XML files with same structure
Hello,
I have several XML files with the same structure and I want to combine them and create a new XML file to be bale to compare that information easily. It does not look very difficult but as I am very new in this I am not bale to get it
The structure of my actual files would be something simlar to:
Root->...-> Name->Address, Telephone
And what I would like to have si something like
Root->.... ->Address-> Name 1,Name 2....
Root -> ...->Telephone-> Name 1, Name 2....
Does anyone know how to do this.
ThanksYou could write a XSL transformation file that does this and transform your input file via
* Transform XML file with a style sheet.
* <p><b>Example:</b><p>
<table align="center" bgcolor="#E0E0E0" border=1 cellpadding="10" cellspacing="0"><tr><td><pre style="margin-top:0; margin-bottom:0">
XMLTransformer t = new XMLTransformer();
FileOutputStream fos = new FileOutputStream("C:/Project/result.html");
String xmlFile = "C:/Project/source.xml";
String styleSheet = "C:/Project/stylesheet.xsl";
t.transform(xmlFile, styleSheet, fos);
</pre></td></tr></table>
* @param xmlfile The XML file to transform.
* @param style Stylesheet to use for transformation.
* @param outputStream OutputStream to write the transformed result to.
public void transform(String xmlfile, String style, OutputStream outputStream) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
//factory.setNamespaceAware(true);
//factory.setValidating(true);
//todo: use inputstreams instead of file names
try {
File stylesheet = new File(style);
File datafile = new File(xmlfile);
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(datafile);
// Use a Transformer for output
TransformerFactory tFactory = TransformerFactory.newInstance();
StreamSource stylesource = new StreamSource(stylesheet);
Transformer transformer = tFactory.newTransformer(stylesource);
DOMSource source = new DOMSource(document);
StreamResult sr = new StreamResult(outputStream);
transformer.transform(source, sr);
} catch (TransformerConfigurationException tce) {
// Error generated by the parser
System.out.println ("\n**XMLTransformerr Factory error");
System.out.println(" " + tce.getMessage() );
// Use the contained exception, if any
Throwable x = tce;
if (tce.getException() != null) {
x = tce.getException();
x.printStackTrace();
} catch (TransformerException te) {
// Error generated by the parser
System.out.println ("\n** Transformation error");
System.out.println(" " + te.getMessage() );
// Use the contained exception, if any
Throwable x = te;
if (te.getException() != null) {
x = te.getException();
x.printStackTrace();
} catch (SAXException sxe) {
// Error generated by this application
// (or a parser-initialization error)
Exception x = sxe;
if (sxe.getException() != null) {
x = sxe.getException();
x.printStackTrace();
} catch (ParserConfigurationException pce) {
// Parser with specified options can't be built
pce.printStackTrace();
} catch (IOException ioe) {
// I/O error
ioe.printStackTrace();
}//transform() -
File Adapter : read XML file with data validation and file rejection ?
Hello,
In order to read a XML file with the file adapter, I have defined a XSD that I have imported to my project.
Now the File Adapter reads the file correctly but it does not give an error when:
- the data types are not valid. Ex: dateTime is expected in a node and a string is provided
- the XML file has invalid attributes.
How can I manage error handling for XML files ?
Should I write my own Java XPath function to validate the file after is processed ? (here is an example for doing this : http://www.experts-exchange.com/Web/Web_Languages/XML/Q_21058568.html)
Thanks.one option is to specify validateXML on the partnerlink (that describes the file adapter endpoint) such as shown here
<partnerLinkBinding name="StarLoanService">
<property name="wsdlLocation"> http://<hostname>:9700/orabpel/default/StarLoan/StarLoan?wsdl</property>
<property name="validateXML">true</property>
</partnerLinkBinding>
hth clemens -
How to validate xml file with XSD schema ?? in JDK1.4.2
How to validate xml file with XSD schema ?? in JDK1.4.2
i dont want to use new Xerec Jar ...
Suggest option ...Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
Then use Stax (Woodstock) or Saxon.
- Saish -
Problems with reading XML files with ISO-8859-1 encoding
Hi!
I try to read a RSS file. The script below works with XML files with UTF-8 encoding but not ISO-8859-1. How to fix so it work with booth?
Here's the code:
import java.io.File;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import java.net.*;
* @author gustav
public class RSSDocument {
/** Creates a new instance of RSSDocument */
public RSSDocument(String inurl) {
String url = new String(inurl);
try{
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(url);
NodeList nodes = doc.getElementsByTagName("item");
for (int i = 0; i < nodes.getLength(); i++) {
Element element = (Element) nodes.item(i);
NodeList title = element.getElementsByTagName("title");
Element line = (Element) title.item(0);
System.out.println("Title: " + getCharacterDataFromElement(line));
NodeList des = element.getElementsByTagName("description");
line = (Element) des.item(0);
System.out.println("Des: " + getCharacterDataFromElement(line));
} catch (Exception e) {
e.printStackTrace();
public String getCharacterDataFromElement(Element e) {
Node child = e.getFirstChild();
if (child instanceof CharacterData) {
CharacterData cd = (CharacterData) child;
return cd.getData();
return "?";
}And here's the error message:
org.xml.sax.SAXParseException: Teckenkonverteringsfel: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (radnumret kan vara f�r l�gt).
at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
at org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
at org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.java:914)
at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1183)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:653)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
at getrss.RSSDocument.<init>(RSSDocument.java:25)
at getrss.Main.main(Main.java:25)I read files from the web, but there is a XML tag
with the encoding attribute in the RSS file.If you are quite sure that you have an encoding attribute set to ISO-8859-1 then I expect that your RSS file has non-ISO-8859-1 character though I thought all bytes -128 to 127 were valid ISO-8859-1 characters!
Many years ago I had a problem with an XML file with invalid characters. I wrote a simple filter (using FilterInputStream) that made sure that all the byes it processed were ASCII. My problem turned out to be characters with value zero which the Microsoft XML parser failed to process. It put the parser in an infinite loop!
In the filter, as each byte is read you could write out the Hex value. That way you should be able to find the offending character(s). -
How Can I dispaly XML file with CSS?
hi,all
There is maybe a simple way to dispaly a XML file with a CSS file in program.But I don't know.Who can tell me?
Thank you very much!Hi,
XML documents don't have the link or style elements that are used in HTML to connect style information to particular documents. Instead, the W3C has defined a processing instruction that provides that information, based on the model of the HTML link element. To connect a CSS style sheet to your XML document so that the browser can find it, use a processing instruction like
<?xml-stylesheet type="text/css" href="URI"?>
where URI is the address of the style sheet. We'll use a style sheet called display1.css for our first test document. The processing instruction can go right after the XML declaration.
<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="display1.css"?>
<test>
Hope this may help you.
Regards,
Anil.
Technical Support Engineer. -
Failed to load XML file with Content ID 'XYZ'
Hello,
We are using UCM Version:11.1.1.8.1DEV-2014-01-06 04:18:30Z-r114490 (Build:7.3.5.185) with site studio for creating templates and web sites.
While switching to contribution mode, we find 'Failed to load XML file with Content ID 'XYZ' error.[Here XYZ is the local checkin content]
In region we are using dynamic converter to convert the style of native document here below are region and its element details.
<region id="region3" name="Add_Content_Here" flags="1111111100100" metadata="xIdcProfile%3AisHidden%3Dtrue%26xTemplateType%3AisHidden%3Dtrue%26xShowInStaff%3AisHidden%3Dtrue%26xShowInVisitors%3AisHidden%3Dtrue%26xShowInFaculty%3AisHidden%3Dtrue%26xDiscussionCount%3AisHidden%3Dtrue%26xDiscussionType%3AisHidden%3Dtrue" dccommand="ssIncDynamicConversionByRule(SS_DATAFILE, 'Colleges_Template_Rule')">
<!--$region3_ACTIONS="EIMPRS",region3_DCCOMMAND="ssIncDynamicConversionByRule(SS_DATAFILE, 'Colleges_Template_Rule')" -->
<element id="region3_element1" name="Editor" label="Editor" type="1" flags="111111111111111111111100000111100000000000001111001110111010001111101000000000000000000000000000">
<!--$region3_element1="Add_Content_Here/Editor" -->
<linktoregioncontent createnewxml="true" createnewnative="false" choosemanaged="true" chooselocal="false" choosenone="false">
<choosemanagedquerytext corecontentonly="FALSE">
<![CDATA[xWebsiteObjectType <Matches> `Data File` <OR> xWebsiteObjectType <Matches> `Native Document`]]>
</choosemanagedquerytext>
</linktoregioncontent>
</element>
<switchregioncontent createnewxml="true" createnewnative="true" choosemanaged="true" chooselocal="false" choosenone="false">
<createnewnativedoctypes >
<![CDATA[.doc,.docx,.txt,.rtf]]>
</createnewnativedoctypes>
<choosemanagedquerytext corecontentonly="FALSE">
<![CDATA[xWebsiteObjectType <Matches> `Data File` <OR> xWebsiteObjectType <Matches> `Native Document`]]>
</choosemanagedquerytext>
<defaultmetadata >
<![CDATA[xIdcProfile%3AisHidden%3Dtrue%26xTemplateType%3AisHidden%3Dtrue%26xCollegesList%3AisHidden%3Dtrue%26xShowInStudents%3AisHidden%3Dtrue%26xShowInStaff%3AisHidden%3Dtrue%26xShowInVisitors%3AisHidden%3Dtrue%26xShowInFaculty%3AisHidden%3Dtrue%26xArticleSection%3AisHidden%3Dtrue%26xDiscussionCount%3AisHidden%3Dtrue%26xDiscussionType%3AisHidden%3Dtrue%26dpTriggerValue%3DCSE]]>
</defaultmetadata>
</switchregioncontent>
</region>
<!--SS_BEGIN_OPENREGIONMARKER(region3)--><!--$SS_REGIONID="region3"--><!--$include ss_open_region_definition --><!--SS_END_OPENREGIONMARKER(region3)-->
<!--SS_BEGIN_ELEMENT(region3_element1)--><!--$ssIncludeXml(SS_DATAFILE,region3_element1 & "/node()")--><!--SS_END_ELEMENT(region3_element1)-->
<!--SS_BEGIN_CLOSEREGIONMARKER(region3)--><!--$include ss_close_region_definition --><!--SS_END_CLOSEREGIONMARKER(region3)-->
Regardrs,
SyedHi Syed ,
Add the following trace sections :
requestaudit,sitestudio*,system + Full verbose tracing
Clear the server output .
Replicate the same steps and once error shows up , refresh server output and copy the logs to a text file and upload here .
Thanks,
Srinath -
How To read an XML file with JDom
I have read through some tutorials after installing JDom on how to read an existing XML file and I was confused by all of them. I simply want to open an XML file and read one of the node's content. Such as <username>john doe</username> this way I can compare values with what the user has entered as their username. I am not sure were to start and I was hoping someone could help me out.
I know that this seems like an insecure way to store login information but after I master opening and writing XML files with JDom I am going to use AES to encrypt the XML files.Here is a test program for JDom and XPath use considering your XML file is named "test.xml" :import org.jdom.input.*;
import org.jdom.xpath.*;
public class JDomXPath {
public static void main(String[] args) {
SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
try {
org.jdom.Document jdomDocument = saxBuilder.build("test.xml");
org.jdom.Element usernameNode = (org.jdom.Element)XPath.selectSingleNode(jdomDocument, "//username");
System.out.print(usernameNode.getText());
} catch (Exception e) {
e.printStackTrace();
}(tested with Eclipse) -
Reading xml file with sax parser: unknown protocol: c
Hi,
I've been googling around, and the best I can find is that the file name:
File test = new File("lib/test/parseTest/validate-test.xml");should be a url:
File test = new File("File://lib/test/parseTest/validate-test.xml");but I'm working on a linux machine and can't put "File://c:/pathToFile/file.xml"
Also, I did some testing and I can read a small xml file with just a few elements, but on large complex files, I get that error.
anyone ever run into this before?
bp
Edited by: badperson on Nov 1, 2008 2:19 PMbadperson wrote:
I've been googling around, and the best I can find is that the file name:
File test = new File("lib/test/parseTest/validate-test.xml");should be a url:
File test = new File("File://lib/test/parseTest/validate-test.xml");
No, that's wrong. The parameter for that constructor is a file path (relative or absolute). Not a URL. You must have misunderstood whatever you read.
but I'm working on a linux machine and can't put "File://c:/pathToFile/file.xml"What kind of a Linux machine is this which has a C drive? You must have misunderstood whoever told you to do that. -
Parsing XML file with different languages (Xerces)
How do we code or program to an XML file with different
languages , say english and spanish. WHen we parse such a document with the default locale , the presence of special characters throws errors .For eg when I use xerces and use
DOMParser parser = new DOMParser();
try
// Parse the XML Document
parser.parse(xmlFile);
catch (SAXException se)
se.printStackTrace();
org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xfc) was found in the element content of the document.
System Error: void org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource)
So what locale do we set before we parse ?How to handle this problemYou need an encoding attribute in the xml declaration. If you don't, the parser assumes UTF-8, which are ASCII characters up to 127 - useful (only) for English.
So, something like this would allow you to use characters above 127, ISO-8859-1 is the encoding used by standard PCs.
<?xml version="1.0" encoding="ISO-8859-1"?>
You can find a (offical) list of encodings at:
http://www.iana.org/assignments/character-sets
I'm not sure about mixing various encodings. I think you have to resort external parsed entities, which can have their own encoding, but I think you cannot mix encodings in one XML file.
Good luck.
Maybe you are looking for
-
Macbook pro mid 2012 backing up from disk ulitiy asking for "login" keychain?
I bought a "WD My passport For Mac 1TB" portable external hard drive since I can't get into my macbook pro mid 2012 10.9 because when I turn it on its just grey screen with apple logo and spinning wheel. I went to future shop to the geek squad and th
-
Hi, If any one can provide the w2 & 1099 reporting config documents it will be really appreciated. thanks in advance.... Regards, Vipin
-
How do I remove the "Revised" version on a Characteristic ?
Hi All On a BI Content characteristics we have applies some customisations. The characteristic was saved and activated. It is used in a few InfoCubes and as a Reference Characteristic. This has been transported all the way through to production an
-
In What Order Do I Download iWork '09 Updates ?
Hello. I recently bought and installed iWork '09 (alas, after waiting in vain for iWork '11), and found several updates for the program. The updates to iWork '09 are versions 9.0.1, 9.0.3 and 9.0.5. Here is the link: http://support.apple.com/kb/index
-
Flash not showing up AFTER I upload the Scripts folder
I added a Flash object to a page in dreamweaver. The object does not appear in any browser after upgrading to DW 8.02. The flash object plays by itself. It plays when previewed in a template (a dwt file) in the browser. However when placed on a html