gpt4 book ai didi

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

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

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

XPathFragment.setXPath介绍

暂无

代码示例

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

/**
 * Set the element name.  This method will parse the qualified
 * name in an attempt to set the prefix and localName fields.  If
 * there is no prefix, the prefix field is set to null.
 *
 * @param qualifiedName a fully qualified element name
 */
public void setLocalName(String name) {
  rootFragment.setXPath(name);
}

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

public XPathFragment(String xpathString) {
  setXPath(xpathString);
}

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

public XPathFragment(String xpathString, char namespaceSeparator, boolean namespaceAware) {
  this.namespaceSeparator = namespaceSeparator;   
  setNamespaceAware(namespaceAware);     
  setXPath(xpathString); 
}

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

public XPathFragment(String xpathString, char namespaceSeparator, boolean namespaceAware) {
  this.namespaceSeparator = namespaceSeparator;
  setNamespaceAware(namespaceAware);
  setXPath(xpathString);
}

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

public Object getNonAttributeChild(int index, XPathNode xPathNode) {
  Setting setting = settings.get(index);
  if(null == setting.getName()) {
    return xPathNode.getAnyNode();
  } else {
    if (setting.getName().equals(XMLConstants.TEXT)) {
      return xPathNode.getTextNode();
    } else {
      indexFragment.setLocalName(null);
      indexFragment.setXPath(setting.getName());
      indexFragment.setNamespaceURI(setting.getNamespaceURI());
      return xPathNode.getNonAttributeChildrenMap().get(indexFragment);
      
    }
  }
}

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

public Object getNonAttributeChild(int index, XPathNode xPathNode) {
  Setting setting = settings.get(index);
  if(null == setting.getName()) {
    return xPathNode.getAnyNode();
  } else {
    if (setting.getName().equals(Constants.TEXT)) {
      return xPathNode.getTextNode();
    } else {
      indexFragment.setLocalName(null);
      indexFragment.setXPath(setting.getName());
      indexFragment.setNamespaceURI(setting.getNamespaceURI());
      return xPathNode.getNonAttributeChildrenMap().get(indexFragment);
      
    }
  }
}

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

public Object getNonAttributeChild(int index, XPathNode xPathNode) {
  Setting setting = settings.get(index);
  if(null == setting.getName()) {
    return xPathNode.getAnyNode();
  } else {
    if (setting.getName().equals(Constants.TEXT)) {
      return xPathNode.getTextNode();
    } else {
      indexFragment.setLocalName(null);
      indexFragment.setXPath(setting.getName());
      indexFragment.setNamespaceURI(setting.getNamespaceURI());
      return xPathNode.getNonAttributeChildrenMap().get(indexFragment);
    }
  }
}

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

public XPathFragment getXPathFragmentForValue(Object obj, NamespaceResolver nr, boolean isNamespaceAware, char namespaceSep) {
   Object value = getVariableAttributeAccessor().getAttributeValueFromObject(obj);
   String returnString;
   String uri = null;
   if(value instanceof QName){
     returnString = ((QName)value).getLocalPart();
     uri = ((QName)value).getNamespaceURI();
   }else{
     returnString = (String)value;
   }
   XPathFragment frag = new XPathFragment();
   if(isNamespaceAware && uri != null && uri.length() >0){
     String prefix = nr.resolveNamespaceURI(uri);
     if(prefix == null){
         prefix = nr.generatePrefix();
       //marshalRecord.namespaceDeclaration(prefix, uri);
         frag.setGeneratedPrefix(true);
     }
     if(prefix != null && prefix.length() >0){
       frag.setPrefix(prefix);
       returnString = prefix + namespaceSep + returnString;
     }
   }
   frag.setXPath(returnString);
   frag.setNamespaceURI(uri);
   return frag;
 }

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

