本文整理了Java中org.apache.abdera.model.Element.getQName()
方法的一些代码示例,展示了Element.getQName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getQName()
方法的具体详情如下:
包路径:org.apache.abdera.model.Element
类名称:Element
方法名:getQName
[英]Return the XML QName of this element
[中]返回此元素的XML QName
代码示例来源:origin: org.apache.abdera/abdera-core
public QName getQName() {
return internal.getQName();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
public QName getQName() {
return internal.getQName();
}
代码示例来源:origin: org.apache.abdera/abdera-core
@SuppressWarnings("unchecked")
public <T extends Element> T getElementWrapper(Element internal) {
T t = null;
QName qname = internal.getQName();
Class<? extends ElementWrapper> impl = impls.get(qname);
if (impl != null) {
try {
t = (T)impl.getConstructor(new Class[] {Element.class}).newInstance(new Object[] {internal});
} catch (Exception e) {
}
}
return t != null ? t : (T)internal;
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public <T extends Element> T getElementWrapper(Element internal) {
if (internal == null)
return null;
String ns = internal.getQName().getNamespaceURI();
return (T)((ATOM_NS.equals(ns) || APP_NS.equals(ns) || internal.getQName().equals(DIV)) ? internal
: factoriesMap.getElementWrapper(internal));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
@SuppressWarnings("unchecked")
public <T extends Element> T getElementWrapper(Element internal) {
T t = null;
QName qname = internal.getQName();
Class<? extends ElementWrapper> impl = impls.get(qname);
if (impl != null) {
try {
t = (T)impl.getConstructor(
new Class[] {Element.class}).newInstance(
new Object[] {internal});
} catch (Exception e) {}
}
return t != null ? t : (T)internal;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
@SuppressWarnings("unchecked")
public <T extends Base> String getMimeType(T base) {
Element element = base instanceof Element ? (Element)base :
base instanceof Document ? ((Document)base).getRoot() :
null;
QName qname = element != null ? element.getQName() : null;
return element != null && qname != null ? mimetypes.get(qname) : null;
}
代码示例来源:origin: org.apache.abdera/abdera-core
@SuppressWarnings("unchecked")
public <T extends Base> String getMimeType(T base) {
Element element =
base instanceof Element ? (Element)base : base instanceof Document ? ((Document)base).getRoot() : null;
QName qname = element != null ? element.getQName() : null;
return element != null && qname != null ? mimetypes.get(qname) : null;
}
代码示例来源:origin: org.apache.abdera/abdera-security
public boolean isEncrypted(Document doc) throws SecurityException {
Element el = doc.getRoot();
return el.getQName().equals(Constants.ENCRYPTEDDATA);
}
代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite
@Override
protected void runTest() throws Throwable {
Collection collection = abdera.getFactory().newCollection();
collection.setAccept("image/png", "image/jpeg");
List<Element> children = collection.getElements();
assertThat(children).hasSize(2);
assertThat(children.get(0).getQName()).isEqualTo(Constants.ACCEPT);
assertThat(children.get(0).getText()).isEqualTo("image/png");
assertThat(children.get(1).getQName()).isEqualTo(Constants.ACCEPT);
assertThat(children.get(1).getText()).isEqualTo("image/jpeg");
}
}
代码示例来源:origin: org.apache.abdera/abdera-core
public <T extends Base> String getMimeType(T base) {
Element element = base instanceof Element ? (Element)base : ((Document<?>)base).getRoot();
String namespace = element.getQName().getNamespaceURI();
synchronized (factories) {
for (ExtensionFactory factory : factories) {
if (factory.handlesNamespace(namespace))
return factory.getMimeType(base);
}
}
return null;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
public <T extends Base> String getMimeType(T base) {
Element element = base instanceof Element ? (Element)base : ((Document)base).getRoot();
String namespace = element.getQName().getNamespaceURI();
synchronized(factories) {
for (ExtensionFactory factory : factories) {
if (factory.handlesNamespace(namespace))
return factory.getMimeType(base);
}
}
return null;
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public <T extends ExtensibleElement> T addExtension(Element extension) {
complete();
if (extension instanceof ElementWrapper) {
ElementWrapper wrapper = (ElementWrapper)extension;
extension = wrapper.getInternal();
}
QName qname = extension.getQName();
String prefix = qname.getPrefix();
declareIfNecessary(qname.getNamespaceURI(), prefix);
addChild((OMElement)extension);
return (T)this;
}
代码示例来源:origin: org.apache.abdera/abdera-server
/**
* Return false if the element contains any extension elements that are not supported
*/
public static boolean checkElementNamespaces(Element element, List<String> ignore) {
List<QName> attrs = element.getExtensionAttributes();
for (QName qname : attrs) {
String ns = qname.getNamespaceURI();
if (!ignore.contains(ns))
return false;
}
if (element instanceof ExtensibleElement) {
ExtensibleElement ext = (ExtensibleElement)element;
List<Element> extensions = ext.getExtensions();
for (Element el : extensions) {
QName qname = el.getQName();
String ns = qname.getNamespaceURI();
if (!ignore.contains(ns))
return false;
if (!checkElementNamespaces(el, ignore))
return false;
}
}
return true;
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-geo
public static Position getAsPosition(Element element) {
Position pos = null;
QName qname = element.getQName();
String text = element.getText();
if (qname.equals(QNAME_GML_POINT)) {
代码示例来源:origin: org.apache.abdera/abdera-extensions-json
private static void writeElementChildren(Element element, JSONStream jstream) throws IOException {
jstream.startArray();
Object[] children = getChildren(element);
QName parentqname = element.getQName();
for (int n = 0; n < children.length; n++) {
Object child = children[n];
if (child instanceof Element) {
writeElement((Element)child, parentqname, jstream);
if (n < children.length - 1)
jstream.writeSeparator();
} else if (child instanceof TextValue) {
TextValue textvalue = (TextValue)child;
String value = textvalue.getText();
if (!element.getMustPreserveWhitespace()) {
if (!value.matches("\\s*")) {
jstream.writeQuoted(value.trim());
if (n < children.length - 1)
jstream.writeSeparator();
}
} else {
jstream.writeQuoted(value);
if (n < children.length - 1)
jstream.writeSeparator();
}
}
}
jstream.endArray();
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-json
private static void writeElement(Element child, QName parentqname, JSONStream jstream) throws IOException {
QName childqname = child.getQName();
String prefix = childqname.getPrefix();
jstream.startObject();
代码示例来源:origin: org.apache.abdera/abdera-extensions-json
private static void toJson(Document document, JSONStream jstream) throws IOException {
jstream.startObject();
jstream.writeField("base", document.getBaseUri());
jstream.writeField("content-type", document.getContentType());
jstream.writeField("etag", document.getEntityTag());
jstream.writeField("language", document.getLanguage());
jstream.writeField("slug", document.getSlug());
jstream.writeField("last-modified", document.getLastModified());
Element root = document.getRoot();
if (root != null) {
String rootname = root.getQName().getLocalPart();
writeElement(rootname, document.getRoot(), jstream);
}
jstream.endObject();
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-serializer
protected void process(Object source,
ObjectContext objectContext,
SerializationContext context,
Conventions conventions) {
StreamWriter sw = context.getStreamWriter();
if (!(source instanceof Element))
return;
Element element = (Element)source;
sw.startElement(element.getQName());
for (QName attr : element.getAttributes())
sw.writeAttribute(attr, element.getAttributeValue(attr));
XPath xpath = context.getAbdera().getXPath();
List<?> children = xpath.selectNodes("node()", element);
for (Object child : children) {
if (child instanceof Element) {
process(child, new ObjectContext(child), context, conventions);
} else if (child instanceof Comment) {
Comment comment = (Comment)child;
sw.writeComment(comment.getText());
} else if (child instanceof ProcessingInstruction) {
ProcessingInstruction pi = (ProcessingInstruction)child;
sw.writePI(pi.getText(), pi.getTarget());
} else if (child instanceof TextValue) {
TextValue tv = (TextValue)child;
sw.writeElementText(tv.getText());
}
}
sw.endElement();
}
内容来源于网络,如有侵权,请联系作者删除!