Formatting xml
i'm retrieving an xml data from an lob column ,what's the best way to format the data into to an xml format?
Not quite understand your question. Would provide more information about what you want?
After Oracle9i, XMLType is suggested to be used to store XML data files which you can use extractNode() to extract the content.
Or you can use XSU and XSQL servlet.
Similar Messages
-
Formatting XML written to a file
Hi,
I am trying to write runtime data (XML) to a file. I am doign the following to write to the file:
public void saveFile() throws Exception {
try {
TransformerFactory transformerFactory =
TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(doc);
OutputStream output = new FileOutputStream(XMLFile);
StreamResult result = new StreamResult();
transformer.transform(source, result);
output.flush();
output.close();
} catch (Exception x) {
throw x;
The output from the above code is a clutter of elements. All the elements are on the same line some times.
1) How can I format the output? (Indent the elements in the file)
Is there a way to achieve this?
Sometimes, I see a square character at the end of some lines. I thought the output file is corrupt because of this character. But it does not seem to be a problem.
2) How do I avoid this character?Duplicate of the following thread:
Format XML data when writing to a file
-Blaise -
Using a CWM format XML as datastore; COM SDK to read the file and create Universe
Hello everyone
We are in the process of migrating from a metadata store to BusinessObjects Universe and the plan is to use Java/COM SDK to accomplish that. We have run into limitations with both the SDKs. Java SDK doesn't provide that facility and using COM SDK we are trying to read from a XML file (metadata in CWM format) and create the universe but so far haven't been successful. If the (Universe)Designer can read a CWM format xml file (say created from BODS) we are wondering why can't a customer made COM program do the same.
Has anyone attempted this and been successful. Please acknowledge.
ThanksI have written C#.NET code to build universes on the fly using the Designer SDK with no problems. However, I wasn't using CWM formatted data to do this.
I have two suggestions for you:
1. Since not all of the functionality in the Designer tool seems to be available through the SDK, can you parse the CWM xml file in your code and build the universe based on the data instead of trying have Designer build it?
2. Since you're using Java, you may get better answers by posting this question in the Java SDK Application Development space here: http://scn.sap.com/community/bi-platform/java-sdk
-Dell -
How to fix iframe issue that displays XML values instead of formatted XML in IE11
The following sub.jsp file shows the formatted XML properly as expected when is opened directly:
<% response.setContentType("text/xml"); %>
<book>
<chapter1>chapter 1</chapter1>
<chapter2>chapter 2</chapter2>
</book>
IE11 shows the result as below which are colored and can be collapsed or un-collapsed:
<book><chapter1>chapter 1</chapter1><chapter2>chapter 2</chapter2></book>
But if the sub.jsp is opened in an iframe from the below main.html, it only shows the values of the XML in the iframe:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<iframe src="sub.jsp"></iframe>
</body>
</html>
The iframe shows only the XML values, i.e., chapter 1 chapter 2 in IE11. This issue does not happen in IE8.
I appreciate to your if you know how to address this issue.
Regards, AmirThe following sub.jsp file shows the formatted XML properly as expected when is opened directly:
<% response.setContentType("text/xml"); %>
<book>
<chapter1>chapter 1</chapter1>
<chapter2>chapter 2</chapter2>
</book>
IE11 shows the result as below which are colored and can be collapsed or un-collapsed:
<book><chapter1>chapter 1</chapter1><chapter2>chapter 2</chapter2></book>
But if the sub.jsp is opened in an iframe from the below main.html, it only shows the values of the XML in the iframe:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<iframe src="sub.jsp"></iframe>
</body>
</html>
The iframe shows only the XML values, i.e., chapter 1 chapter 2 in IE11. This issue does not happen in IE8.
I appreciate to your if you know how to address this issue.
This issue is also posted at below link:
https://social.msdn.microsoft.com/Forums/en-US/5b0692b4-d312-4797-9089-42c1029ac059/how-to-fix-iframe-issue-that-displays-xml-values-instead-of-formatted-xml-in-ie11?forum=iewebdevelopment
Regards, Amir -
How to convert well format xml in coldfusion?
Hi,
I am consuming asp.net webservice in coldfusion.It returns xml but it is not in wellformat.
Please suggest me how to convert to well format xml.
Advance Thanks,chandra12345 wrote:
I am consuming asp.net webservice in coldfusion.It returns xml but it is not in wellformat.
Please suggest me how to convert to well format xml.
Technically speaking, a piece of text must be well-formed before it can be called an XML document. So you cannot yet say the returned text is XML.
The first thing to do is to check whether it is. Use, for example, isXml(someString) to check whether someString is well-formed XML.
There is no one standard way to convert text to well-formed XML. This is because there are infinitely many ways in which text can fail to be well-formed. The easiest solution for you will be to learn the rules for well-formed XML.
Any elementary book on XML will teach you that. If you find books old-fashioned, then you could instead google well-formed xml . -
How to send a Material Idoc in format XML to SQL Server DB?
Hi,
I am creating a Material Idoc in format XML and I need send the same to a SQL Server DB.
In the transaction BD10 I create the XML Idoc, but the same is stored in the SAP Server and I need send this to an external SQL Server DB.
Somebody knows how to send automatically the XML Idoc to a SQL Server DB?
Thanks and regards!
Edited by: marcosap on Nov 11, 2010 4:00 PMHi,
All your XML idoc will get store in App layer,you can ask your Unix expert to write the unix code to fetch these XML idoc files and transfer to destination based on time period set by conjob.
This is simple & easy job for any UNIX expert.
Regards
Siva -
How to change Un formatted XML to Formatted XML in SSRS ?
Hi Friends,
I have an issue with SSRS report when exporting it into xml , it's showing un formatted xml like below
but my requirement is it has to show formatted xml like below
Please help me with this issue,
NOTE: here i am building reports on Cube.
Thanks in advance.
NaveenHi NaveenMSBI,
By default, the XML rendering extension does not display formatted textbox values. In this case, we can use the UseFormattedValue device information setting to make the XML rendering extension display textbox values formatted the same way they are formatted
in report viewer or report designer preview. When UseFormattedValue is set to true, the formatted value is used instead.
You can specify UseFormattedValue directly on the URL against the ReportServer endpoint or in a SOAP request. This can also be configured as the default for all XML rendering extension by editing the RSReportServer.config file.
For the details, please refer to the links as follows:
Passing Device Information Settings to Rendering Extensions
XML Device Information Settings
Hope this helps.
Regards,
Heidi Duan
Heidi Duan
TechNet Community Support -
I have an oracle table i have to export as formatted xml
I really want the data to look like this : (and need to get rid of the cdata)
<?xml version='1.0' ? XML_DATE = "2012-06-26 08:12:09 PM">
<APPLICATION NAME = "XMLTESTING">
<WEBPAGE>
<PROJECT>
<column1>ABC</column1>
<column2>DEF</column2>
<column3>GHI</column3>
<column4>JKL</column4>
<column5>MNO</column5>
</PROJECT>
<PROJECT>
<column1>ABG</column1>
<column2>DRF</column2>
<column3>GLY</column3>
<column4>JAL</column4>
<column5>MPO</column5>
</PROJECT>
<PROJECT>
<column1>BBC</column1>
<column2>GEF</column2>
<column3>LHI</column3>
<column4>JCL</column4>
<column5>MWO</column5>
</PROJECT>
</WEBPAGE>
</APPLICATION>
create table "XML_TESTING" (
"column1" varchar2(50byte),
"column2" varchar2(50byte),
"column3" varchar2(50byte),
"column4" varchar2(50byte),
"column5" varchar2(50byte)
INSERT into XML_TESTING values ('ABC','DEF','GHI','JKL','MNO');
INSERT into XML_TESTING values ('ABG','DRF','GLY','JAL','MPO');
INSERT into XML_TESTING values ('BBC','GEF','LHI','JCL','MWO');
CREATE TABLE xml_cl(result CLOB);
DECLARE
ctxqry DBMS_XMLGEN.ctxHandle;
result CLOB;
BEGIN
ctxqry := dbms_xmlgen.newContext('SELECT * FROM xml_testing');
DBMS_XMLGEN.setRowTag(ctxqry,'APPLICATIO NAME = "XML TESTING"');
--DBMS_XMLGEN.setMaxRows(ctxqry,5);
DBMS_XMLGEN.setrowsettag(ctxqry,'WEBPAGE');
LOOP
result := DBMS_XMLGEN.getXML(ctxqry);
EXIT WHEN
DBMS_XMLGEN.getNumRowsProcessed(ctxqry)=0;
INSERT INTO xml_cl VALUES(result);
END LOOP;
END;
SELECT * FROM xml_cl
THEN I EXPORT TO XML FROM HERE.
this is how xml currently looks
<?xml version='1.0' encoding='Cp1252' ?>
<RESULTS>
<ROW>
<COLUMN NAME="RESULT"><![CDATA[<?xml version="1.0"?>
<WEBPAGE>
<APPLICATIO_x0020_NAME_x0020__x003D__x0020__x0022_XML_x0020_TESTING_x0022_>
<column1>ABC</column1>
<column2>DEF</column2>
<column3>GHI</column3>
<column4>JKL</column4>
<column5>MNO</column5>
</APPLICATIO_x0020_NAME_x0020__x003D__x0020__x0022_XML_x0020_TESTING_x0022_>
<APPLICATIO_x0020_NAME_x0020__x003D__x0020__x0022_XML_x0020_TESTING_x0022_>
<column1>ABG</column1>
<column2>DRF</column2>
<column3>GLY</column3>
<column4>JAL</column4>
<column5>MPO</column5>
</APPLICATIO_x0020_NAME_x0020__x003D__x0020__x0022_XML_x0020_TESTING_x0022_>
<APPLICATIO_x0020_NAME_x0020__x003D__x0020__x0022_XML_x0020_TESTING_x0022_>
<column1>BBC</column1>
<column2>GEF</column2>
<column3>LHI</column3>
<column4>JCL</column4>
<column5>MWO</column5>
</APPLICATIO_x0020_NAME_x0020__x003D__x0020__x0022_XML_x0020_TESTING_x0022_>
</WEBPAGE>
]]></COLUMN>
</ROW>
</RESULTS>
hope someone can help.
did alot of searching and reading and just cant find an answer
thank youUse SQL/XML functions to build and serialize the document as CLOB in a single query :
SQL> SELECT XMLSerialize(document
2 XMLElement("APPLICATION",
3 XMLAttributes('XMLTESTING' as "NAME")
4 , XMLElement("WEBPAGE",
5 XMLAgg(
6 XMLElement("PROJECT",
7 XMLForest("column1", "column2", "column3", "column4", "column5")
8 )
9 )
10 )
11 )
12 as clob
13 indent --< for formatting purpose only
14 )
15 FROM xml_testing
16 ;
XMLSERIALIZE(DOCUMENTXMLELEMEN
<APPLICATION NAME="XMLTESTING">
<WEBPAGE>
<PROJECT>
<column1>ABC</column1>
<column2>DEF</column2>
<column3>GHI</column3>
<column4>JKL</column4>
<column5>MNO</column5>
</PROJECT>
<PROJECT>
<column1>ABG</column1>
<column2>DRF</column2>
<column3>GLY</column3>
<column4>JAL</column4>
<column5>MPO</column5>
</PROJECT>
<PROJECT>
<column1>BBC</column1>
<column2>GEF</column2>
<column3>LHI</column3>
<column4>JCL</column4>
<column5>MWO</column5>
</PROJECT>
</WEBPAGE>
</APPLICATION>
Then you can call DBMS_XSLPROCESSOR.CLOB2FILE to write the CLOB to a file, no need of an intermediate table. -
Do you have examples of CSV Format XML that can handle relationshiptypes?
Hi,
I have created a Windows Computer extended class that, for the sake of the example, has an additional property
ServerNameRow , and a relationship (selected via Single Instance Picker control)
BusinessUnitCustomersListPickerClass_Relationship. (The Single Instance Picker selects the primary name field/property only)
I want to import data via CSV, and/or PowerShell. Both need a Format XML file.
I don't know what the syntax is for relationship BusinessUnitCustomersListPickerClass_Relationship.
What I'd need is some examples, preferably of a non-extended class and of an extended class's format XML.http://blogs.technet.com/b/servicemanager/archive/2009/05/26/using-the-csv-import-feature.aspx
At the bottom of that blog post is an attachment (CSVImport.docx). It contains all the information you'll need for constructing CSV imports, including examples.
To import relationships, you'll need to define a type projection targeting the windows computer class that contains a component for your custom relationship type.
Also note you should not use the extension class itself in your definition file or in the type projection definition. Just use the windows computer class. Don't worry..your extension class property will be recognized by the import process. Extensions
to a class are different than inherited classes. -
In Correct format XML Error Event
wich Error Event ican use incorrect format xml. Like
--------- XML------
<data>
<name>some name</name>
<name>some name2
</data>
--------end of XML----
above case wich error ican usethere is no event for this I think, but you can use try ...catch :
var urll:URLLoader=new URLLoader();
urll.addEventListener(Event.COMPLETE,f1);
function f1(evt:Event)
try
var xmlm:XML = XML(urll.data);
catch (e:TypeError)
trace("not well formed XML");
urll.load(new URLRequest("isim.txt")); -
Format XML data when writing to a file
Hi,
I am trying to write runtime data (XML) to a file. I am doign the following to write to the file:
public void saveFile() throws Exception {
try {
TransformerFactory transformerFactory =
TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(doc);
OutputStream output = new FileOutputStream(XMLFile);
StreamResult result = new StreamResult();
transformer.transform(source, result);
output.flush();
output.close();
} catch (Exception x) {
throw x;
The output from the above code is a clutter of elements. All the elements are on the same line some times.
1) How can I format the output? (Indent the elements in the file)
Is there a way to achieve this?
Sometimes, I see a square character at the end of some lines. I thought the output file is corrupt because of this character. But it does not seem to be a problem.
2) How do I avoid this character?Also, I am planning on using xpath in conjunction with DOM. However I read on one of the websites not to use too many xpath queries. I am using jdk 1.5.
Is it tight. My code might have to be run many times. Is the following ok?
or should I eliminate xpath and do my own traversing. I am concerned about runtime performance if I have to continue to update the xml file frequently.
public Element getMatchingNode(MyAttributes attr) throws Exception {
try {
File myFile = new File(XMLFile);
if (myFile.exists()) {
System.out.println(XMLFile + " File exists");
XPathFactory factory = XPathFactory.newInstance();
XPath xPath = factory.newXPath();
InputSource inputSource =
new InputSource(new FileInputStream(myFile));
String matchingString = this.getMatchingString(attr);
Element module =
(Element)xPath.evaluate("/" + TEST_TAG +
"/" +
TEST_TAG2 +
"/" +
DETAIL +
matchingString,
inputSource,
XPathConstants.NODE);
return module;
} else
return null;
} catch (Exception x) {
throw x;
private String getMatchingString(MyAttributes attrs){
StringBuffer buffer = new StringBuffer();
for (Enumeration e=attrs.keys(); e.hasMoreElements();){
String attribute = (String)e.nextElement();
String value = attrs.get(attribute);
buffer.append("[@" + attribute + "=" + "'" + value + "']");
return buffer.toString();
} -
Wordpad object in rtf format - XML publisher
We are trying to insert a Wordpad OLE object(Printer Signature Escape code Sequence) in the xml template and trying to generate the xml report in rtf format. When we generate the report or preview in rtf format the inserted Object Contents are not displaying. Any one faced this issue in xml publisher.
This is what I did.
1.Open the XML template. In Word under Insert option Selected Object . Select the object type as Word Pad Object(In Create new Tab). Type somethinng.. I typed this as printer escapecode sequence ~(4B~(s1p53v0s
2.Loaded the XML data and tried to preview in RTF format the Object disappears and nothing displays in the place of Obejct.
When I preview in PDF format this displays. but PDF format is not supported by our troy printer.
This is we are doing to get the signature with printer escape code. It would be great if any one have any alternatives?. They are not going to give the Signature as an image.This is the General XML forum.
The homepage description says :
Discussion of the general XML language, standards (XSLT, XQuery, XMLSchema, etc.) and application management issues, suggestions and tips.
The BI Publisher forum is here :BI Publisher
So please mark this post as answered and ask again over there. -
Formatting XML file to avoid mapping parser error
Hi,
We have requirement in our project to process input xml file which is of the below format:
<message>
<data>
<xml version=1.0 code=utf/>
<test>
<data>book</data>
</test>
</data></message>
Since <xml> tag is at the middle it is throwing a exception error in mapping.
Actual requirment is that we need
<test>
<data>book</data>
</test>
The xml of the above format is generated by some external system which PI need to pick it.
I think is not possible in XSLT mapping as it is not starting with xml tag .
So please let me know pointer ot resolve the issue.
Thanks in advance.Hi Yeshwanth,
If this input XML. Then it is valid XML.
<message>
<data>
<xml version="1.0" code="utf" />
<test>
<data>book</data>
</test>
</data>
</message>
Please paste the error message, input and expected output XML.
Regards,
Raghu_Vamsee
Edited by: Raghu Vamsee on Aug 25, 2011 12:10 PM -
Format XMl to be read in a text editor.
Hi,
I'm using ixml functions to create an xml file. Each element of my document is created using :
<cl_xml_document> ->create_simple_element
I then export it to a file with :
<cl_xml_document>->export_to_file
When the created file is opened with an xml viewer, it appears well presented, every tag is displayed on a seperate line.
However, once opened with a text editor, the whole content is displayed on one line. Is there to format the file with some sort of line seperator?
On debugging, I found out that only one line of its internal table is used to store the data.Welcome to SDN
Try this,
data: temp_str type string.
concatenate '>' cl_abap_char_utilities=>cr_lf '<' into temp_str .
replace all occurrences of '><' in XML_STRING with temp_str.
xml_string is the straing variable to hold the xml .
now use xml_string to show it in texteditor.
Regards
RAja -
Compare two tables that are in XML format (xml diff)
I have two tables in XML-format and need to list differences in
1. Structure and/or
2. Content
SAP offers CL_SXIVERI_XML_COMPARATOR, but this is too simplistic for the requirement.
Any ideas or suggestions will be appreciated. Thank you!Hi Adrian,
You can convert the data from the XML file to an internal table. Once the data is in the internal table you can easily paly with it
Refer to this Wiki for details: [https://wiki.sdn.sap.com/wiki/display/ABAP/UploadXMLfiletointernal+table].
You can also check Simple Transformations as well.
Cheers,
Suhas -
Data in XML format (XML files) to BW?
Hi,
My customer is interested in loading data to BW (from 3rd party system) in XML format. Are there any advantages of doing this (compared to traditional ascii files)? How about disadvantages (BW version is 3.5) ?. How to get started with this one, I noticed there is a possibility to create a XML data source. Is this able to take XML files into BW or what?.
Any help highly appreciated!Hi Jimmy,
Have a look:
http://help.sap.com/saphelp_nw04/helpdata/en/9b/821140d72dc442e10000000a1550b0/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/55/014e3c97f6bb3ee10000000a114084/content.htm
Hope it Helps
Srini
Maybe you are looking for
-
Have had Wireless Home Phone connect device refreshed and updated three times since I purchased it in September 2014. Last tech I worked with on it initialized an NRB to check the network. I checked the location of the tower, which is less than one m
-
Having trouble with iphone 5 music starting randomly.
My music or audiobook starts on its own at times. Can't figure out what is happening? Is it a bluetooth issue? Then I have to take it back to the beginning of book and lose my place.
-
Moving through options on a dialog box
How do you move from one button to the other when you get a dialog box?? Like when you have to agree/disagree , say yes/no/cancel, etc. It's really annoying to have to go back to the mouse everytime the default option is not the one you need.
-
Safari Freezes my computer solid.
Safari will freeze my computer. My curser will be the only thing that functions ( by funtions i mean moves around the screen not frozen ) nothing else will work. This is not after a two finger swipe that other seem to be running into. The only option
-
Hi, I've got a question regarding the deployment of an SDA in terms of a J2EE DC. The SDA has got a reference declared to the public part of a Java DC (name= csdshop/shoplibsources). This public part has been enabled as to be used in context of SDA c