nu.xom.Element.addNamespaceDeclaration()方法的使用及代码示例

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

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

Element.addNamespaceDeclaration介绍

暂无

代码示例

代码示例来源:origin: org.springframework.ws/spring-ws-core

  1. private static void convertNamespaces(XMLStreamReader streamReader, Element element) {
  2. for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
  3. String uri = streamReader.getNamespaceURI(i);
  4. String prefix = streamReader.getNamespacePrefix(i);
  5. element.addNamespaceDeclaration(prefix, uri);
  6. }
  7. }

代码示例来源:origin: org.springframework.ws/org.springframework.ws

  1. private static void convertNamespaces(XMLStreamReader streamReader, Element element) {
  2. for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
  3. String uri = streamReader.getNamespaceURI(i);
  4. String prefix = streamReader.getNamespacePrefix(i);
  5. element.addNamespaceDeclaration(prefix, uri);
  6. }
  7. }

代码示例来源:origin: spring-projects/spring-ws

  1. private static void convertNamespaces(XMLStreamReader streamReader, Element element) {
  2. for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
  3. String uri = streamReader.getNamespaceURI(i);
  4. String prefix = streamReader.getNamespacePrefix(i);
  5. element.addNamespaceDeclaration(prefix, uri);
  6. }
  7. }

代码示例来源:origin: apache/servicemix-bundles

  1. private static void convertNamespaces(XMLStreamReader streamReader, Element element) {
  2. for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
  3. String uri = streamReader.getNamespaceURI(i);
  4. String prefix = streamReader.getNamespacePrefix(i);
  5. element.addNamespaceDeclaration(prefix, uri);
  6. }
  7. }

代码示例来源:origin: org.xml-cml/cmlxom

  1. /** override addNamespaceDeclaration(prefix, uri) to make it immutable.
  2. * if namespacePrefix is not set, set it, else returns no-op
  3. * without message.
  4. * @param prefix
  5. * @param uri
  6. */
  7. public void addNamespaceDeclaration(String prefix, String uri) {
  8. String namespaceURI = this.getNamespaceURI(prefix);
  9. if (namespaceURI == null) {
  10. super.addNamespaceDeclaration(prefix, uri);
  11. }
  12. }

代码示例来源:origin: DSpace/DSpace

  1. /**
  2. * Marshal the data stored in this object into Element objects.
  3. *
  4. * @return An element that holds the data associated with this object.
  5. */
  6. public Element marshall() {
  7. Element entry = new Element(getQualifiedName(), Namespaces.NS_ATOM);
  8. entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
  9. entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
  10. this.marshallElements(entry);
  11. return entry;
  12. }

代码示例来源:origin: org.dspace/dspace-sword-api

  1. /**
  2. * Marshal the data stored in this object into Element objects.
  3. *
  4. * @return An element that holds the data associated with this object.
  5. */
  6. public Element marshall()
  7. {
  8. Element entry = new Element(getQualifiedName(), Namespaces.NS_ATOM);
  9. entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
  10. entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
  11. this.marshallElements(entry);
  12. return entry;
  13. }

代码示例来源:origin: org.swordapp/sword-common

  1. /**
  2. * Mashall the data stored in this object into Element objects.
  3. *
  4. * @return An element that holds the data associated with this object.
  5. */
  6. public Element marshall()
  7. {
  8. Element entry = new Element(getQualifiedName(), Namespaces.NS_ATOM);
  9. entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
  10. entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
  11. this.marshallElements(entry);
  12. return entry;
  13. }

代码示例来源:origin: teiid/teiid

  1. private void readNamespaceDeclaration(ArrayByteList src, Element dst, int type) {
  2. String prefix = readString(src, 4, type);
  3. String uri = readName(src, 6, type);
  4. if (dst != null) dst.addNamespaceDeclaration(prefix, uri);
  5. }

代码示例来源:origin: org.teiid/saxon-xom

  1. private void readNamespaceDeclaration(ArrayByteList src, Element dst, int type) {
  2. String prefix = readString(src, 4, type);
  3. String uri = readName(src, 6, type);
  4. if (dst != null) dst.addNamespaceDeclaration(prefix, uri);
  5. }

代码示例来源:origin: org.xml-cml/cmlxom

  1. /**
  2. * creates a prefixed CMLX attribute (cmlx:foo="bar") on element in CMLX namespace
  3. * @param element
  4. * @param attName UNPREFIXED
  5. * @param attValue
  6. */
  7. public static void addCMLXAttribute(Element element, String attName, String attValue) {
  8. Attribute attribute = makeCMLXAttribute(attName, attValue);
  9. element.addAttribute(attribute);
  10. element.addNamespaceDeclaration(CMLConstants.CMLX_PREFIX, CMLX_NS);
  11. }

代码示例来源:origin: DSpace/DSpace

  1. /**
  2. * Overrides the marshal method in the parent SWORDEntry. This will
  3. * call the parent marshal method and then add the additional
  4. * elements that have been added in this subclass.
  5. */
  6. public Element marshall() {
  7. Element entry = new Element(getQualifiedName(), Namespaces.NS_SWORD);
  8. entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
  9. entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
  10. Attribute error = new Attribute("href", errorURI);
  11. entry.addAttribute(error);
  12. super.marshallElements(entry);
  13. return entry;
  14. }

