gpt4 book ai didi

com.helger.xml.XMLHelper类的使用及代码示例

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

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

XMLHelper介绍

[英]This class contains multiple XML utility methods.
[中]

代码示例

代码示例来源:origin: com.helger/peppol-commons

/**
 * Get the address contained in the passed endpoint reference.
 *
 * @param aEndpointReference
 *        The endpoint reference to retrieve the address from. May not be
 *        <code>null</code>.
 * @return The contained address.
 */
@Nullable
public static String getAddress (@Nonnull final W3CEndpointReference aEndpointReference)
{
 ValueEnforcer.notNull (aEndpointReference, "EndpointReference");
 final Element eAddress = XMLHelper.getFirstChildElementOfName (_convertReferenceToXML (aEndpointReference),
                                 "Address");
 return eAddress == null ? null : eAddress.getTextContent ();
}

代码示例来源: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-as4-lib

@Nonnull
@ReturnsMutableCopy
private static ICommonsList <Node> _getAllReferences (@Nullable final Node aUserMessage)
{
 final ICommonsList <Node> aDSRefs = new CommonsArrayList <> ();
 Node aNext = XMLHelper.getFirstChildElementOfName (aUserMessage, "Envelope");
 if (aNext != null)
 {
  aNext = XMLHelper.getFirstChildElementOfName (aNext, "Header");
  if (aNext != null)
  {
   aNext = XMLHelper.getFirstChildElementOfName (aNext, CAS4.WSSE_NS, "Security");
   if (aNext != null)
   {
    aNext = XMLHelper.getFirstChildElementOfName (aNext, CAS4.DS_NS, "Signature");
    if (aNext != null)
    {
     aNext = XMLHelper.getFirstChildElementOfName (aNext, CAS4.DS_NS, "SignedInfo");
     if (aNext != null)
     {
      new ChildElementIterator (aNext).findAll (XMLHelper.filterElementWithNamespaceAndLocalName (CAS4.DS_NS,
                                                    "Reference"),
                           aDSRefs::add);
     }
    }
   }
  }
 }
 return aDSRefs;
}

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

