Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
Leider doch nichtEs funktioniert einwandfrei.
for (int i = 0; i < data.length ; i++)
{
Element element = document.createElement(head[i]);
zero.appendChild(element);
element.appendChild(document.createTextNode(data[i]));
}
<sDISPlusImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="import.xsd">
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class AttributeDemo {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument();
Element root = document.createElement("sDISPlusImport");
root.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance",
"xsi:noNamespaceSchemaLocation", "import.xsd");
document.appendChild(root);
TransformerFactory.newInstance().newTransformer().transform(
new DOMSource(document), new StreamResult(System.out));
}
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?><sDISPlusImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="import.xsd"/>
<?xml version="1.0" encoding="UTF-8"?>
<sDISPlusImport xsi:noNamespaceSchemaLocation="import.xsd"/>
Element root = document.createElement("sDISPlusImport" );
root.setAttributeNS(" ","xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance");
root.setAttributeNS(" ","xsi:noNamespaceSchemaLocation","import.xsd");
document.appendChild(root);
OutputStream out = new FileOutputStream(XMLFile);
PrintWriter writer = new PrintWriter(out);
TransformerFactory.newInstance().newTransformer().transform(new DOMSource(document), new StreamResult(out));
writer.close();
<?xml version="1.0" encoding="UTF-8"?>
<sDISPlusImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="import.xsd">