gpt4 book ai didi

org.eclipse.persistence.oxm.XMLRoot.getSchemaType()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 12:38:40 26 4
gpt4 key购买 nike

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

XMLRoot.getSchemaType介绍

暂无

代码示例

代码示例来源: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 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: com.haulmont.thirdparty/eclipselink

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/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: 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: 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: org.eclipse.persistence/com.springsource.org.eclipse.persistence

private void marshalSimpleValue(XPathFragment xmlRootFragment, MarshalRecord marshalRecord, Object originalValue, Object object, Object value, AbstractSession session, NamespaceResolver namespaceResolver) {
  if (xmlRootFragment != null) {
    QName qname = ((XMLRoot) originalValue).getSchemaType();
    value = getValueToWrite(qname, value, (XMLConversionManager) session.getDatasourcePlatform().getConversionManager(), namespaceResolver);
    Namespace generatedNamespace = setupFragment((XMLRoot) originalValue, xmlRootFragment, marshalRecord);
    getXPathNode().startElement(marshalRecord, xmlRootFragment, object, session, namespaceResolver, null, null);
    if (generatedNamespace != null) {
      marshalRecord.attribute(XMLConstants.XMLNS_URL, generatedNamespace.getPrefix(), XMLConstants.XMLNS + XMLConstants.COLON + generatedNamespace.getPrefix(), generatedNamespace.getNamespaceURI());
    }
    updateNamespaces(qname, marshalRecord, null);                        
  }
  marshalRecord.characters((String) value);
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment, namespaceResolver);
  }
}

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

private void marshalSimpleValue(XPathFragment xmlRootFragment, MarshalRecord marshalRecord, Object originalValue, Object object, Object value, AbstractSession session, NamespaceResolver namespaceResolver) {
  if (xmlRootFragment != null) {
    QName qname = ((XMLRoot) originalValue).getSchemaType();
    value = getValueToWrite(qname, value, (XMLConversionManager) session.getDatasourcePlatform().getConversionManager(), namespaceResolver);
    Namespace generatedNamespace = setupFragment(((XMLRoot) originalValue), xmlRootFragment, marshalRecord);
    getXPathNode().startElement(marshalRecord, xmlRootFragment, object, session, namespaceResolver, null, null);
    if (generatedNamespace != null) {
      marshalRecord.attribute(XMLConstants.XMLNS_URL, generatedNamespace.getPrefix(), XMLConstants.XMLNS + XMLConstants.COLON + generatedNamespace.getPrefix(), generatedNamespace.getNamespaceURI());
    }
    updateNamespaces(qname, marshalRecord, null);
  }
  if (value instanceof String) {
    marshalRecord.characters((String) value);
  } else {
    marshalRecord.node((org.w3c.dom.Node) value, marshalRecord.getNamespaceResolver());
  }
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment, namespaceResolver);
  }
}

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

noNsSchemaLocation = root.getNoNamespaceSchemaLocation();
marshalRecord.setLeafElementType(root.getSchemaType());
  String value = (String) XMLConversionManager.getDefaultXMLManager().convertObject(object, String.class, root.getSchemaType());
  marshalRecord.characters(value);

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