javax.xml.stream.events.Namespace.isDefaultNamespaceDeclaration()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(99)

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

Namespace.isDefaultNamespaceDeclaration介绍

[英]returns true if this attribute declares the default namespace
[中]如果此属性声明默认命名空间,则返回true

代码示例

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

public void outputNamespaceDeclarations(Writer w) throws IOException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = (Namespace) mNamespaces.get(i);
    w.write(' ');
    w.write(XMLConstants.XMLNS_ATTRIBUTE);
    if (!ns.isDefaultNamespaceDeclaration()) {
      w.write(':');
      w.write(ns.getPrefix());
    }
    w.write("=\"");
    w.write(ns.getNamespaceURI());
    w.write('"');
  }
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-asl

/**
 * Method called by the matching start element class to
 * output all namespace declarations active in current namespace
 * scope, if any.
 */
public void outputNamespaceDeclarations(XMLStreamWriter w) throws XMLStreamException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = (Namespace) mNamespaces.get(i);
    if (ns.isDefaultNamespaceDeclaration()) {
      w.writeDefaultNamespace(ns.getNamespaceURI());
    } else {
      w.writeNamespace(ns.getPrefix(), ns.getNamespaceURI());
    }
  }
}

代码示例来源:origin: org.jboss.oreva/odata-core

@Override
public boolean isDefaultNamespaceDeclaration() {
 return ((Namespace) real).isDefaultNamespaceDeclaration();
}

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

@Override
public boolean isDefaultNamespaceDeclaration() {
 return ((Namespace) real).isDefaultNamespaceDeclaration();
}

代码示例来源:origin: woodstox/wstx-lgpl

public void outputNamespaceDeclarations(Writer w) throws IOException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = (Namespace) mNamespaces.get(i);
    w.write(' ');
    w.write(XMLConstants.XMLNS_ATTRIBUTE);
    if (!ns.isDefaultNamespaceDeclaration()) {
      w.write(':');
      w.write(ns.getPrefix());
    }
    w.write("=\"");
    w.write(ns.getNamespaceURI());
    w.write('"');
  }
}

代码示例来源:origin: woodstox/wstx-asl

public void outputNamespaceDeclarations(Writer w) throws IOException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = (Namespace) mNamespaces.get(i);
    w.write(' ');
    w.write(XMLConstants.XMLNS_ATTRIBUTE);
    if (!ns.isDefaultNamespaceDeclaration()) {
      w.write(':');
      w.write(ns.getPrefix());
    }
    w.write("=\"");
    w.write(ns.getNamespaceURI());
    w.write('"');
  }
}

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

public void outputNamespaceDeclarations(Writer w) throws IOException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = (Namespace) mNamespaces.get(i);
    w.write(' ');
    w.write(XMLConstants.XMLNS_ATTRIBUTE);
    if (!ns.isDefaultNamespaceDeclaration()) {
      w.write(':');
      w.write(ns.getPrefix());
    }
    w.write("=\"");
    w.write(ns.getNamespaceURI());
    w.write('"');
  }
}

代码示例来源:origin: com.fasterxml.woodstox/woodstox-core

@Override
public void outputNamespaceDeclarations(Writer w) throws IOException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = mNamespaces.get(i);
    w.write(' ');
    w.write(XMLConstants.XMLNS_ATTRIBUTE);
    if (!ns.isDefaultNamespaceDeclaration()) {
      w.write(':');
      w.write(ns.getPrefix());
    }
    w.write("=\"");
    w.write(ns.getNamespaceURI());
    w.write('"');
  }
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-lgpl

public void outputNamespaceDeclarations(Writer w) throws IOException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = (Namespace) mNamespaces.get(i);
    w.write(' ');
    w.write(XMLConstants.XMLNS_ATTRIBUTE);
    if (!ns.isDefaultNamespaceDeclaration()) {
      w.write(':');
      w.write(ns.getPrefix());
    }
    w.write("=\"");
    w.write(ns.getNamespaceURI());
    w.write('"');
  }
}

代码示例来源:origin: org.apache.knox/gateway-provider-rewrite

private void streamNamespaces( StartElement event ) {
 Iterator i = event.getNamespaces();
 while( i.hasNext() ) {
  Namespace ns = (Namespace)i.next();
  writer.write( " xmlns" );
  if( !ns.isDefaultNamespaceDeclaration() ) {
   writer.write( ":" );
   writer.write( ns.getPrefix() );
  }
  writer.write( "=\"" );
  writer.write( ns.getNamespaceURI() );
  writer.write( "\"" );
 }
}

代码示例来源:origin: apache/knox

private void streamNamespaces( StartElement event ) {
 Iterator i = event.getNamespaces();
 while( i.hasNext() ) {
  Namespace ns = (Namespace)i.next();
  writer.write( " xmlns" );
  if( !ns.isDefaultNamespaceDeclaration() ) {
   writer.write( ":" );
   writer.write( ns.getPrefix() );
  }
  writer.write( "=\"" );
  writer.write( ns.getNamespaceURI() );
  writer.write( "\"" );
 }
}

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

