gpt4 book ai didi

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

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

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

XPathFragment.setGeneratedPrefix介绍

暂无

代码示例

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

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/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: com.haulmont.thirdparty/eclipselink

prefix = nr.generatePrefix();                                                        
frag.setGeneratedPrefix(true);

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

prefix = nr.generatePrefix();
frag.setGeneratedPrefix(true);

代码示例来源: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, 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, 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: 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/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/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, 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/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 writeXsiTypeAttribute(XMLDescriptor xmlDescriptor, DOMRecord row, String typeValue) {
  String xsiPrefix = null;
  boolean generated = false;
  xsiPrefix = row.getNamespaceResolver().resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
  if (xsiPrefix == null) {
    xsiPrefix = xmlDescriptor.getNonNullNamespaceResolver().generatePrefix(XMLConstants.SCHEMA_INSTANCE_PREFIX);
    generated = true;
    writeXsiNamespace(row, xsiPrefix);
  }
  XMLField xmlField = (XMLField)xmlDescriptor.buildField(XMLConstants.ATTRIBUTE + xsiPrefix + XMLConstants.COLON + XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
  if (generated) {
    xmlField.getLastXPathFragment().setGeneratedPrefix(true);
  }
  xmlField.getLastXPathFragment().setNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
  row.add(xmlField, typeValue);
}

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

xmlRootField.getXPathFragment().setGeneratedPrefix(true);
prefix = record.getNamespaceResolver().generatePrefix();

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

xmlRootField.getXPathFragment().setGeneratedPrefix(true);
prefix = record.getNamespaceResolver().generatePrefix();

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

xmlRootField.getXPathFragment().setGeneratedPrefix(true);
prefix = record.getNamespaceResolver().generatePrefix();

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

xmlRootField.getXPathFragment().setGeneratedPrefix(true);
prefix = row.getNamespaceResolver().generatePrefix();

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

xmlRootField.getXPathFragment().setGeneratedPrefix(true);
prefix = row.getNamespaceResolver().generatePrefix();

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