本文整理汇总了Java中com.helger.xml.microdom.util.MicroVisitor.visit方法的典型用法代码示例。如果您正苦于以下问题:Java MicroVisitor.visit方法的具体用法?Java MicroVisitor.visit怎么用?Java MicroVisitor.visit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.xml.microdom.util.MicroVisitor
的用法示例。
在下文中一共展示了MicroVisitor.visit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _getXMLAsTreeWithID
import com.helger.xml.microdom.util.MicroVisitor; //导入方法依赖的package包/类
private static <KEYTYPE, DATATYPE, ITEMTYPE extends ITreeItemWithID <KEYTYPE, DATATYPE, ITEMTYPE>> void _getXMLAsTreeWithID (@Nonnull final IMicroElement aElement,
@Nonnull final Function <? super String, ? extends KEYTYPE> aIDConverter,
@Nonnull final IConverterMicroNodeToTreeItem <? extends DATATYPE> aDataConverter,
@Nonnull final BasicTreeWithID <KEYTYPE, DATATYPE, ITEMTYPE> aTree)
{
final String sNamespaceURI = aDataConverter.getNamespaceURI ();
final NonBlockingStack <ITEMTYPE> aParents = new NonBlockingStack <> ();
aParents.push (aTree.getRootItem ());
MicroVisitor.visit (aElement,
new ChildrenProviderElementWithName (sNamespaceURI, ELEMENT_ITEM),
new DefaultHierarchyVisitorCallback <IMicroElement> ()
{
@Override
@Nonnull
public EHierarchyVisitorReturn onItemBeforeChildren (@Nullable final IMicroElement eItem)
{
if (eItem != null)
{
final KEYTYPE aTreeItemID = aIDConverter.apply (eItem.getAttributeValue (ATTR_ID));
final IMicroElement eData = eItem.getFirstChildElement (sNamespaceURI, ELEMENT_DATA);
final DATATYPE aTreeItemValue = aDataConverter.getAsDataValue (eData);
final ITEMTYPE aTreeItem = aParents.peek ().createChildItem (aTreeItemID, aTreeItemValue);
aParents.push (aTreeItem);
}
return EHierarchyVisitorReturn.CONTINUE;
}
@Override
@Nonnull
public EHierarchyVisitorReturn onItemAfterChildren (@Nullable final IMicroElement aItem)
{
if (aItem != null)
aParents.pop ();
return EHierarchyVisitorReturn.CONTINUE;
}
});
}
示例2: _cleanCode
import com.helger.xml.microdom.util.MicroVisitor; //导入方法依赖的package包/类
private static void _cleanCode (@Nonnull final IMicroContainer aCont)
{
// Do not clean texts, because this destroys "pre" formatting!
final PageViewExternalHTMLCleanser aCleanser = new PageViewExternalHTMLCleanser (EHTMLVersion.HTML5).setCleanTexts (false);
MicroVisitor.visit (aCont, aCleanser);
}