gpt4 book ai didi

org.eclipse.persistence.internal.oxm.XPathFragment.isGeneratedPrefix()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 03:25:05 26 4
gpt4 key购买 nike

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

XPathFragment.isGeneratedPrefix介绍

暂无

代码示例

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  super.openStartElement(xPathFragment, namespaceResolver);
    if (isStartElementOpen) {
      builder.append('>');
    }
    isStartElementOpen = true;
    builder.append('<');
    builder.append(getNameForFragment(xPathFragment));
    if(xPathFragment.isGeneratedPrefix()){
      namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
    }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  super.openStartElement(xPathFragment, namespaceResolver);
    if (isStartElementOpen) {
      builder.append('>');
    }
    isStartElementOpen = true;
    builder.append('<');
    builder.append(getNameForFragment(xPathFragment));
    if(xPathFragment.isGeneratedPrefix()){
      namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
    }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  this.addPositionalNodes(xPathFragment, namespaceResolver);
    if (isStartElementOpen) {
      builder.append('>');
    }
    if (!isLastEventText) {
      if (numberOfTabs > 0) {
        builder.append(cr);
      }
      for (int x = 0; x < numberOfTabs; x++) {
        builder.append(tab());
      }
    }
    isStartElementOpen = true;
    builder.append('<');
    builder.append(getNameForFragment(xPathFragment));
    if(xPathFragment.isGeneratedPrefix()){
      namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
    }
    numberOfTabs++;
    isLastEventText = false;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  this.addPositionalNodes(xPathFragment, namespaceResolver);
    if (isStartElementOpen) {
      builder.append('>');
    }
    if (!isLastEventText) {
      if (numberOfTabs > 0) {
        builder.append(cr);
      }
      for (int x = 0; x < numberOfTabs; x++) {
        builder.append(tab());
      }
    }
    isStartElementOpen = true;
    builder.append('<');
    builder.append(getNameForFragment(xPathFragment));
    if(xPathFragment.isGeneratedPrefix()){
      namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
    }
    numberOfTabs++;
    isLastEventText = false;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