private Namespace setupFragment(XMLRoot originalValue, XPathFragment xmlRootFragment, MarshalRecord marshalRecord) {
  Namespace generatedNamespace = null;
  String xpath = originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());
    String prefix = marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix = marshalRecord.getNamespaceResolver().generatePrefix("ns0");
      generatedNamespace = new Namespace(prefix, xmlRootFragment.getNamespaceURI());
    }
    xpath = prefix + XMLConstants.COLON + xpath;
  }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}

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

private void writeSimpleValue(XMLField xmlRootField, DOMRecord row, AbstractSession session, Object originalObject, Object value, Node root, Node toReplace, boolean wasXMLRoot) {
  org.w3c.dom.Document doc = row.getDocument();
  if (wasXMLRoot) {
    if (((XMLRoot) originalObject).getNamespaceURI() != null) {
      String prefix = row.getNamespaceResolver().resolveNamespaceURI(((XMLRoot) originalObject).getNamespaceURI());
      if ((prefix == null) || prefix.length() == 0) {
        xmlRootField.getXPathFragment().setGeneratedPrefix(true);
        prefix = row.getNamespaceResolver().generatePrefix();
      }
      xmlRootField.getXPathFragment().setXPath(prefix + XMLConstants.COLON + ((XMLRoot) originalObject).getLocalName());
    }
  }
  if (null == xmlRootField) {
    Text textNode = doc.createTextNode((String) value);
    if (toReplace != null) {
      root.replaceChild(textNode, toReplace);
    } else {
      root.appendChild(textNode);
    }
  } else {
    QName qname = ((XMLRoot) originalObject).getSchemaType();
    if(qname != null && !qname.equals(XMLConstants.STRING_QNAME)){
      xmlRootField.setSchemaType(qname);
      xmlRootField.setIsTypedTextField(true);
      xmlRootField.addJavaConversion(value.getClass(), qname);
    }
    Node newNode = XPathEngine.getInstance().create(xmlRootField, root, value, session);
  }
}

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

private Namespace setupFragment(XMLRoot originalValue, XPathFragment xmlRootFragment, MarshalRecord marshalRecord) {
  Namespace generatedNamespace = null;
  String xpath = originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());
    String prefix = marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix = marshalRecord.getNamespaceResolver().generatePrefix();
      generatedNamespace = new Namespace(prefix, xmlRootFragment.getNamespaceURI());
    }
    xpath = prefix + XMLConstants.COLON + xpath;
  }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}

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

private void writeSimpleValue(XMLField xmlRootField, Object element, Object originalObject, DOMRecord record, org.w3c.dom.Document doc, Node root, boolean wasXMLRoot, AbstractSession session) {
  if (wasXMLRoot) {
    if (((XMLRoot) originalObject).getNamespaceURI() != null) {
      String prefix = record.getNamespaceResolver().resolveNamespaceURI(((XMLRoot) originalObject).getNamespaceURI());
      if ((prefix == null) || prefix.length() == 0) {
        xmlRootField.getXPathFragment().setGeneratedPrefix(true);
        prefix = record.getNamespaceResolver().generatePrefix();
      }
      xmlRootField.getXPathFragment().setXPath(prefix + XMLConstants.COLON + ((XMLRoot) originalObject).getLocalName());
    }
  }
  if (xmlRootField != null) {
    xmlRootField.setNamespaceResolver(record.getNamespaceResolver());
    QName qname = ((XMLRoot) originalObject).getSchemaType();
    if(qname != null){
      if(!qname.equals(XMLConstants.STRING_QNAME)){
        xmlRootField.setSchemaType(qname);
        xmlRootField.setIsTypedTextField(true);
        xmlRootField.addJavaConversion(((XMLRoot) originalObject).getObject().getClass(), qname);
      }
    }
    Node newNode = XPathEngine.getInstance().create(xmlRootField, root, element, session);
  } else {
    Text textNode = doc.createTextNode((String) element);
    root.appendChild(textNode);
  }
}

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

