Home > Mobile >  How to create .plist file by java
How to create .plist file by java

Time:09-16

I want create .plist file at runtime. I dont want to use any third party library. just want to use java code.

Here is the sample file:

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>items</key>
        <array>
            <dict>
                <key>assets</key>
                <array>
                    <dict>
                        <key>kind</key>
                        <string>software-package</string>
                        <key>url</key>
                        <string>IPA PATH</string>
                    </dict>
                </array>
                <key>metadata</key>
                <dict>
                    <key>bundle-identifier</key>
                    <string>com.xx.xx</string>
                    <key>kind</key>
                    <string>software</string>
                    <key>title</key>
                    <string>V7</string>
                </dict>
            </dict>
        </array>

CodePudding user response:

Since you included the JSP tag, here is a JSP. It needs to be all on one line. I copied your file(I added missing closing tags) and pasted it into a file named "My.xml". I placed that file into the root folder of my web app.

<%@ page import="java.nio.file.Files,java.nio.file.Paths"%><%response.setContentType("text/xml");Files.copy(Paths.get(application.getRealPath("/My.xml")),response.getOutputStream());%>

Alternatively, you could use setContentType("application/x-plist) and name the file "My.plist" and use

<%@ page import="java.nio.file.Files,java.nio.file.Paths"%><%response.setContentType("application/x-plist");Files.copy(Paths.get(application.getRealPath("/My.plist")),response.getOutputStream());%>

CodePudding user response:

I have resolved by myself, Hence close this issue

  • Related