public Element createUnownedElement(Node parent, XMLField xmlField) {
  XPathFragment lastFragment = xmlField.getXPathFragment();
  while (lastFragment.getNextFragment() != null) {
    lastFragment = lastFragment.getNextFragment();
  }
  String nodeName = lastFragment.getShortName();
  String namespace = resolveNamespacePrefix(lastFragment, getNamespaceResolverForField(xmlField));
  Element elem = parent.getOwnerDocument().createElementNS(namespace, nodeName);
  if (lastFragment.isGeneratedPrefix()) {
    elem.setAttributeNS(XMLConstants.XMLNS_URL, XMLConstants.XMLNS + XMLConstants.COLON + lastFragment.getPrefix(), lastFragment.getNamespaceURI());
  }
  return elem;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  try {
    super.openStartElement(xPathFragment, namespaceResolver);
    Element element = document.createElementNS(xPathFragment.getNamespaceURI(), getNameForFragment(xPathFragment));            
    node = node.appendChild(element);
    if(xPathFragment.isGeneratedPrefix()){
      namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
    }
  } catch (DOMException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  try {
    super.openStartElement(xPathFragment, namespaceResolver);
    Element element = document.createElementNS(xPathFragment.getNamespaceURI(), getNameForFragment(xPathFragment));
    node = node.appendChild(element);
    if(xPathFragment.isGeneratedPrefix()){
      namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
    }
  } catch (DOMException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  super.openStartElement(xPathFragment, namespaceResolver);
  try {
    String namespaceURI = xPathFragment.getNamespaceURI();
    if(namespaceURI == null) {
      NamespaceContext namespaceContext = xmlStreamWriter.getNamespaceContext();
      if(null == namespaceContext) {
        xmlStreamWriter.writeStartElement(xPathFragment.getLocalName());
      } else {
        String defaultNamespace = namespaceContext.getNamespaceURI(Constants.EMPTY_STRING);
        xmlStreamWriter.writeStartElement(Constants.EMPTY_STRING, xPathFragment.getLocalName(), Constants.EMPTY_STRING);
        if(defaultNamespace != null && defaultNamespace.length() > 0 ) {
          xmlStreamWriter.writeDefaultNamespace(Constants.EMPTY_STRING);
        }
      }
    } else {
      String prefix = getPrefixForFragment(xPathFragment);
      if(prefix == null) {
        prefix = Constants.EMPTY_STRING;
      }
      xmlStreamWriter.writeStartElement(prefix, xPathFragment.getLocalName(), namespaceURI);
      if(xPathFragment.isGeneratedPrefix()){
        namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
      }
    }
    writePrefixMappings();
  } catch(XMLStreamException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

String namespace = resolveNamespacePrefix(fragment, getNamespaceResolverForField(xmlField));
element = parent.getOwnerDocument().createElementNS(namespace, fragment.getXPath());
if (fragment.isGeneratedPrefix()) {
  element.setAttributeNS(XMLConstants.XMLNS_URL, XMLConstants.XMLNS + XMLConstants.COLON + fragment.getPrefix(), fragment.getNamespaceURI());

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

if(xPathFragment.isGeneratedPrefix()){
  namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

public Element createUnownedElement(Node parent, Field xmlField) {
  XPathFragment lastFragment = xmlField.getXPathFragment();
  while (lastFragment.getNextFragment() != null) {
    lastFragment = lastFragment.getNextFragment();
  }
  String nodeName = lastFragment.getShortName();
  String namespace = resolveNamespacePrefix(lastFragment, getNamespaceResolverForField(xmlField));
  NamespaceResolver domResolver = new NamespaceResolver();
  domResolver.setDOM(parent);
  String existingPrefix = domResolver.resolveNamespaceURI(namespace);
  String elementName = nodeName;
  if(existingPrefix != null) {
    if(existingPrefix.length() > 0) {
      elementName = existingPrefix + Constants.COLON + lastFragment.getLocalName();
    } else {
      elementName = lastFragment.getLocalName();
    }
  }
  Element elem = parent.getOwnerDocument().createElementNS(namespace, elementName);
  if (lastFragment.isGeneratedPrefix() && existingPrefix == null) {
    elem.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI, javax.xml.XMLConstants.XMLNS_ATTRIBUTE + Constants.COLON + lastFragment.getPrefix(), lastFragment.getNamespaceURI());
  }
  return elem;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

@Override
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  super.openStartElement(xPathFragment, namespaceResolver);
  if (isStartElementOpen) {
    openAndCloseStartElement();
  }
  isStartElementOpen = true;
  this.xPathFragment = xPathFragment;
  this.attributes = null;
  this.namespaceDeclarations = null;
  if(xPathFragment.isGeneratedPrefix()){
    namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
  }
  writePrefixMappings();
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  super.openStartElement(xPathFragment, namespaceResolver);
  if (isStartElementOpen) {
    openAndCloseStartElement();
  }
  isStartElementOpen = true;
  this.xPathFragment = xPathFragment;
  this.attributes = null;
  this.namespaceDeclarations = null;
  if(xPathFragment.isGeneratedPrefix()){
    namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
  }
  
  writePrefixMappings();
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * 
 * Create a start element tag - this call results in a complete start element, 
 * i.e. closeStartElement() does not need to be called after a call to this 
 * method.
 * 
 */
private void openAndCloseStartElement() {
  try {
    String namespaceUri = xPathFragment.getNamespaceURI();
    if(namespaceUri == null) {
      namespaceUri = Constants.EMPTY_STRING;
    }
    if(xPathFragment.isGeneratedPrefix()){
      this.namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
    }
    contentHandler.startElement(namespaceUri, xPathFragment.getLocalName(), getNameForFragment(xPathFragment), attributes);
    
  } catch (SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 *
 * Create a start element tag - this call results in a complete start element,
 * i.e. closeStartElement() does not need to be called after a call to this
 * method.
 *
 */
private void openAndCloseStartElement() {
  try {
    String namespaceUri = xPathFragment.getNamespaceURI();
    if(namespaceUri == null) {
      namespaceUri = Constants.EMPTY_STRING;
    }
    if(xPathFragment.isGeneratedPrefix()){
      this.namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
    }
    contentHandler.startElement(namespaceUri, xPathFragment.getLocalName(), getNameForFragment(xPathFragment), attributes);
  } catch (SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public Element createUnownedElement(Node parent, Field xmlField) {
  XPathFragment lastFragment = xmlField.getXPathFragment();
  while (lastFragment.getNextFragment() != null) {
    lastFragment = lastFragment.getNextFragment();
  }
  String nodeName = lastFragment.getShortName();
  String namespace = resolveNamespacePrefix(lastFragment, getNamespaceResolverForField(xmlField));
  NamespaceResolver domResolver = new NamespaceResolver();
  domResolver.setDOM(parent);
  String existingPrefix = domResolver.resolveNamespaceURI(namespace);
  String elementName = lastFragment.getShortName();
  if(existingPrefix != null) {
    if(existingPrefix.length() > 0) {
      elementName = existingPrefix + Constants.COLON + lastFragment.getLocalName();
    } else {
      elementName = lastFragment.getLocalName();
    }
  }
  
  Element elem = parent.getOwnerDocument().createElementNS(namespace, elementName);
  if (lastFragment.isGeneratedPrefix() && existingPrefix == null) {
    elem.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI, javax.xml.XMLConstants.XMLNS_ATTRIBUTE + Constants.COLON + lastFragment.getPrefix(), lastFragment.getNamespaceURI());
  }
  return elem;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  super.openStartElement(xPathFragment, namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  isStartElementOpen = true;
  outputStreamWrite(OPEN_START_ELEMENT);
  byte[] prefixBytes = getPrefixBytes(xPathFragment);
  if(null != prefixBytes) {
    outputStreamWrite(prefixBytes);
    outputStreamWrite((byte)':');
  }
  outputStreamWrite(xPathFragment.getLocalNameBytes());
  if(xPathFragment.isGeneratedPrefix()){
    namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  super.openStartElement(xPathFragment, namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  isStartElementOpen = true;
  outputStreamWrite(OPEN_START_ELEMENT);
  byte[] prefixBytes = getPrefixBytes(xPathFragment);
  if(null != prefixBytes) {
    outputStreamWrite(prefixBytes);
    outputStreamWrite((byte)':');
  }
  outputStreamWrite(xPathFragment.getLocalNameBytes());
  if(xPathFragment.isGeneratedPrefix()){
    namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  this.addPositionalNodes(xPathFragment, namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  if (!isLastEventText) {
    if (numberOfTabs > 0) {
      outputStreamWrite(cr);
    }
    outputStreamWriteTab();
  }
  isStartElementOpen = true;
  outputStreamWrite(OPEN_START_ELEMENT);
  byte[] prefixBytes = getPrefixBytes(xPathFragment);
  if(null != prefixBytes) {
    outputStreamWrite(prefixBytes);
    outputStreamWrite((byte)':');
  }
  outputStreamWrite(xPathFragment.getLocalNameBytes());
  if(xPathFragment.isGeneratedPrefix()){
    namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
  }
  numberOfTabs++;
  isLastEventText = false;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) {
  this.addPositionalNodes(xPathFragment, namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  if (!isLastEventText) {
    if (numberOfTabs > 0) {
      outputStreamWrite(cr);
    }
    outputStreamWriteTab();
  }
  isStartElementOpen = true;
  outputStreamWrite(OPEN_START_ELEMENT);
  byte[] prefixBytes = getPrefixBytes(xPathFragment);
  if(null != prefixBytes) {
    outputStreamWrite(prefixBytes);
    outputStreamWrite((byte)':');
  }
  outputStreamWrite(xPathFragment.getLocalNameBytes());
  if(xPathFragment.isGeneratedPrefix()){
    namespaceDeclaration(xPathFragment.getPrefix(), xPathFragment.getNamespaceURI());
  }
  numberOfTabs++;
  isLastEventText = false;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com