XMLHelper.getOwnerDocument (aNode));
if (aResult != null && !aResult.booleanValue ())
  for (final Element eError : XMLHelper.getChildElementIterator (aDoc.getDocumentElement (), "Error"))
   final String sPattern = XMLHelper.getFirstChildElementOfName (eError, "Pattern").getTextContent ();
   final String sDescription = XMLHelper.getFirstChildElementOfName (eError, "Description")
                      .getTextContent ();
   final String sXPath = XMLHelper.getFirstChildElementOfName (eError, "Xpath").getTextContent ();
   aErrorList.add (new SVRLErrorBuilder (sPattern).setErrorLocation (new SimpleLocation (aSource.getSystemID ()))
                           .setErrorText (sDescription)

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

final Node aHeaderNode = XMLHelper.getFirstChildElementOfName (aSOAPDocument.getDocumentElement (),
                                eSOAPVersion.getNamespaceURI (),
                                eSOAPVersion.getHeaderElementName ());
 final QName aQName = XMLHelper.getQName (aHeaderChild);
 final String sMustUnderstand = aHeaderChild.getAttributeNS (eSOAPVersion.getNamespaceURI (), "mustUnderstand");
 final boolean bIsMustUnderstand = eSOAPVersion.getMustUnderstandValue (true).equals (sMustUnderstand);

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

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

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

public static void forAllAttributes (@Nullable final Element aSrcNode,
                   @Nonnull final BiConsumer <? super String, ? super String> aConsumer)
{
 forAllAttributes (aSrcNode, x -> aConsumer.accept (x.getName (), x.getValue ()));
}

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

final boolean bIndentPrev = aPrevSibling == null || !XMLHelper.isInlineNode (aPrevSibling) || bIsRootElement;
final boolean bIndentNext = aNextSibling == null || !XMLHelper.isInlineNode (aNextSibling);
final boolean bIsFirstChildElement = bHasChildren && !XMLHelper.isInlineNode (aElement.getFirstChild ());
 XMLHelper.forAllAttributes (aElement, aAttr -> {
  final String sAttrNamespaceURI = StringHelper.getNotNull (aAttr.getNamespaceURI ());

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

@Nonnull
private static String _getPathToNode (@Nonnull final Node aNode)
{
 return XMLHelper.getPathToNode2 (aNode, "/");
}

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

@Nonnegative
public static int getDirectChildElementCount (@Nullable final Element aParent)
{
 return aParent == null ? 0 : CollectionHelper.getSize (getChildElementIterator (aParent));
}

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

@Nullable
public static String getNamespaceURI (@Nullable final Node aNode)
{
 if (aNode instanceof Document)
 {
  // Recurse into document element
  return getNamespaceURI (((Document) aNode).getDocumentElement ());
 }
 if (aNode != null)
  return aNode.getNamespaceURI ();
 return null;
}

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

@Nonnull
public static IIterableIterator <Element> getChildElementIteratorNS (@Nullable final Node aStartNode,
                                   @Nullable final String sNamespaceURI,
                                   @Nonnull @Nonempty final String sLocalName)
{
 return new ChildElementIterator (aStartNode).withFilter (filterElementWithNamespaceAndLocalName (sNamespaceURI,
                                                  sLocalName));
}

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

@Nonnull
@ReturnsMutableCopy
public static ICommonsOrderedMap <String, String> getAllAttributesAsMap (@Nullable final Element aSrcNode)
{
 final ICommonsOrderedMap <String, String> ret = new CommonsLinkedHashMap <> ();
 // Cast needed for Oracle JDK 8
 forAllAttributes (aSrcNode, (BiConsumer <? super String, ? super String>) ret::put);
 return ret;
}

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

@Nonnull
private static String _getPathToNode (@Nonnull final Node aNode)
{
 return XMLHelper.getPathToNode2 (aNode, "/");
}

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

@Nonnegative
public static int getDirectChildElementCount (@Nullable final Element aParent,
                       @Nonnull @Nonempty final String sTagName)
{
 return aParent == null ? 0 : CollectionHelper.getSize (getChildElementIterator (aParent, sTagName));
}

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

final String sNamespaceURI = XMLHelper.getNamespaceURI (aSOAPDocument);
eSOAPVersion = ArrayHelper.findFirst (ESOAPVersion.values (), x -> x.getNamespaceURI ().equals (sNamespaceURI));
if (eSOAPVersion == null)

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

/**
 * Search all child nodes of the given for the first element that has the
 * specified tag name.
 *
 * @param aStartNode
 *        The parent element to be searched. May be <code>null</code>.
 * @param sNamespaceURI
 *        Namespace URI to search. May be <code>null</code>.
 * @param sLocalName
 *        The tag name to search.
 * @return <code>null</code> if the parent element has no such child element.
 */
@Nullable
public static Element getFirstChildElementOfName (@Nullable final Node aStartNode,
                         @Nullable final String sNamespaceURI,
                         @Nonnull @Nonempty final String sLocalName)
{
 if (aStartNode == null)
  return null;
 return new ChildElementIterator (aStartNode).findFirst (filterElementWithNamespaceAndLocalName (sNamespaceURI,
                                                 sLocalName));
}

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

/**
 * Checks if the Document has a SOAPBodyPayload.
 *
 * @param aPModeLeg
 *        to get the SOAPVersion
 * @param aSOAPDoc
 *        the document that should be checked if it contains a SOAPBodyPayload
 * @return true if it contains a SOAPBodyPayload else false
 */
private static boolean _checkSOAPBodyHasPayload (@Nonnull final PModeLeg aPModeLeg, @Nonnull final Document aSOAPDoc)
{
 // Check if a SOAPBodyPayload exists
 final Element aBody = XMLHelper.getFirstChildElementOfName (aSOAPDoc.getFirstChild (),
                               aPModeLeg.getProtocol ()
                                    .getSOAPVersion ()
                                    .getBodyElementName ());
 return aBody != null && aBody.hasChildNodes ();
}

代码示例来源: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-xml

aElement.getLocalName ())
                           : new MicroElement (aElement.getTagName ());
XMLHelper.forAllAttributes (aElement, aAttr -> {
 final String sAttrNamespaceURI = aAttr.getNamespaceURI ();
 if (sAttrNamespaceURI != null)

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