本文整理了Java中nu.xom.Element.addNamespaceDeclaration()
方法的一些代码示例,展示了Element.addNamespaceDeclaration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.addNamespaceDeclaration()
方法的具体详情如下:
包路径:nu.xom.Element
类名称:Element
方法名:addNamespaceDeclaration
暂无
代码示例来源:origin: org.springframework.ws/spring-ws-core
private static void convertNamespaces(XMLStreamReader streamReader, Element element) {
for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
String uri = streamReader.getNamespaceURI(i);
String prefix = streamReader.getNamespacePrefix(i);
element.addNamespaceDeclaration(prefix, uri);
}
}
代码示例来源:origin: org.springframework.ws/org.springframework.ws
private static void convertNamespaces(XMLStreamReader streamReader, Element element) {
for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
String uri = streamReader.getNamespaceURI(i);
String prefix = streamReader.getNamespacePrefix(i);
element.addNamespaceDeclaration(prefix, uri);
}
}
代码示例来源:origin: spring-projects/spring-ws
private static void convertNamespaces(XMLStreamReader streamReader, Element element) {
for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
String uri = streamReader.getNamespaceURI(i);
String prefix = streamReader.getNamespacePrefix(i);
element.addNamespaceDeclaration(prefix, uri);
}
}
代码示例来源:origin: apache/servicemix-bundles
private static void convertNamespaces(XMLStreamReader streamReader, Element element) {
for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
String uri = streamReader.getNamespaceURI(i);
String prefix = streamReader.getNamespacePrefix(i);
element.addNamespaceDeclaration(prefix, uri);
}
}
代码示例来源:origin: org.xml-cml/cmlxom
/** override addNamespaceDeclaration(prefix, uri) to make it immutable.
* if namespacePrefix is not set, set it, else returns no-op
* without message.
* @param prefix
* @param uri
*/
public void addNamespaceDeclaration(String prefix, String uri) {
String namespaceURI = this.getNamespaceURI(prefix);
if (namespaceURI == null) {
super.addNamespaceDeclaration(prefix, uri);
}
}
代码示例来源:origin: DSpace/DSpace
/**
* Marshal the data stored in this object into Element objects.
*
* @return An element that holds the data associated with this object.
*/
public Element marshall() {
Element entry = new Element(getQualifiedName(), Namespaces.NS_ATOM);
entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
this.marshallElements(entry);
return entry;
}
代码示例来源:origin: org.dspace/dspace-sword-api
/**
* Marshal the data stored in this object into Element objects.
*
* @return An element that holds the data associated with this object.
*/
public Element marshall()
{
Element entry = new Element(getQualifiedName(), Namespaces.NS_ATOM);
entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
this.marshallElements(entry);
return entry;
}
代码示例来源:origin: org.swordapp/sword-common
/**
* Mashall the data stored in this object into Element objects.
*
* @return An element that holds the data associated with this object.
*/
public Element marshall()
{
Element entry = new Element(getQualifiedName(), Namespaces.NS_ATOM);
entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
this.marshallElements(entry);
return entry;
}
代码示例来源:origin: teiid/teiid
private void readNamespaceDeclaration(ArrayByteList src, Element dst, int type) {
String prefix = readString(src, 4, type);
String uri = readName(src, 6, type);
if (dst != null) dst.addNamespaceDeclaration(prefix, uri);
}
代码示例来源:origin: org.teiid/saxon-xom
private void readNamespaceDeclaration(ArrayByteList src, Element dst, int type) {
String prefix = readString(src, 4, type);
String uri = readName(src, 6, type);
if (dst != null) dst.addNamespaceDeclaration(prefix, uri);
}
代码示例来源:origin: org.xml-cml/cmlxom
/**
* creates a prefixed CMLX attribute (cmlx:foo="bar") on element in CMLX namespace
* @param element
* @param attName UNPREFIXED
* @param attValue
*/
public static void addCMLXAttribute(Element element, String attName, String attValue) {
Attribute attribute = makeCMLXAttribute(attName, attValue);
element.addAttribute(attribute);
element.addNamespaceDeclaration(CMLConstants.CMLX_PREFIX, CMLX_NS);
}
代码示例来源:origin: DSpace/DSpace
/**
* Overrides the marshal method in the parent SWORDEntry. This will
* call the parent marshal method and then add the additional
* elements that have been added in this subclass.
*/
public Element marshall() {
Element entry = new Element(getQualifiedName(), Namespaces.NS_SWORD);
entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
Attribute error = new Attribute("href", errorURI);
entry.addAttribute(error);
super.marshallElements(entry);
return entry;
}
代码示例来源:origin: teiid/teiid
template.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
templates.put(Nodes.class.getName(), template);
代码示例来源:origin: org.teiid/saxon-xom
template.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
templates.put(Nodes.class.getName(), template);
代码示例来源:origin: org.dspace/dspace-sword-api
/**
* Overrides the marshal method in the parent SWORDEntry. This will
* call the parent marshal method and then add the additional
* elements that have been added in this subclass.
*/
public Element marshall()
{
Element entry = new Element(getQualifiedName(), Namespaces.NS_SWORD);
entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
Attribute error = new Attribute("href", errorURI);
entry.addAttribute(error);
super.marshallElements(entry);
return entry;
}
代码示例来源:origin: org.swordapp/sword-common
/**
* Overrides the marshall method in the parent SWORDEntry. This will
* call the parent marshall method and then add the additional
* elements that have been added in this subclass.
*/
public Element marshall()
{
Element entry = new Element(getQualifiedName(), Namespaces.NS_SWORD);
entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
entry.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
Attribute error = new Attribute("href", errorURI);
entry.addAttribute(error);
super.marshallElements(entry);
return entry;
}
代码示例来源:origin: org.xml-cml/cmlxom
/**
* Convenience method to wrap a plain string in an XHTML P element.
*
* @param text
* to wrap
*/
public void addPlainText(String text) {
Element p = new Element("xhtml:p", CMLConstants.XHTML_NS);
p.addNamespaceDeclaration("xhtml", CMLConstants.XHTML_NS);
p.appendChild(text);
this.appendChild(p);
}
代码示例来源:origin: DSpace/DSpace
/**
* Marshal the data in this object to an Element object.
*
* @return A XOM Element that holds the data for this Content element.
*/
public final Element marshall() {
Element service = new Element(getQualifiedName(), Namespaces.NS_APP);
service.addNamespaceDeclaration(Namespaces.PREFIX_ATOM, Namespaces.NS_ATOM);
service.addNamespaceDeclaration(Namespaces.PREFIX_DC_TERMS, Namespaces.NS_DC_TERMS);
service.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
if (swordVersion != null) {
service.appendChild(swordVersion.marshall());
}
if (swordVerbose != null) {
service.appendChild(swordVerbose.marshall());
}
if (swordNoOp != null) {
service.appendChild(swordNoOp.marshall());
}
if (swordMaxUploadSize != null) {
service.appendChild(swordMaxUploadSize.marshall());
}
if (generator != null) {
service.appendChild(generator.marshall());
}
for (Workspace item : workspaces) {
service.appendChild(item.marshall());
}
return service;
}
代码示例来源:origin: net.sf.opendse/opendse-io
/**
* Write the specification to an output stream.
*
* @param specification
* the specification
* @param out
* the output stream
*/
public void write(Specification specification, OutputStream out) {
nu.xom.Element eSpec = toElement(specification);
eSpec.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
eSpec.addAttribute(new nu.xom.Attribute("xsi:schemaLocation", "http://www.w3.org/2001/XMLSchema-instance",
"http://opendse.sourceforge.net http://opendse.sourceforge.net/schema.xsd"));
nu.xom.Document doc = new nu.xom.Document(eSpec);
try {
Serializer serializer = new Serializer(out);
serializer.setIndent(2);
serializer.setMaxLength(2000);
serializer.write(doc);
serializer.flush();
} catch (IOException ex) {
System.out.println(ex + " " + out);
}
}
代码示例来源:origin: com.avast/syringe
public void generateXmlSchema(OutputStream output, boolean excludeOptional) throws Exception {
Element configEl = new Element("config", namespaceUri);
configEl.addNamespaceDeclaration(null, namespaceUri);
for (InjectableProperty property : new ConfigClassAnalyzer(configClass).getConfigProperties()) {
if (excludeOptional && property.isOptional()) {
continue;
}
if (property.isContextual()) {
continue;
}
if (property.isArray()) {
addArrayProperty(configEl, property);
} else if (property.isCollection()) {
addCollectionProperty(configEl, property);
} else if (property.isMap()) {
addMapProperty(configEl, property);
} else if (property.isReference()) {
addReferenceProperty(configEl, property);
} else {
addScalarProperty(configEl, property);
}
}
Serializer serializer = new Serializer(output, "utf-8");
serializer.setIndent(4);
serializer.setMaxLength(160);
serializer.write(new Document(configEl));
}
内容来源于网络,如有侵权,请联系作者删除!