代码示例来源:origin: teiid/teiid

  1. template.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
  2. templates.put(Nodes.class.getName(), template);

代码示例来源:origin: org.teiid/saxon-xom

  1. template.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
  2. templates.put(Nodes.class.getName(), template);

代码示例来源:origin: org.dspace/dspace-sword-api

  1. /**
  2. * Overrides the marshal method in the parent SWORDEntry. This will
  3. * call the parent marshal method and then add the additional
  4. * elements that have been added in this subclass.
  5. */
  6. public Element marshall()
  7. {
  8. Element entry = new Element(getQualifiedName(), Namespaces.NS_SWORD);
  9. entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
  10. entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
  11. Attribute error = new Attribute("href", errorURI);
  12. entry.addAttribute(error);
  13. super.marshallElements(entry);
  14. return entry;
  15. }

代码示例来源:origin: org.swordapp/sword-common

  1. /**
  2. * Overrides the marshall method in the parent SWORDEntry. This will
  3. * call the parent marshall method and then add the additional
  4. * elements that have been added in this subclass.
  5. */
  6. public Element marshall()
  7. {
  8. Element entry = new Element(getQualifiedName(), Namespaces.NS_SWORD);
  9. entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
  10. entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
  11. Attribute error = new Attribute("href", errorURI);
  12. entry.addAttribute(error);
  13. super.marshallElements(entry);
  14. return entry;
  15. }

代码示例来源:origin: org.xml-cml/cmlxom

  1. /**
  2. * Convenience method to wrap a plain string in an XHTML P element.
  3. *
  4. * @param text
  5. * to wrap
  6. */
  7. public void addPlainText(String text) {
  8. Element p = new Element("xhtml:p", CMLConstants.XHTML_NS);
  9. p.addNamespaceDeclaration("xhtml", CMLConstants.XHTML_NS);
  10. p.appendChild(text);
  11. this.appendChild(p);
  12. }

代码示例来源:origin: DSpace/DSpace

  1. /**
  2. * Marshal the data in this object to an Element object.
  3. *
  4. * @return A XOM Element that holds the data for this Content element.
  5. */
  6. public final Element marshall() {
  7. Element service = new Element(getQualifiedName(), Namespaces.NS_APP);
  8. service.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
  9. service.addNamespaceDeclaration(Namespaces.PREFIX_DC_TERMS, Namespaces.NS_DC_TERMS);
  10. service.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
  11. if (swordVersion != null) {
  12. service.appendChild(swordVersion.marshall());
  13. }
  14. if (swordVerbose != null) {
  15. service.appendChild(swordVerbose.marshall());
  16. }
  17. if (swordNoOp != null) {
  18. service.appendChild(swordNoOp.marshall());
  19. }
  20. if (swordMaxUploadSize != null) {
  21. service.appendChild(swordMaxUploadSize.marshall());
  22. }
  23. if (generator != null) {
  24. service.appendChild(generator.marshall());
  25. }
  26. for (Workspace item : workspaces) {
  27. service.appendChild(item.marshall());
  28. }
  29. return service;
  30. }

代码示例来源:origin: net.sf.opendse/opendse-io

  1. /**
  2. * Write the specification to an output stream.
  3. *
  4. * @param specification
  5. * the specification
  6. * @param out
  7. * the output stream
  8. */
  9. public void write(Specification specification, OutputStream out) {
  10. nu.xom.Element eSpec = toElement(specification);
  11. eSpec.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
  12. eSpec.addAttribute(new nu.xom.Attribute("xsi:schemaLocation", "http://www.w3.org/2001/XMLSchema-instance",
  13. "http://opendse.sourceforge.net http://opendse.sourceforge.net/schema.xsd"));
  14. nu.xom.Document doc = new nu.xom.Document(eSpec);
  15. try {
  16. Serializer serializer = new Serializer(out);
  17. serializer.setIndent(2);
  18. serializer.setMaxLength(2000);
  19. serializer.write(doc);
  20. serializer.flush();
  21. } catch (IOException ex) {
  22. System.out.println(ex + " " + out);
  23. }
  24. }

代码示例来源:origin: com.avast/syringe

  1. public void generateXmlSchema(OutputStream output, boolean excludeOptional) throws Exception {
  2. Element configEl = new Element("config", namespaceUri);
  3. configEl.addNamespaceDeclaration(null, namespaceUri);
  4. for (InjectableProperty property : new ConfigClassAnalyzer(configClass).getConfigProperties()) {
  5. if (excludeOptional && property.isOptional()) {
  6. continue;
  7. }
  8. if (property.isContextual()) {
  9. continue;
  10. }
  11. if (property.isArray()) {
  12. addArrayProperty(configEl, property);
  13. } else if (property.isCollection()) {
  14. addCollectionProperty(configEl, property);
  15. } else if (property.isMap()) {
  16. addMapProperty(configEl, property);
  17. } else if (property.isReference()) {
  18. addReferenceProperty(configEl, property);
  19. } else {
  20. addScalarProperty(configEl, property);
  21. }
  22. }
  23. Serializer serializer = new Serializer(output, "utf-8");
  24. serializer.setIndent(4);
  25. serializer.setMaxLength(160);
  26. serializer.write(new Document(configEl));
  27. }

相关文章