天道酬勤,学无止境

xml

java DOM xml file create - Have no tabs or whitespaces in output file

I already looked through the postings on stackoverflow but it seems that nothing helps. Here is what have: // write the content into xml file TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformerFactory.setAttribute("indent-number", 2); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); DOMSource source = new DOMSource(xmlDoc); StreamResult result = new StreamResult(new File("C:\\testing.xml")); transformer.transform(source, result); and this is what I get as output: <?xml version="1.0"

2022-01-19 02:39:16    分类:问答    java   xml   dom   indentation

Reading a very large local XML file using GWT

I am building my first Java application using GWT which must read in data from a very large XML file. I am having issues when I try sending a request for the information in the file, and I'm not quite sure if it has to do with the size of the file, or my semantics. In my program I have the following: static final String xmlurl = "filename.xml"; String xmlData; ... public void onModuleLoad() { requestData(xmlurl); if(xmlData.equals("Error")){ // display error message return; } else { // display the xml } void requestData(String url){ final int STATUS_CODE = 200; RequestBuilder builder = new

2022-01-19 02:24:01    分类:问答    java   xml   gwt   nullpointerexception

jquery set xml cdata

I have a problem setting a cdata node with jquery. Getting cdata is easily done with the .text() function, but if I use .text('jquery > handy') it doesn't create a cdata node. This is my procecure: I get form data in xml to load in a form something like this: <formdata> <field id="title"><![CDATA[Some title]]></field> <field id="description"><![CDATA[Some description]]></field> </formdata> I use cdata nodes because a field can contain all kinds of special chars. Then I load the data in the form by getting the node content with .text() If the user posts the form, I update the xml and convert it

2022-01-19 02:17:50    分类:问答    jquery   xml   cdata

How to set line as a background using xml (shape) below to EditText?

I want to set the line as background below EditText using shape xml but when I set it line set on center I want like below but when I set the shape below drawable/line.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <stroke android:height="4dp" android:color="@color/crabfx_dark_gray" /> </shape> activity_main.xml <EditText android:id="@+id/edt" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@android:color/black" android:layout_margin="20dp" android:background="

2022-01-19 01:28:47    分类:问答    android   xml   shape

pretty print XML file

Original Question I'm trying to prettyprint an XML-file without any external libraries, but cannot get Java to do what I want... Here is my code so far (I added any solutions from similar questions!): TransformerFactory tfactory = TransformerFactory.newInstance(); tfactory.setAttribute("indent-number", 4); Transformer transformer = tfactory.newTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.MEDIA_TYPE

2022-01-19 01:09:08    分类:问答    java   xml   xslt   dom   java-8

XslTransform with xml-stylesheet

It looks like everyone says if you use XslTransform, you would call Load to load the style sheet first, then call Transform to transform it. However I have the following XML file: <?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/xsl" href="some_stylesheet.xsl" ?> .... </xml> Am I suppose to load the xml first, find the style sheet node, then call Load to load the style sheet, or is there another way to do it?

2022-01-19 01:03:42    分类:问答    c#   xml   xslt

Is there a way to present XML data in google sites

In our organisation, we use TodoList by abstract spoon to track our software projects. I like this tool because it's fairly light weight while allowing the developers to collaborate without any server maintenance issues. One thing I'd like to try out is setting up a project status page that our customers can view. Google sites offers a nice project status template which I thought I'd use. One of the things I'd like to be able to do is present the content of the todolist file (which is an XML file) in various formats. My thinking was to upload the XML file to google drive and present the data

2022-01-19 00:26:34    分类:问答    xml   google-sites

Rails 4, replacing "\n" with "
" for use in XML spreadsheets in excel

I'm writing an application that exports certain data into a specifically formatted Excel document. I'm building an XML spreadsheet file using this document (http://msdn.microsoft.com/en-us/library/aa140066(v=office.10).aspx#odc_xmlss_x:pagesetup) and so far have it all working. BUT to get it working I had to use ".html_safe" in several fields which is dangerous in this instance as some of the fields being exported contain user entered data. Basically to get a new line inside an excel cell you use " " instead of the usual \n I'm currently using this in my erb: (edited 8/8/2014 for clarity) <%

2022-01-18 21:27:06    分类:问答    ruby-on-rails   xml   excel   escaping   gsub

Inherit XMLType of base class

I have the following base class decorated with the XmlType attribute [Serializable] [XmlType("Base")] public class Base { [XmlElement(ElementName = "IdBase")] public int IdBase { get; set; } ... } And the following Inherited class, without the XMLType attibute decorating class [Serializable] public class InheritedClass1 : Base { [XmlElement(ElementName = "InheritedProp")] public int InheritedProp{ get; set; } ... } When I serialize, the inherited class seems to override the XmlType generating the following XML (which I didn´t expected because I didn´t decorated explicitly with the XmlType)

2022-01-18 21:14:23    分类:问答    c#   xml   inheritance   serialization

Populate an ExpandableListView from XML file - Android

In my Android application I've got an Activity containing an ExpandableListView. The items it will contain should be extracted from an XML file that the application will query to a Server when it starts (suppose the size of the file is not an issue). The user should then be able to make modifications to the content of the XML file by adding, removing, editing items from the ExpandableListView with functionalities provided by the application. Eventually the application will send back the modified XML file to the Server. For better understanding this mockup should explain what I'm trying to

2022-01-18 20:34:24    分类:问答    java   android   xml   android-layout   expandablelistview