private void writeSimpleValue(XMLField xmlRootField, Object element, Object originalObject, DOMRecord record, org.w3c.dom.Document doc, Node root, boolean wasXMLRoot, AbstractSession session) {
  if (wasXMLRoot) {
    if (((XMLRoot) originalObject).getNamespaceURI() != null) {
      String prefix = record.getNamespaceResolver().resolveNamespaceURI(((XMLRoot) originalObject).getNamespaceURI());
      if ((prefix == null) || prefix.length() == 0) {
        xmlRootField.getXPathFragment().setGeneratedPrefix(true);
        prefix = record.getNamespaceResolver().generatePrefix();
      }
      xmlRootField.getXPathFragment().setXPath(prefix + XMLConstants.COLON + ((XMLRoot) originalObject).getLocalName());
    }
  }
  if (xmlRootField != null) {
    xmlRootField.setNamespaceResolver(record.getNamespaceResolver());
    QName qname = ((XMLRoot) originalObject).getSchemaType();
    if(qname != null){
      if(!qname.equals(XMLConstants.STRING_QNAME)){
        xmlRootField.setSchemaType(qname);
        xmlRootField.setIsTypedTextField(true);
        xmlRootField.addJavaConversion(((XMLRoot) originalObject).getObject().getClass(), qname);
      }
    }
    Node newNode = XPathEngine.getInstance().create(xmlRootField, root, element, session);
  } else {
    Text textNode = doc.createTextNode((String) element);
    root.appendChild(textNode);
  }
}

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

private Namespace setupFragment(Root originalValue, XPathFragment xmlRootFragment, MarshalRecord marshalRecord) {
  Namespace generatedNamespace = null;
  String xpath = originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());
    String prefix = marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix = marshalRecord.getNamespaceResolver().generatePrefix("ns0");
      generatedNamespace = new Namespace(prefix, xmlRootFragment.getNamespaceURI());
      xmlRootFragment.setGeneratedPrefix(true);
    }
    xpath = prefix + Constants.COLON + xpath;
  }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}

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

private void writeSimpleValue(XMLField xmlRootField, DOMRecord row, AbstractSession session, Object originalObject, Object value, Node root, Node toReplace, boolean wasXMLRoot) {
  org.w3c.dom.Document doc = row.getDocument();
  if (wasXMLRoot) {
    if (((XMLRoot) originalObject).getRootFragment().getNamespaceURI() != null) {
      String prefix = row.getNamespaceResolver().resolveNamespaceURI(((XMLRoot) originalObject).getRootFragment().getNamespaceURI());
      if ((prefix == null) || prefix.length() == 0) {
        xmlRootField.getXPathFragment().setGeneratedPrefix(true);
        prefix = row.getNamespaceResolver().generatePrefix();
      }
      xmlRootField.getXPathFragment().setXPath(prefix + XMLConstants.COLON + ((XMLRoot) originalObject).getLocalName());
    }
  }
  if (null == xmlRootField) {
    Text textNode = doc.createTextNode((String) value);
    if (toReplace != null) {
      root.replaceChild(textNode, toReplace);
    } else {
      root.appendChild(textNode);
    }
  } else {
    QName qname = ((XMLRoot) originalObject).getSchemaType();
    if(qname != null && !qname.equals(XMLConstants.STRING_QNAME)){
      xmlRootField.setSchemaType(qname);
      xmlRootField.setIsTypedTextField(true);
      xmlRootField.addJavaConversion(value.getClass(), qname);
    }
    Node newNode = XPathEngine.getInstance().create(xmlRootField, root, value, session);   
  }
}

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

private Namespace setupFragment(Root originalValue, XPathFragment xmlRootFragment, MarshalRecord marshalRecord) {
  Namespace generatedNamespace = null;
  String xpath = originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());
    String prefix = marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix = marshalRecord.getNamespaceResolver().generatePrefix();
      generatedNamespace = new Namespace(prefix, xmlRootFragment.getNamespaceURI());
      xmlRootFragment.setGeneratedPrefix(true);
    }
    xpath = prefix + Constants.COLON + xpath;
  }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}

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

