How to create a xml file from String object in CS4
Hi All,
I want to convert a string object into an XML file using Javascript in Indesign CS4.
I have done the following script. But it does not convert the namespaces for the xml elements with no value in it.
var xml = new XML(string);
The value present in string is "<level_1 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>"
When it is converted to xml, the value becomes "<level_1 xsi:nil="true"/>"
On processing the above xml object, am getting an error like this "Uncaught JavaScript exception: Unbound namespace prefix."
Kindly help.
Thanks,
Anitha
Can you post more of the script?
Are you getting the XML file from disk, or a string?
Similar Messages
-
How to create an Xml File From DataBase?
hi all
i have two tables from my database :
VoucherHeader and VoucherItem
VoucherHeader has 4 fields:
VoucherHeaderId
bigint Unchecked
VoucherNum bigint
Unchecked
VoucherDate nvarchar(50)
Unchecked
Comment nvarchar(50)
Unchecked
VoucherItem has 8 fields :
VoucherItem bigint
Unchecked
VoucherHeaderRef
bigint Unchecked
Row bigint
Unchecked
Code1 bigint
Unchecked
Code2 bigint
Unchecked
ItemComment nvarchar(50)
Unchecked
Debit bigint
Unchecked
Credit bigint
Unchecked
and i fill datatable by this codes:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.VoucherItemTableAdapter.Fill(Me.DataSet1.VoucherItem)
Me.VoucherHeaderTableAdapter.Fill(Me.DataSet1.VoucherHeader)
End Sub
now i see this result:
how to send data into an Xml File From DataGridView Header and Item?
please help me
thanks all.
Name of Allah, Most Gracious, Most Merciful and He created the humanOne instruction. But you do it from the dataset, not the DataGridView
Me.DataSet1.WriteXml(FILENAME)
There is a WriteXML method for a DataTable but it gives errors. Since you dataset has two tables save bot into the same xml file.
jdweng -
How to create an XML file from scratch ?
Hi all,
I'm afraid that I will seem dummy, but I think I really misunderstand something or I'm trying to do something that is not possible...
I would like to create a XML file containing the following:<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="pl.xsl"?>
<!DOCTYPE playlist SYSTEM "pl.dtd">
<playlist id="2">
</playlist>I really need to have both the stylesheet and the DOCTYPE declarations... Does anyone know if this is possible ?
To create the XML Document, I am using the DocumentBuilder object from javax.xml package (jaxp-1.2-ea2). I think this, at least, is correct.
To print out the XML document I have tried to use :
- the Transformer from javax.xml package (jaxp-1.2-ea2) but I could obtain only the DOCTYPE declaration.
- the Serializer from Xerces parser (version 2.0.1) to print out the Document I am creating with the jaxp, but I was able only to obtain the stylesheet declaration...
So far I have just understand that there is a difference between Serializer and Transformer (one is serializing, and the other is transforming ;-)), but I couldn't figure out which one would be suitable to produce the XML file above...
I would really appreciate if one could help me with that ;-)
Thanks,
KarauCould send me an example ?
For the moment I am using Transformer in that way:
TransformerFactory tfactory = TransformerFactory.newInstance();
try {
Transformer transformer = tfactory.newTransformer();
DOMSource source = new DOMSource(playlistDoc.getDocumentElement());
StreamResult res = new StreamResult(new File(path));
transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, PL_DTD);
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(source, res);
catch (TransformerConfigurationException tce) {
throw tce;
catch (TransformerException te) {
throw te;
} -
How to create a xml file from the jsp page?
I'm a beginner of the develop xml,my question like this,
there has a jsp page,some parameters in it,I wanna get the parameters and create a xml file,so,what parser method should I use?
And how to create a new xml file,when the file haven't exist at first?
pls give some code,thanks.a ggod link for u http://www.theserverside.com/resources/article.jsp?l=JSP-XML2
-
How to create a xls file from String [ ][ ]
Hi, I have a java class where I can read the content of files xls and store this information in a String [][].
But now, I have to do the opposite.
I have a String[][] where the information is. And I have to guard this information in a file xls.
My code when I read xls to String[][] is:
import java.io.*;
import java.io.File;
import jxl.Workbook;
import jxl.Sheet;
import jxl.Cell;
import jxl.*;
public class ReadfichExcel
private static int numCols;
private static int numRows;
public static String[] dimensionFile(String pathFolder, String file){
String [] dimension = new String[2];
try{
Workbook libro = Workbook.getWorkbook(new File(pathFolder+"/"+file));
Sheet hoja = libro.getSheet(0);
numRows = hoja.getRows();
numCols = hoja.getColumns();
catch (Exception e)
e.printStackTrace();
return null;
dimension[0] = String.valueOf(numRows);
dimension[1] = String.valueOf(numCols);
return dimension;
}How can I do to create a file xls with the information of a String [] []?
Thanks very muchI have solved the problem:
http://www.andykhan.com/jexcelapi/tutorial.html#writing
What do you want to do then? Do you want to read the contents of the Excel file into the array?I only wanted to create a xls file with the information I have in a String[][]. The code I posted before is the code I ussually use to read a xls file.
Next to create and write a xls file I'd do:
public static int CreateTemp (File folderUser, String file, String [][] table)
int exito = 0;
int rows = table.length;
int cols = table[0].length;
if (!folderUser.exists())
folderUser.mkdir();
try
WritableWorkbook libro = Workbook.createWorkbook(new File(folderUser+"/"+file));
WritableSheet hoja = libro.createSheet("First Sheet",0);
// BEGIN TO WRITE
for (int i=0;i<rows;i++)
for (int j=0; j<cols;j++)
Label label = new Label(j, i, table[i][j]);
hoja.addCell(label);
}// FOR
// All sheets and cells added. Now write out the workbook
libro.write();
libro.close();
exito = 1;
} catch (Exception e)
e.printStackTrace();
return 0;
return exito;
}Another question. As I want to copy into the xls file the information in the String[][], Is right to do this using as follow:
Label label = new Label(j, i, table[i][j]);
hoja.addCell(label); (there will be characters and numbers in the cells)
Thanks for your response. -
How to create an XML file from a given EDI file?
Hi All,
I am trying to write some BPEL processes that will be sending EDI Documents to Integration B2B using the AQs.
BPEL works with XML data and finally enqueues it to the AQ IP_OUT_QUEUE. From there B2B will pick up and send to Trading partner. I have sample EDI documents but they are not xml. Can anyone tell me if i can convert these EDI docs to XML?
Can the EDIFECS builder be of any use here?
TIA,B2B adapter? I just want some test data. Finally the setup is going to be such that some xml is going to be posted to the B2B internal channel and then on it will translate and send to Trading Partner.
-
Creating the XML file from Resultset object
I need that code that does the thing
Oh, "the thing". Let me see if I can find that code for you ...
-
Create a xml file from an internal table: CALL TRANSFORMATION
Hello gurus,
I want to create a xml file using data from scustom table. I will create an internal table and will select some records to it.
I searched the forum and i discovered the call transformation, but when i execute the example program at the CALL TRANSFORMATION shows a dump screen.
How we create a xml file from internal table??
Please help me. I will mark the useful answers.I'm using if_ixml class to create xml documents
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
DATA: o_ixml TYPE REF TO if_ixml,
o_document TYPE REF TO if_ixml_document,
o_element TYPE REF TO if_ixml_element,
o_streamfactory TYPE REF TO if_ixml_stream_factory,
o_ostream TYPE REF TO if_ixml_ostream,
o_renderer TYPE REF TO if_ixml_renderer.
DATA: t_xml_table TYPE TABLE OF xml_line,
v_xml_size TYPE i.
o_ixml = cl_ixml=>create( ).
o_document = o_ixml->create_document( ).
* The o_document have a set of methods to add elements, attributes, etc.
o_element = o_document->create_simple_element(
name = 'RootNode'
value = 'some text'
parent = o_document ).
o_streamfactory = o_ixml->create_stream_factory( ).
o_ostream = o_streamfactory->create_ostream_itable( table = t_xml_table ).
o_renderer = o_ixml->create_renderer( ostream = o_ostream document = o_document ).
o_renderer->render( ).
v_xml_size = o_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = v_xml_size
filename = 'C:a.xml'
filetype = 'BIN'
CHANGING
data_tab = t_xml_table. -
How I can create a XML file from java Aplication
How I can create a XML file from java Aplication
whith have a the following structure
<users>
<user>
<login>anyName</login>
<password>xxxx</password>
</user>
</users>
the password label must be encripted
accept any suggestionLet us assume you have all the data from the jsp form in an java bean object..
Now you want a xml file. This can be acheived in 2 ways
1. Write it into a file using java.io classes. Say you have a class with name
write("<name>"+obj.getName+</name>);
bingo you have a flat file with the xml
2. Use data binding to do the trick
will recommend JiBx and Castor for the 2nd option
Regards,
Rajagopal -
How to create an XML document from a String.
Can anyone help,
In the Microsoft XML Document DOM there is a load function load(string) which will create an XML document, but now we are switching to Java and I do not know how to create and XML document from a string, this string �xml document� is passed to my program from a webservice and I need to read several xml elements form it in a web server.
This string is a well formatted XML document:
<?xml version="1.0" encoding="UTF-8"?>
<Countries NumberOfRecords="1" LanguageID="en-us">
<Country>
<CountryCode>AU</CountryCode>
<CountryName>AUSTRALIA</CountryName>
</Country>
</Countries>Thanks PC!
I made it work using:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
factory.setIgnoringComments(true); // We want to ignore comments
// Now use the factory to create a DOM parser
DocumentBuilder parser = factory.newDocumentBuilder();
//TransformThisStringBuffer is a string buffer wich contain the 'XML document (String)'
InputStream in = new ByteArrayInputStream(TransformThisStringBuffer.toString().getBytes());
// Parse the InputStream and build the document
Document document = parser.parse(in);
But which one is faster InputSource or InputStream, were would you put the "new InputSource(new StringReader(yourString))" in the above code? -
Creating an xml file from recordset
Hi...
XML newbie here - so.
Is it possible to create and xml file from a recordset?
I need to create a datafeed of our e-commerce products.
Also, some of the db data contains HTML Code (product
description field),
how will this effect the xml file?
Another problem is that my xml file needs to contain url's
for the products
and product images. My ASP pages contain these URL in hard
code and then
pull the actual file names from the db
Hope that makes some sense
Thanks for any help
AndyHi David
Thanks for your help.
I think it will have to be option 1 as i am using Access DB.
I don't know how to go about it but will serach good old
Google.
Here is my recordset below, that pulls the required data from
Access.
The product and product image URL's need to be in the xml
file but only the
product image name and product id are in the database, e.g
image name
(imagename.jpg) productid (21)
The actual URL's are hardcoded in my ASP pages, e.g <img
src="products/medium/<%=(RSDetails.Fields.Item("Image").Value)%>"
Not sure if this makes things any clearer :-|
Thanks Again
Andy
<%
Dim RSdatafeed
Dim RSdatafeed_numRows
Set RSdatafeed = Server.CreateObject("ADODB.Recordset")
RSdatafeed.ActiveConnection = MM_shoppingcart_STRING
RSdatafeed.Source = "SELECT Products.Product,
Products.Description,
Products.Image, Products.image2, Products.ListPrice,
Products.Price,
Products.xml_feed, Manufacturers.Manufacturer,
Shipping.ShippingCost FROM
Shipping, Products INNER JOIN Manufacturers ON
Products.ManufacturerID =
Manufacturers.ManufacturerID WHERE
(((Products.xml_feed)=No));"
RSdatafeed.CursorType = 0
RSdatafeed.CursorLocation = 2
RSdatafeed.LockType = 1
RSdatafeed.Open()
RSdatafeed_numRows = 0
%>
"DEPearson" <[email protected]> wrote in
message
news:[email protected]...
> Andy,
>
> There are two ways you can create a xml file from a
recordset
>
> 1. Is to code it using Server.CreateObject(XMLDOM)
> 2. If you are using SQL server 2005, just request the RS
returns as XML
> data. using FOR XML AUTO after the where cause ( the
best way with 2005
> and
> higher sql server)
>
> The db data containing HTML code should not effect your
xml file, unless
> it
> is bad markup. You could wrap the data with
<![CDATA[the data or html
> markup, or javascript]]>
>
> If the url is a recordset field, then it will return
with the xml data.
> If
> not you can create a storage procedure that will build
your URL from the
> data
> in the database.
>
> It is best to use storage procedure (SP )for security
reason when pulling
> data
> from a MS Sql server, make all calls to the database in
a SP. Also be sure
> to
> validate the values in the querystrings before accepting
them, check for
> hack
> code.
>
> David
> -
How to create new XML file using retreived XML content by using SAX API?
hi all,
* How to create new XML file using retreived XML content by using SAX ?
* I have tried my level best, but output is coming invalid format, my code is follows,
XMLFileParser.java class :-
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
public class PdfParser extends XMLFilterImpl {
private TransformerHandler handler;
Document meta_data;
private StringWriter meta_data_text = new StringWriter();
public void startDocument() throws SAXException {
void startValidation() throws SAXException {
StreamResult streamResult = new StreamResult(meta_data_text);
SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
try
handler = factory.newTransformerHandler();
Transformer transformer = handler.getTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
handler.setResult(streamResult);
handler.startDocument();
catch (TransformerConfigurationException tce)
System.out.println("Error during the parse :"+ tce.getMessageAndLocation());
super.startDocument();
public void startElement(String namespaceURI, String localName,
String qualifiedName, Attributes atts) throws SAXException {
handler.startElement(namespaceURI, localName, qualifiedName, atts);
super.startElement(namespaceURI, localName, qualifiedName, atts);
public void characters(char[] text, int start, int length)
throws SAXException {
handler.characters(text, start, length);
super.characters(text, start, length);
public void endElement(String namespaceURI, String localName,
String qualifiedName) throws SAXException {
super.endElement("", localName, qualifiedName);
handler.endElement("", localName, qualifiedName);
public void endDocument() throws SAXException {
void endValidation() throws SAXException {
handler.endDocument();
try {
TransformerFactory transfactory = TransformerFactory.newInstance();
Transformer trans = transfactory.newTransformer();
SAXSource sax_source = new SAXSource(new InputSource(new StringReader(meta_data_text.toString())));
DOMResult dom_result = new DOMResult();
trans.transform(sax_source, dom_result);
meta_data = (Document) dom_result.getNode();
System.out.println(meta_data_text);
catch (TransformerConfigurationException tce) {
System.out.println("Error occurs during the parse :"+ tce.getMessageAndLocation());
catch (TransformerException te) {
System.out.println("Error in result transformation :"+ te.getMessageAndLocation());
} CreateXMLFile.java class :-
Sax.startDocument();
Sax.startValidation();
Sax.startElement("", "pdf", "pdf", new AttributesImpl());
Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());
String xmp_str = new String(meta_data.getByteArray(),"UTF8");
char[] xmp_arr = xmp_str.toCharArray();
Sax.characters(xmp_arr, 0, xmp_arr.length);
Sax.endElement("", "pdf", "pdf");
Sax.endValidation();
Sax.endDocument();
Sax.endElement("", "basic-metadata", "basic-metadata");* In CreateXMLFile.java
class, I have retreived the xml content in the meta_data object, after that i have converted into character array and this will be sends to SAX
* In this case , the XML file created successfully but the retreived XML content added as an text in between basic-metadata Element, that is, retreived XML content
is not an XML type text, it just an Normal text Why that ?
* Please help me what is the problem in my code?
Cheers,
JavaImranSax.startDocument();
Sax.startValidation();
Sax.startElement("", "pdf", "pdf", new AttributesImpl());
Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());
String xmp_str = new String(meta_data.getByteArray(),"UTF8");
char[] xmp_arr = xmp_str.toCharArray();
Sax.characters(xmp_arr, 0, xmp_arr.length);
</code><code>Sax.endElement("", "basic-metadata", "basic-metadata");</code>
<code class="jive-code jive-java">Sax.endElement("", "pdf", "pdf");
Sax.endValidation();
Sax.endDocument();
* I HAVE CHANGED MY AS PER YOUR SUGGESTION, NOW SAME RESULT HAS COMING.
* I AM NOT ABLE TO GET THE EXACT OUTPUT.,WHY THAT ?
Thanks,
JavaImran{code} -
Hello
My objective is to have a xml file created from a list for anonymous access. The SharePoint RSS feed is a .aspx file not xml, as shown below:
_layouts/listfeed.aspx?List=21c2cdaa%2D52f3%2D4057%2Db674%2D45e63ba77e31&View=535eb328%2Db5fb%2D45c5%2D8fe8%2Da130e92afc41
Also, is there a way to do this so that the xml content has current data like the list.
Thank you for any insight and direction.Hi,
According to your post, my understanding is that you wanted to create a xml file from a SharePoint list.
To generate a XML file, we can use the SharePoint Object Model or PowerShell to achieve it.
Generate a hierarchical XML file from SharePoint list using Client Object Model.
http://maxderungs.wordpress.com/2012/05/12/generate-a-hierarchical-xml-file-from-sharepoint-list/
Get SharePoint list items and export them to XML using PowerShell
http://www.robertkuzma.com/2012/09/get-sharepoint-list-items-and-export-them-to-xml-using-powershell/
More reference:
http://www.robertkuzma.com/2010/08/how-to-create-a-custom-xml-output-using-sharepoint-services-3-0/
http://traceynolte.com/blog/convert-sharepoint-list-to-xml/
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
Creating an xml file from abap code
Hello All,
Please let me know which FM do I need to execute in order to create an XML file from my ABAP code ?
Thanks in advance,
Paul.This has been discussed before
XML files from ABAP programs -
Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.The Oracle documentation has a good overview of the options available
Generating XML Data from the Database
Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
You can also find some information in XML DB FAQ
Maybe you are looking for
-
Difference in IE and Mozilla browsers?
Hi, Ya'll ... I am a new web designer ... come from a Legacy background (Unix/Pick) .. so this graphical world is very new and exciting! I am doing volunteer work for a small nonprofit, and buying software as I can afford it ... using Dreamweaver (ma
-
ITunes library not arranging songs in order
Hi, I was wondering, on my PC, iTunes is not arranging the songs in one particular album in the correct order. (ie. like in the track order on my actual CD.) I have tried adding them to the library again, I checked that all of the tracks have a numbe
-
Hi In my Purchase Order, earlier it was account assigned to a WBS element A. When we ran CJI3, it showed the same. But now the account assignment of WBS element was changed to B. I have no idea how this got changed. I only can check from the Purchase
-
Just to let you know if you are in London the Agent 18 cases that seem so hard to get a hold of are in the Apple Store ! Unfortunately - 1.They are NOT on the upper floor with the other ipod cases 2.The staff on the upper floor will politely tell you
-
Latest Updates - Leopard screwed up
Hi all, On the whole, leopard 10.5.2 has been really good and very reliable after i got past the initial teething problems. But after the most recent updates, im getting loads of problems. Apps crashing, spaces looks all wrong - see pic. I can no lon