gpt4 book ai didi

com.helger.xml.XMLHelper.getOwnerDocument()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 00:49:05 38 4
gpt4 key购买 nike

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

XMLHelper.getOwnerDocument介绍

[英]Get the owner document of the passed node. If the node itself is a document, only a cast is performed.
[中]获取所传递节点的所有者文档。如果节点本身是文档,则只执行强制转换。

代码示例

代码示例来源:origin: com.helger/ph-xml

@Nullable
public static Element getDocumentElement (@Nullable final Node aNode)
{
 final Document aDoc = getOwnerDocument (aNode);
 return aDoc == null ? null : aDoc.getDocumentElement ();
}

代码示例来源:origin: com.helger/ph-bdve

/**
 * Create a complete validation source from an existing DOM node.
 *
 * @param sSystemID
 *        System ID to use. May be <code>null</code>.
 * @param aNode
 *        The node to use. May not be <code>null</code>.
 * @return Never <code>null</code>.
 */
@Nonnull
public static ValidationSource create (@Nullable final String sSystemID, @Nonnull final Node aNode)
{
 ValueEnforcer.notNull (aNode, "Node");
 // Use the owner Document as fixed node
 return new ValidationSource (sSystemID, XMLHelper.getOwnerDocument (aNode), false);
}

代码示例来源:origin: com.helger/ph-schematron

public static <T> T evaluate (@Nonnull final XPathExpression aXPath,
                @Nonnull final Node aItem,
                @Nonnull final QName aReturnType,
                @Nullable final String sBaseURI) throws XPathExpressionException
 {
  Object aRealItem = aItem;
  if (sBaseURI != null && "net.sf.saxon.xpath.XPathExpressionImpl".equals (aXPath.getClass ().getName ()))
  {
   // Saxon specific handling
   // This is trick needed for #47 - "base-uri()"
   final XPathExpressionImpl aImpl = (XPathExpressionImpl) aXPath;
   aRealItem = new DocumentWrapper (XMLHelper.getOwnerDocument (aItem),
                    sBaseURI,
                    aImpl.getConfiguration ()).wrap (aItem);
  }

  return GenericReflection.uncheckedCast (aXPath.evaluate (aRealItem, aReturnType));
 }
}

代码示例来源:origin: phax/ph-schematron

public static <T> T evaluate (@Nonnull final XPathExpression aXPath,
                @Nonnull final Node aItem,
                @Nonnull final QName aReturnType,
                @Nullable final String sBaseURI) throws XPathExpressionException
 {
  Object aRealItem = aItem;
  if (sBaseURI != null && "net.sf.saxon.xpath.XPathExpressionImpl".equals (aXPath.getClass ().getName ()))
  {
   // Saxon specific handling
   // This is trick needed for #47 - "base-uri()"
   final XPathExpressionImpl aImpl = (XPathExpressionImpl) aXPath;
   aRealItem = new DocumentWrapper (XMLHelper.getOwnerDocument (aItem),
                    sBaseURI,
                    aImpl.getConfiguration ()).wrap (aItem);
  }

  return GenericReflection.uncheckedCast (aXPath.evaluate (aRealItem, aReturnType));
 }
}

代码示例来源:origin: com.helger/ph-xml

final Document aParentDoc = getOwnerDocument (aParentNode);
if (getOwnerDocument (aChildNode).equals (aParentDoc))
 aParentNode.appendChild (getOwnerDocument (aParentNode).createTextNode ((String) aChild));

代码示例来源:origin: com.helger/ph-bdve

/**
  * @return This validation source as a `javax.xml.transform.Source`. Never
  *         <code>null</code>.
  * @throws IllegalStateException
  *         If no transform source object can be created.
  */
 @Nonnull
 default Source getAsTransformSource ()
 {
  Source ret = null;
  final Node aNode = getNode ();
  if (aNode != null)
  {
   if (isPartialSource ())
    ret = TransformSourceFactory.create (aNode);
   else
   {
    // Always use the Document node! Otherwise this may lead to weird XSLT
    // errors
    ret = TransformSourceFactory.create (XMLHelper.getOwnerDocument (aNode));
   }
  }
  if (ret == null)
   throw new IllegalStateException ("No valid input object is present!");

  ret.setSystemId (getSystemID ());
  return ret;
 }
}

代码示例来源:origin: com.helger/ph-bdve

XMLHelper.getOwnerDocument (aNode));
if (aResult != null && !aResult.booleanValue ())

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