本文整理了Java中org.jdom.DocType.getPublicID()
方法的一些代码示例,展示了DocType.getPublicID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DocType.getPublicID()
方法的具体详情如下:
包路径:org.jdom.DocType
类名称:DocType
方法名:getPublicID
[英]This will retrieve the public ID of an externally referenced DTD, or an empty String
if none is referenced.
[中]这将检索外部引用的DTD的公共ID,如果没有引用,则检索空的String
。
代码示例来源:origin: org.freemarker/freemarker
public List operate(Object node) {
if (node instanceof Element)
return Collections.singletonList(((Element) node).getName());
else if (node instanceof Attribute)
return Collections.singletonList(((Attribute) node).getName());
else if (node instanceof EntityRef)
return Collections.singletonList(((EntityRef) node).getName());
else if (node instanceof ProcessingInstruction)
return Collections.singletonList(((ProcessingInstruction) node).getTarget());
else if (node instanceof DocType)
return Collections.singletonList(((DocType) node).getPublicID());
else
return null;
// With 2.1 semantics it makes more sense to just return a null and let the core
// throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
// throw new TemplateModelException("_name can not be applied on " + node.getClass());
}
}
代码示例来源:origin: org.freemarker/freemarker
public Object exec(List arguments) {
Set names = new HashSet(arguments);
List list = new LinkedList(nodes);
Iterator it = list.iterator();
while (it.hasNext()) {
Object node = it.next();
String name = null;
if (node instanceof Element)
name = ((Element) node).getName();
else if (node instanceof Attribute)
name = ((Attribute) node).getName();
else if (node instanceof ProcessingInstruction)
name = ((ProcessingInstruction) node).getTarget();
else if (node instanceof EntityRef)
name = ((EntityRef) node).getName();
else if (node instanceof DocType)
name = ((DocType) node).getPublicID();
if (name == null || !names.contains(name))
it.remove();
}
return createNodeListModel(list, namespaces);
}
}
代码示例来源:origin: org.freemarker/freemarker
DocType doctype = (DocType) node;
if ("publicId".equals(localName)) {
result.add(new Attribute("publicId", doctype.getPublicID()));
} else if ("systemId".equals(localName)) {
result.add(new Attribute("systemId", doctype.getSystemID()));
代码示例来源:origin: org.freemarker/freemarker
DocType doctype = (DocType) node;
if ("publicId".equals(localName))
attr = new Attribute("publicId", doctype.getPublicID());
else if ("systemId".equals(localName))
attr = new Attribute("systemId", doctype.getSystemID());
代码示例来源:origin: org.codehaus.cargo/cargo-core-api-module
/**
* Returns the version corresponding to the given document type.
*
* @param theDocType The document type
* @return The version that matches the document type, or <code>null</code> if the doctype is
* not recognized
* @throws NullPointerException If the document type is <code>null</code>
*/
public static ApplicationXmlVersion valueOf(DocType theDocType) throws NullPointerException
{
return valueOf(theDocType.getPublicID());
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Returns the version corresponding to the given document type.
*
* @param theDocType The document type
* @return The version that matches the document type, or <code>null</code> if the doctype is
* not recognized
* @throws NullPointerException If the document type is <code>null</code>
*/
public static ApplicationXmlVersion valueOf(DocType theDocType) throws NullPointerException
{
return valueOf(theDocType.getPublicID());
}
代码示例来源:origin: org.codehaus.cargo/cargo-core-api-module
/**
* Returns the version corresponding to the given document type.
*
* @param theDocType The document type
*
* @return The version that matches the document type, or <code>null</code> if the doctype is
* not recognized
*
* @throws NullPointerException If the document type is <code>null</code>
*/
public static WebXmlVersion valueOf(DocType theDocType) throws NullPointerException
{
return valueOf(theDocType.getPublicID());
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Returns the version corresponding to the given document type.
*
* @param theDocType The document type
*
* @return The version that matches the document type, or <code>null</code> if the doctype is
* not recognized
*
* @throws NullPointerException If the document type is <code>null</code>
*/
public static WebXmlVersion valueOf(DocType theDocType) throws NullPointerException
{
return valueOf(theDocType.getPublicID());
}
代码示例来源:origin: org.freemarker/freemarker-gae
public List operate(Object node) {
if (node instanceof Element)
return Collections.singletonList(((Element) node).getName());
else if (node instanceof Attribute)
return Collections.singletonList(((Attribute) node).getName());
else if (node instanceof EntityRef)
return Collections.singletonList(((EntityRef) node).getName());
else if (node instanceof ProcessingInstruction)
return Collections.singletonList(((ProcessingInstruction) node).getTarget());
else if (node instanceof DocType)
return Collections.singletonList(((DocType) node).getPublicID());
else
return null;
// With 2.1 semantics it makes more sense to just return a null and let the core
// throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
// throw new TemplateModelException("_name can not be applied on " + node.getClass());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
public List operate(Object node) {
if (node instanceof Element)
return Collections.singletonList(((Element) node).getName());
else if (node instanceof Attribute)
return Collections.singletonList(((Attribute) node).getName());
else if (node instanceof EntityRef)
return Collections.singletonList(((EntityRef) node).getName());
else if (node instanceof ProcessingInstruction)
return Collections.singletonList(((ProcessingInstruction) node).getTarget());
else if (node instanceof DocType)
return Collections.singletonList(((DocType) node).getPublicID());
else
return null;
// With 2.1 semantics it makes more sense to just return a null and let the core
// throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
// throw new TemplateModelException("_name can not be applied on " + node.getClass());
}
}
代码示例来源:origin: org.freemarker/freemarker-gae
public Object exec(List arguments) {
Set names = new HashSet(arguments);
List list = new LinkedList(nodes);
Iterator it = list.iterator();
while (it.hasNext()) {
Object node = it.next();
String name = null;
if (node instanceof Element)
name = ((Element) node).getName();
else if (node instanceof Attribute)
name = ((Attribute) node).getName();
else if (node instanceof ProcessingInstruction)
name = ((ProcessingInstruction) node).getTarget();
else if (node instanceof EntityRef)
name = ((EntityRef) node).getName();
else if (node instanceof DocType)
name = ((DocType) node).getPublicID();
if (name == null || !names.contains(name))
it.remove();
}
return createNodeListModel(list, namespaces);
}
}
代码示例来源:origin: org.freemarker/com.springsource.freemarker
public Object exec(List arguments)
{
Set names = new HashSet(arguments);
List list = new LinkedList(nodes);
Iterator it = list.iterator();
while (it.hasNext()) {
Object node = it.next();
String name = null;
if (node instanceof Element)
name = ((Element)node).getName();
else if (node instanceof Attribute)
name = ((Attribute)node).getName();
else if (node instanceof ProcessingInstruction)
name = ((ProcessingInstruction)node).getTarget();
else if (node instanceof EntityRef)
name = ((EntityRef)node).getName();
else if (node instanceof DocType)
name = ((DocType)node).getPublicID();
if (name == null || !names.contains(name))
it.remove();
}
return createNodeListModel(list, namespaces);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
public Object exec(List arguments) {
Set names = new HashSet(arguments);
List list = new LinkedList(nodes);
Iterator it = list.iterator();
while (it.hasNext()) {
Object node = it.next();
String name = null;
if (node instanceof Element)
name = ((Element) node).getName();
else if (node instanceof Attribute)
name = ((Attribute) node).getName();
else if (node instanceof ProcessingInstruction)
name = ((ProcessingInstruction) node).getTarget();
else if (node instanceof EntityRef)
name = ((EntityRef) node).getName();
else if (node instanceof DocType)
name = ((DocType) node).getPublicID();
if (name == null || !names.contains(name))
it.remove();
}
return createNodeListModel(list, namespaces);
}
}
代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication
public boolean isMyType(Document document) {
boolean ok = false;
Element rssRoot = document.getRootElement();
ok = rssRoot.getName().equals("rss");
if (ok) {
ok = false;
Attribute version = rssRoot.getAttribute("version");
if (version!=null) {
ok = version.getValue().equals(getRSSVersion());
if (ok) {
ok = false;
DocType docType = document.getDocType();
if (docType!=null) {
ok = ELEMENT_NAME.equals(docType.getElementName());
ok = ok && PUBLIC_ID.equals(docType.getPublicID());
ok = ok && SYSTEM_ID.equals(docType.getSystemID());
}
}
}
}
return ok;
}
代码示例来源:origin: rome/rome
public boolean isMyType(Document document) {
boolean ok = false;
Element rssRoot = document.getRootElement();
ok = rssRoot.getName().equals("rss");
if (ok) {
ok = false;
Attribute version = rssRoot.getAttribute("version");
if (version!=null) {
ok = version.getValue().equals(getRSSVersion());
if (ok) {
ok = false;
DocType docType = document.getDocType();
if (docType!=null) {
ok = ELEMENT_NAME.equals(docType.getElementName());
ok = ok && PUBLIC_ID.equals(docType.getPublicID());
ok = ok && SYSTEM_ID.equals(docType.getSystemID());
}
}
}
}
return ok;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
DocType doctype = (DocType) node;
if ("publicId".equals(localName))
attr = new Attribute("publicId", doctype.getPublicID());
else if ("systemId".equals(localName))
attr = new Attribute("systemId", doctype.getSystemID());
代码示例来源:origin: org.freemarker/com.springsource.freemarker
DocType doctype = (DocType)node;
if ("publicId".equals(localName))
attr = new Attribute("publicId", doctype.getPublicID());
else if ("systemId".equals(localName))
attr = new Attribute("systemId", doctype.getSystemID());
代码示例来源:origin: org.freemarker/com.springsource.freemarker
public List operate(Object node)
{
if (node instanceof Element)
return Collections12.singletonList(((Element)node).getName());
else if (node instanceof Attribute)
return Collections12.singletonList(((Attribute)node).getName());
else if (node instanceof EntityRef)
return Collections12.singletonList(((EntityRef)node).getName());
else if (node instanceof ProcessingInstruction)
return Collections12.singletonList(((ProcessingInstruction)node).getTarget());
else if (node instanceof DocType)
return Collections12.singletonList(((DocType)node).getPublicID());
else
return null;
// With 2.1 semantics it makes more sense to just return a null and let the core
// throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
// throw new TemplateModelException("_name can not be applied on " + node.getClass());
}
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* <p>
* This method tells you the line of the XML file being parsed.
* For an in-memory document, it's meaningless. The location
* is only valid for the current parsing lifecycle, but
* the document has already been parsed. Therefore, it returns
* -1 for both line and column numbers.
* </p>
*
* @param document JDOM <code>Document</code>.
*/
private void documentLocator(Document document) {
locator = new JDOMLocator();
String publicID = null;
String systemID = null;
if (document != null) {
DocType docType = document.getDocType();
if (docType != null) {
publicID = docType.getPublicID();
systemID = docType.getSystemID();
}
}
locator.setPublicId(publicID);
locator.setSystemId(systemID);
locator.setLineNumber(-1);
locator.setColumnNumber(-1);
contentHandler.setDocumentLocator(locator);
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This creates an empty <code>Document</code> object based
* on a specific parser implementation with the given DOCTYPE.
* If the doctype parameter is null, the behavior is the same as
* calling <code>createDocument()</code>.
*
* @param doctype Initial <code>DocType</code> of the document.
* @return <code>Document</code> - created DOM Document.
* @throws JDOMException when errors occur.
*/
public Document createDocument(DocType doctype) throws JDOMException {
if (doctype == null) {
return createDocument();
}
DOMImplementation domImpl = createDocument().getImplementation();
DocumentType domDocType = domImpl.createDocumentType(
doctype.getElementName(),
doctype.getPublicID(),
doctype.getSystemID());
// Set the internal subset if possible
setInternalSubset(domDocType, doctype.getInternalSubset());
return domImpl.createDocument("http://temporary",
doctype.getElementName(),
domDocType);
}
内容来源于网络,如有侵权,请联系作者删除!