⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 descmeta.java

📁 android_UPNP_DLNA_控制点
💻 JAVA
字号:
/* * Copyright (C) 2010 Teleal GmbH, Switzerland * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program.  If not, see <http://www.gnu.org/licenses/>. */package org.teleal.cling.support.model;import org.w3c.dom.Document;import org.w3c.dom.Element;import javax.xml.parsers.DocumentBuilderFactory;import java.net.URI;/** * Descriptor metadata about an item/resource. * * <pre> * &lt;complexType> *   &lt;complexContent> *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> *       &lt;sequence> *         &lt;any namespace='##other'/> *       &lt;/sequence> *       &lt;attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> *       &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" /> *       &lt;attribute name="nameSpace" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" /> *     &lt;/restriction> *   &lt;/complexContent> * &lt;/complexType> * </pre> *  *  */public class DescMeta<M> {    protected String id;    protected String type;    protected URI nameSpace;    protected M metadata;    public DescMeta() {    }    public DescMeta(String id, String type, URI nameSpace, M metadata) {        this.id = id;        this.type = type;        this.nameSpace = nameSpace;        this.metadata = metadata;    }    public String getId() {        return id;    }    public void setId(String id) {        this.id = id;    }    public String getType() {        return type;    }    public void setType(String type) {        this.type = type;    }    public URI getNameSpace() {        return nameSpace;    }    public void setNameSpace(URI nameSpace) {        this.nameSpace = nameSpace;    }    public M getMetadata() {        return metadata;    }    public void setMetadata(M metadata) {        this.metadata = metadata;    }    public Document createMetadataDocument() {        try {            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();            factory.setNamespaceAware(true);            Document d = factory.newDocumentBuilder().newDocument();            Element rootElement = d.createElementNS(DIDLContent.DESC_WRAPPER_NAMESPACE_URI, "desc-wrapper");            d.appendChild(rootElement);            return d;        } catch (Exception ex) {            throw new RuntimeException(ex);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -