Package net.htmlparser.jericho

Examples of net.htmlparser.jericho.StartTag


    OutputDocument outputDocument = new OutputDocument(source);
   
    int index = 1;
    HashMap<String, String> diagramList = new HashMap<String, String>();
    for(Element element : source.getAllElements("pre")) {
      StartTag tag = element.getStartTag();
      Attribute classAttr = tag.getAttributes().get("class");
      if(classAttr != null
          && classAttr.hasValue()
          && classAttr.getValue().equals(TAG_CLASS)) {
       
        String baseFilename = imageBaseFilename;
       
        String URL;
        Attribute nameAttr = tag.getAttributes().get("id");
        if(nameAttr != null
            && nameAttr.hasValue()) {
          baseFilename = makeFilenameFromTagName(nameAttr.getValue());
          URL = imageDirName + "/" + baseFilename + ".png";
        } else {
View Full Code Here


    private String getContextForArea(Element areaNode, Source source) {
      String ctx = areaNode.toString();
      Element map = areaNode.getParentElement();
      if (map.getName().equals(HTMLElementName.MAP) && map.getAttributeValue("name") != null) {
        StartTag img = source.getFirstStartTag("usemap", "#" + map.getAttributeValue("name"), false);
        if (img != null) {
          ctx = img.getElement().toString();
        }
      }
      return ctx;
    }
View Full Code Here

                final byte[] responseBodyAsBytes = outputStream.toByteArray();
                String responseBody = new String(responseBodyAsBytes, "US-ASCII");
                Source source = new Source(responseBody);
                List list = source.getAllStartTags(HTMLElementName.META);
                for (Object aList : list) {
                    StartTag startTag = (StartTag) aList;
                    Attributes attributes = startTag.getAttributes();
                    final Attribute attribute = attributes.get("http-equiv");
                    if (attribute != null && attribute.getValue().equalsIgnoreCase("content-type")) {
                        type = attributes.get("content").getValue().split(";");
                        if (type.length == 2) {
                            contentCharset = type[1].split("=")[1];
View Full Code Here

    return (bundleSet.getResourceFiles(htmlAssetPlugin).isEmpty()) ? Collections.emptyList() : requestPaths;
  }
 
  private void validateSourceHtml(Asset htmlAsset) throws IOException, ContentFileProcessingException, NamespaceException, RequirePathException
  {
    StartTag startTag = getStartTag(htmlAsset);
    String identifier = startTag.getAttributeValue("id");
   
    if(identifier == null)
    {
      String idMessage = (htmlAsset.assetLocation().assetContainer().isNamespaceEnforced()) ?
        "a namespaced ID of '" + NamespaceUtility.convertToNamespace(htmlAsset.assetLocation().requirePrefix()) + ".*'" : "an ID";
     
      throw new NamespaceException( "HTML template found without an identifier: '" +
          startTag.toString() + "'.  Root element should have " + idMessage + ".");
    }
   
    htmlAsset.assetLocation().assertIdentifierCorrectlyNamespaced(identifier);
   
    Asset assetWithDuplicateId = identifiers.get(identifier);
View Full Code Here

  private StartTag getStartTag(Asset htmlAsset) throws IOException
  {
    try(Reader reader = htmlAsset.getReader())
    {
      StreamedSource streamedSource = new StreamedSource(reader);
      StartTag startTag = null;
     
      try
      {
        for(Segment nextSegment : streamedSource)
        {
View Full Code Here

    for (Tag tag : tags) {
      Element tagElement = tag.getElement();
      if (tagElement == null) {
        System.out.println(tag.getName());
      } else {
        StartTag startTag = tagElement.getStartTag();
        Attributes attributes = startTag.getAttributes();
        if (attributes != null) {
          for (Attribute attribute : startTag.getAttributes()) {
            if (uppercase) {
              outputDocument.replace(attribute.getNameSegment(), attribute.getNameSegment().toString()
                  .toUpperCase());
            } else {
              outputDocument.replace(attribute.getNameSegment(), attribute.getNameSegment().toString()
View Full Code Here

TOP

Related Classes of net.htmlparser.jericho.StartTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.