org.apache.abdera.model.Element.getQName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(304)

本文整理了Java中org.apache.abdera.model.Element.getQName()方法的一些代码示例,展示了Element.getQName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getQName()方法的具体详情如下:
包路径:org.apache.abdera.model.Element
类名称:Element
方法名:getQName

Element.getQName介绍

[英]Return the XML QName of this element
[中]返回此元素的XML QName

代码示例

代码示例来源:origin: org.apache.abdera/abdera-core

  1. public QName getQName() {
  2. return internal.getQName();
  3. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

  1. public QName getQName() {
  2. return internal.getQName();
  3. }

代码示例来源:origin: org.apache.abdera/abdera-core

  1. @SuppressWarnings("unchecked")
  2. public <T extends Element> T getElementWrapper(Element internal) {
  3. T t = null;
  4. QName qname = internal.getQName();
  5. Class<? extends ElementWrapper> impl = impls.get(qname);
  6. if (impl != null) {
  7. try {
  8. t = (T)impl.getConstructor(new Class[] {Element.class}).newInstance(new Object[] {internal});
  9. } catch (Exception e) {
  10. }
  11. }
  12. return t != null ? t : (T)internal;
  13. }

代码示例来源:origin: org.apache.abdera/abdera-parser

  1. public <T extends Element> T getElementWrapper(Element internal) {
  2. if (internal == null)
  3. return null;
  4. String ns = internal.getQName().getNamespaceURI();
  5. return (T)((ATOM_NS.equals(ns) || APP_NS.equals(ns) || internal.getQName().equals(DIV)) ? internal
  6. : factoriesMap.getElementWrapper(internal));
  7. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

  1. @SuppressWarnings("unchecked")
  2. public <T extends Element> T getElementWrapper(Element internal) {
  3. T t = null;
  4. QName qname = internal.getQName();
  5. Class<? extends ElementWrapper> impl = impls.get(qname);
  6. if (impl != null) {
  7. try {
  8. t = (T)impl.getConstructor(
  9. new Class[] {Element.class}).newInstance(
  10. new Object[] {internal});
  11. } catch (Exception e) {}
  12. }
  13. return t != null ? t : (T)internal;
  14. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

  1. @SuppressWarnings("unchecked")
  2. public <T extends Base> String getMimeType(T base) {
  3. Element element = base instanceof Element ? (Element)base :
  4. base instanceof Document ? ((Document)base).getRoot() :
  5. null;
  6. QName qname = element != null ? element.getQName() : null;
  7. return element != null && qname != null ? mimetypes.get(qname) : null;
  8. }

代码示例来源:origin: org.apache.abdera/abdera-core

  1. @SuppressWarnings("unchecked")
  2. public <T extends Base> String getMimeType(T base) {
  3. Element element =
  4. base instanceof Element ? (Element)base : base instanceof Document ? ((Document)base).getRoot() : null;
  5. QName qname = element != null ? element.getQName() : null;
  6. return element != null && qname != null ? mimetypes.get(qname) : null;
  7. }

代码示例来源:origin: org.apache.abdera/abdera-security

  1. public boolean isEncrypted(Document doc) throws SecurityException {
  2. Element el = doc.getRoot();
  3. return el.getQName().equals(Constants.ENCRYPTEDDATA);
  4. }

代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite

  1. @Override
  2. protected void runTest() throws Throwable {
  3. Collection collection = abdera.getFactory().newCollection();
  4. collection.setAccept("image/png", "image/jpeg");
  5. List<Element> children = collection.getElements();
  6. assertThat(children).hasSize(2);
  7. assertThat(children.get(0).getQName()).isEqualTo(Constants.ACCEPT);
  8. assertThat(children.get(0).getText()).isEqualTo("image/png");
  9. assertThat(children.get(1).getQName()).isEqualTo(Constants.ACCEPT);
  10. assertThat(children.get(1).getText()).isEqualTo("image/jpeg");
  11. }
  12. }

代码示例来源:origin: org.apache.abdera/abdera-core

  1. public <T extends Base> String getMimeType(T base) {
  2. Element element = base instanceof Element ? (Element)base : ((Document<?>)base).getRoot();
  3. String namespace = element.getQName().getNamespaceURI();
  4. synchronized (factories) {
  5. for (ExtensionFactory factory : factories) {
  6. if (factory.handlesNamespace(namespace))
  7. return factory.getMimeType(base);
  8. }
  9. }
  10. return null;
  11. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

  1. public <T extends Base> String getMimeType(T base) {
  2. Element element = base instanceof Element ? (Element)base : ((Document)base).getRoot();
  3. String namespace = element.getQName().getNamespaceURI();
  4. synchronized(factories) {
  5. for (ExtensionFactory factory : factories) {
  6. if (factory.handlesNamespace(namespace))
  7. return factory.getMimeType(base);
  8. }
  9. }
  10. return null;
  11. }

代码示例来源:origin: org.apache.abdera/abdera-parser

  1. public <T extends ExtensibleElement> T addExtension(Element extension) {
  2. complete();
  3. if (extension instanceof ElementWrapper) {
  4. ElementWrapper wrapper = (ElementWrapper)extension;
  5. extension = wrapper.getInternal();
  6. }
  7. QName qname = extension.getQName();
  8. String prefix = qname.getPrefix();
  9. declareIfNecessary(qname.getNamespaceURI(), prefix);
  10. addChild((OMElement)extension);
  11. return (T)this;
  12. }

代码示例来源:origin: org.apache.abdera/abdera-server

  1. /**
  2. * Return false if the element contains any extension elements that are not supported
  3. */
  4. public static boolean checkElementNamespaces(Element element, List<String> ignore) {
  5. List<QName> attrs = element.getExtensionAttributes();
  6. for (QName qname : attrs) {
  7. String ns = qname.getNamespaceURI();
  8. if (!ignore.contains(ns))
  9. return false;
  10. }
  11. if (element instanceof ExtensibleElement) {
  12. ExtensibleElement ext = (ExtensibleElement)element;
  13. List<Element> extensions = ext.getExtensions();
  14. for (Element el : extensions) {
  15. QName qname = el.getQName();
  16. String ns = qname.getNamespaceURI();
  17. if (!ignore.contains(ns))
  18. return false;
  19. if (!checkElementNamespaces(el, ignore))
  20. return false;
  21. }
  22. }
  23. return true;
  24. }

代码示例来源:origin: org.apache.abdera/abdera-extensions-geo

  1. public static Position getAsPosition(Element element) {
  2. Position pos = null;
  3. QName qname = element.getQName();
  4. String text = element.getText();
  5. if (qname.equals(QNAME_GML_POINT)) {

代码示例来源:origin: org.apache.abdera/abdera-extensions-json

  1. private static void writeElementChildren(Element element, JSONStream jstream) throws IOException {
  2. jstream.startArray();
  3. Object[] children = getChildren(element);
  4. QName parentqname = element.getQName();
  5. for (int n = 0; n < children.length; n++) {
  6. Object child = children[n];
  7. if (child instanceof Element) {
  8. writeElement((Element)child, parentqname, jstream);
  9. if (n < children.length - 1)
  10. jstream.writeSeparator();
  11. } else if (child instanceof TextValue) {
  12. TextValue textvalue = (TextValue)child;
  13. String value = textvalue.getText();
  14. if (!element.getMustPreserveWhitespace()) {
  15. if (!value.matches("\\s*")) {
  16. jstream.writeQuoted(value.trim());
  17. if (n < children.length - 1)
  18. jstream.writeSeparator();
  19. }
  20. } else {
  21. jstream.writeQuoted(value);
  22. if (n < children.length - 1)
  23. jstream.writeSeparator();
  24. }
  25. }
  26. }
  27. jstream.endArray();
  28. }

代码示例来源:origin: org.apache.abdera/abdera-extensions-json

  1. private static void writeElement(Element child, QName parentqname, JSONStream jstream) throws IOException {
  2. QName childqname = child.getQName();
  3. String prefix = childqname.getPrefix();
  4. jstream.startObject();

代码示例来源:origin: org.apache.abdera/abdera-extensions-json

  1. private static void toJson(Document document, JSONStream jstream) throws IOException {
  2. jstream.startObject();
  3. jstream.writeField("base", document.getBaseUri());
  4. jstream.writeField("content-type", document.getContentType());
  5. jstream.writeField("etag", document.getEntityTag());
  6. jstream.writeField("language", document.getLanguage());
  7. jstream.writeField("slug", document.getSlug());
  8. jstream.writeField("last-modified", document.getLastModified());
  9. Element root = document.getRoot();
  10. if (root != null) {
  11. String rootname = root.getQName().getLocalPart();
  12. writeElement(rootname, document.getRoot(), jstream);
  13. }
  14. jstream.endObject();
  15. }

代码示例来源:origin: org.apache.abdera/abdera-extensions-serializer

  1. protected void process(Object source,
  2. ObjectContext objectContext,
  3. SerializationContext context,
  4. Conventions conventions) {
  5. StreamWriter sw = context.getStreamWriter();
  6. if (!(source instanceof Element))
  7. return;
  8. Element element = (Element)source;
  9. sw.startElement(element.getQName());
  10. for (QName attr : element.getAttributes())
  11. sw.writeAttribute(attr, element.getAttributeValue(attr));
  12. XPath xpath = context.getAbdera().getXPath();
  13. List<?> children = xpath.selectNodes("node()", element);
  14. for (Object child : children) {
  15. if (child instanceof Element) {
  16. process(child, new ObjectContext(child), context, conventions);
  17. } else if (child instanceof Comment) {
  18. Comment comment = (Comment)child;
  19. sw.writeComment(comment.getText());
  20. } else if (child instanceof ProcessingInstruction) {
  21. ProcessingInstruction pi = (ProcessingInstruction)child;
  22. sw.writePI(pi.getText(), pi.getTarget());
  23. } else if (child instanceof TextValue) {
  24. TextValue tv = (TextValue)child;
  25. sw.writeElementText(tv.getText());
  26. }
  27. }
  28. sw.endElement();
  29. }

相关文章