private Namespace setupFragment(Root originalValue, XPathFragment xmlRootFragment, MarshalRecord marshalRecord) {
  Namespace generatedNamespace = null;
  String xpath = originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());
    String prefix = marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix = marshalRecord.getNamespaceResolver().generatePrefix();
      generatedNamespace = new Namespace(prefix, xmlRootFragment.getNamespaceURI());
      xmlRootFragment.setGeneratedPrefix(true);
    }
    xpath = prefix + Constants.COLON + xpath;
  }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}

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

private void writeSimpleValue(XMLField xmlRootField, Object element, Object originalObject, DOMRecord record, org.w3c.dom.Document doc, Node root, boolean wasXMLRoot, AbstractSession session) {
  if (wasXMLRoot) {
    if (((XMLRoot) originalObject).getRootFragment().getNamespaceURI() != null) {
      String prefix = record.getNamespaceResolver().resolveNamespaceURI(((XMLRoot) originalObject).getRootFragment().getNamespaceURI());
      if ((prefix == null) || prefix.length() == 0) {
        xmlRootField.getXPathFragment().setGeneratedPrefix(true);
        prefix = record.getNamespaceResolver().generatePrefix();
      }
      xmlRootField.getXPathFragment().setXPath(prefix + XMLConstants.COLON + ((XMLRoot) originalObject).getLocalName());
    }
  }
  if (xmlRootField != null) {
    xmlRootField.setNamespaceResolver(record.getNamespaceResolver());
    QName qname = ((XMLRoot) originalObject).getSchemaType();
    if(qname != null){
      if(!qname.equals(XMLConstants.STRING_QNAME)){
        xmlRootField.setSchemaType(qname);
        xmlRootField.setIsTypedTextField(true);
        xmlRootField.addJavaConversion(((XMLRoot) originalObject).getObject().getClass(), qname);
      }
    }
    Node newNode = XPathEngine.getInstance().create(xmlRootField, root, element, session);
  } else {
    Text textNode = doc.createTextNode((String) element);
    root.appendChild(textNode);
  }
}

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

private Namespace setupFragment(Root originalValue, XPathFragment xmlRootFragment, MarshalRecord marshalRecord) {
  Namespace generatedNamespace = null;
  String xpath = originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());            
    String prefix = marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix = marshalRecord.getNamespaceResolver().generatePrefix("ns0");
      generatedNamespace = new Namespace(prefix, xmlRootFragment.getNamespaceURI());
      xmlRootFragment.setGeneratedPrefix(true);
    }
    xpath = prefix + Constants.COLON + xpath;
      }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}

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

public void xPathNode(XPathNode xPathNode, NullCapableValue nullCapableValue) {
  // isset optional only    	
  if (!(isNullRepresentedByXsiNil() || getMarshalNullRepresentation().equals(XMLNullRepresentationType.XSI_NIL))) {
    if (xPathNode.getXPathFragment().isAttribute()) {
      return;
    }
  }
  // get the parent above the text() node    	
  XPathNode parentNode = xPathNode.getParent();
  // isset nillable only        
  if (isNullRepresentedByXsiNil() || getMarshalNullRepresentation().equals(XMLNullRepresentationType.XSI_NIL)) {
    XPathFragment xPathFragment = new XPathFragment();
    xPathFragment.setXPath('@' + XMLConstants.SCHEMA_NIL_ATTRIBUTE);
    xPathFragment.setNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
    NodeValue aNodeValue = new NillableNodeValue(nullCapableValue);
    parentNode.addChild(xPathFragment, aNodeValue, null);
  } else {
    NodeValue aNodeValue = new OptionalNodeValue(nullCapableValue);
    parentNode.setNodeValue(aNodeValue);
  }
}

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