public void writeNamespace(Namespace n) 
 throws XMLStreamException
{
 if (n.isDefaultNamespaceDeclaration())
  writer.writeDefaultNamespace(n.getNamespaceURI());
 else
  writer.writeNamespace(n.getPrefix(),
             n.getNamespaceURI());
}
public void addNamespace(Namespace ns)

代码示例来源:origin: org.apache.knox/gateway-provider-rewrite

private void bufferNamespaces( StartElement event, Element element ) {
 Iterator namespaces = event.getNamespaces();
 while( namespaces.hasNext() ) {
  Namespace namespace = (Namespace)namespaces.next();
  if( namespace.isDefaultNamespaceDeclaration() ) {
   element.setAttribute( "xmlns", namespace.getNamespaceURI() );
  } else {
   element.setAttribute( "xmlns:" + namespace.getPrefix(), namespace.getNamespaceURI() );
  }
 }
}

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

private static void printNamespace(Namespace n) {
  if (n.isDefaultNamespaceDeclaration()) 
   System.out.print("xmlns='"+n.getNamespaceURI()+"'");
  else
   System.out.print("xmlns:"+n.getPrefix()+"='"+n.getNamespaceURI()+"'");
 }
}

代码示例来源:origin: Nextdoor/bender

/**
 * Method called by the matching start element class to
 * output all namespace declarations active in current namespace
 * scope, if any.
 */
@Override
public void outputNamespaceDeclarations(XMLStreamWriter w) throws XMLStreamException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = mNamespaces.get(i);
    if (ns.isDefaultNamespaceDeclaration()) {
      w.writeDefaultNamespace(ns.getNamespaceURI());
    } else {
      w.writeNamespace(ns.getPrefix(), ns.getNamespaceURI());
    }
  }
}

代码示例来源:origin: woodstox/wstx-asl

/**
 * Method called by the matching start element class to
 * output all namespace declarations active in current namespace
 * scope, if any.
 */
public void outputNamespaceDeclarations(XMLStreamWriter w) throws XMLStreamException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = (Namespace) mNamespaces.get(i);
    if (ns.isDefaultNamespaceDeclaration()) {
      w.writeDefaultNamespace(ns.getNamespaceURI());
    } else {
      w.writeNamespace(ns.getPrefix(), ns.getNamespaceURI());
    }
  }
}

代码示例来源:origin: woodstox/wstx-lgpl

/**
 * Method called by the matching start element class to
 * output all namespace declarations active in current namespace
 * scope, if any.
 */
public void outputNamespaceDeclarations(XMLStreamWriter w) throws XMLStreamException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = (Namespace) mNamespaces.get(i);
    if (ns.isDefaultNamespaceDeclaration()) {
      w.writeDefaultNamespace(ns.getNamespaceURI());
    } else {
      w.writeNamespace(ns.getPrefix(), ns.getNamespaceURI());
    }
  }
}

代码示例来源:origin: org.codehaus.woodstox/woodstox-core-lgpl

/**
 * Method called by the matching start element class to
 * output all namespace declarations active in current namespace
 * scope, if any.
 */
public void outputNamespaceDeclarations(XMLStreamWriter w) throws XMLStreamException
{
  for (int i = 0, len = mNamespaces.size(); i < len; ++i) {
    Namespace ns = (Namespace) mNamespaces.get(i);
    if (ns.isDefaultNamespaceDeclaration()) {
      w.writeDefaultNamespace(ns.getNamespaceURI());
    } else {
      w.writeNamespace(ns.getPrefix(), ns.getNamespaceURI());
    }
  }
}

代码示例来源:origin: apache/knox

private void bufferNamespaces( StartElement event, Element element ) {
 Iterator namespaces = event.getNamespaces();
 while( namespaces.hasNext() ) {
  Namespace namespace = (Namespace)namespaces.next();
  if( namespace.isDefaultNamespaceDeclaration() ) {
   element.setAttribute( "xmlns", namespace.getNamespaceURI() );
  } else {
   element.setAttribute( "xmlns:" + namespace.getPrefix(), namespace.getNamespaceURI() );
  }
 }
}

代码示例来源:origin: net.java.dev.stax-utils/stax-utils

/**
 * Writes a {@link Namespace} to the provided stream.
 * 
 * @param ns The {@link Namespace} to write.
 * @param writer The destination stream.
 * @throws XMLStreamException If an error occurs writing to the stream.
 */
public static final void writeNamespace(Namespace ns, XMLStreamWriter writer)
    throws XMLStreamException {
  if (ns.isDefaultNamespaceDeclaration()) {
    writer.writeDefaultNamespace(ns.getNamespaceURI());
  } else {
    writer.writeNamespace(ns.getPrefix(), ns.getNamespaceURI());
  }
}

相关文章