Create parcel tracker entity from html
@param html
771345
function createParcelTrackerEntity(body) {

    const data = JSON.parse(body)

    const states = []
    data.scanHistory.scanDetails.forEach((elem) => {
        const state = {
            state : elem.eventDescription,
            date : elem.eventDate + "T" + elem.eventTime
        }
        if(elem.eventLocation && elem.eventLocation.country
            && elem.eventLocation.countyOrRegion
            && elem.eventLocation.city){
            state.area = elem.eventLocation.country
                + " - " + elem.eventLocation.countyOrRegion
                + " - " + elem.eventLocation.city
        }
        states.push(state)
    })

    return new ParcelTrackerInfo({
        attempts: 1,
        id: data.packageIdentifier,
        state: data.currentStatus.eventDescription,
        carrier: data.carrier,
        origin: data.senderLocation.country
            + " - " + data.senderLocation.countyOrRegion
            + " - " + data.senderLocation.city,
        destiny: data.destinationLocation.country
            + " - " + data.destinationLocation.countyOrRegion
            + " - " + data.destinationLocation.city,
        states: states
    })
}
138745
public JQMListItem addText(String html) {
        Element e = Document.get().createPElement();
        e.setInnerHTML(html);
        attachChild(e);
        return this;
    }
1082057
String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException {
        byte[] filecontents = new byte[input.available()];
        try {
            DataInputStream dataIn = new DataInputStream(input);
            dataIn.readFully(filecontents);
        } finally {
            input.close();
        }
        String encoding = env.getEncoding();
        String rawDoc = (encoding!=null)
            ? new String(filecontents, encoding)
            : new String(filecontents);
        Pattern bodyPat = Pattern.compile("(?is).*<body\\b[^>]*>(.*)</body\\b.*");
        Matcher m = bodyPat.matcher(rawDoc);
        if (m.matches()) {
            return m.group(1);
        } else {
            String key = rawDoc.matches("(?is).*<body\\b.*")
                    ? "javadoc.End_body_missing_from_html_file"
                    : "javadoc.Body_missing_from_html_file";
            env.error(SourcePositionImpl.make(filename, Position.NOPOS, null), key);
            return "";
        }
    }
1165758
function( pathToHTMLFile ){
        var deferred = Q.defer(),
            targetHTML = new TargetHTML( pathToHTMLFile );

        targetHTML.init()
            .then( function( targetHTML ){ return this.getTemplate( targetHTML.detectTemplateId() ); }.bind( this ) )
            .then( function( template ){ return template.generateCode( targetHTML.pickOutValues(), pathToHTMLFile ); } )
            .then( function( HTMLCode ){ return targetHTML.update( HTMLCode ); } )
            .catch( function( error ){ deferred.reject( error ); } )
            .finally( function(){ deferred.resolve( pathToHTMLFile ); } );

        return deferred.promise;
    }
85046
public static void fillEntry(Element element, CmsUUID id, String rootPath, CmsRelationType type) {

        CmsLink link = new CmsLink(CmsXmlCategoryValue.TYPE_VFS_LINK, type, id, rootPath, true);
        // get xml node
        Element linkElement = element.element(CmsXmlPage.NODE_LINK);
        if (linkElement == null) {
            // create xml node if needed
            linkElement = element.addElement(CmsXmlPage.NODE_LINK);
        }
        // update xml node
        CmsLinkUpdateUtil.updateXmlForVfsFile(link, linkElement);
    }
330566
function ParcelTrackerInfo(obj) {
    this.attempts = obj.attempts
    this.id = obj.id
    this.state = obj.state
    this.deliveryDate = obj.deliveryDate
    this.states = obj.states,
    this.origin = obj.origin,
    this.destiny = obj.destiny
    this.trackerWebsite = pitney.getLink(this.id)
}
844412
function createExpressoEntity(html) {
    let $ = parser.load(html)

    let data = []
    $('table span').each(function (i, elem) {
        if(i >= 10 )
            data.push($(this).text().trim().replace(/\s\s+/g, ' '))
    })

    return new ExpressoInfo({
        'guide': data[0],
        'origin': data[1],
        'date': moment.tz(data[2], "YYYY-MM-DD", zone).format(),
        'status': data[3],
        'weight': data[4],
        'parcels': data[5],
        'receiver_name': data[6],
        'address': parseAddress(data[7]),
        'refund': data[8],
        'ref': data[9],
    })
}
1092615
def to_xml(self, tag_name="buyer"):
        '''
        
        '''
        for n, v in {"name": self.name, "address": self.address}.items():
            if is_empty_or_none(v):
                raise ValueError("'%s' attribute cannot be empty or None." % n)

        if self.__require_id and is_empty_or_none(self.identifier):
            raise ValueError("identifier attribute cannot be empty or None.")

        doc = Document()
        root = doc.createElement(tag_name)
        self._create_text_node(root, "id", self.identifier)
        self._create_text_node(root, "name", self.name, True)
        if self.phone:
            self._create_text_node(root, "phone", self.phone, True)
        root.appendChild(self.address.to_xml())
        return root
1650
function createDomElementFromTemplate(html) {
    //match container markers like <@element/>
    let containerTags = html.match(rContainerGlobal) || [];

    for (let containerTag of containerTags) {
        let [, containerName, attrs = ''] = rContainer.exec(containerTag);
        let template = `<script type="x" ${ATTR}="${containerName}">${attrs.trim()}</script>`;

        html = html.split(containerTag).join(template);
    }

    //match attribute markers like <span @element></span>
    let allTags = html.match(rTags) || [];

    for (let tag of allTags) {
        let result = rAttr.exec(tag);

        if (result) {
            let elName = result[1];
            html = html.split(tag).join(tag.replace(`@${elName}`, `${ATTR}="${elName}"`));
        }
    }

    return $.create(html.trim());
}
386676
@Transactional
  @PostMapping(
      value = "/{entityTypeId}",
      headers = "Content-Type=application/x-www-form-urlencoded")
  public void createFromFormPost(
      @PathVariable("entityTypeId") String entityTypeId,
      HttpServletRequest request,
      HttpServletResponse response) {
    Map<String, Object> paramMap = new HashMap<>();
    for (String param : request.getParameterMap().keySet()) {
      String[] values = request.getParameterValues(param);
      String value = values != null ? StringUtils.join(values, ',') : null;
      if (StringUtils.isNotBlank(value)) {
        paramMap.put(param, value);
      }
    }

    createInternal(entityTypeId, paramMap, response);
  }
346374
def fromHTML(cls, uri, html):
        
        discovery_types = [
            (OPENID_2_0_TYPE, 'openid2.provider', 'openid2.local_id'),
            (OPENID_1_1_TYPE, 'openid.server', 'openid.delegate'),
            ]

        link_attrs = html_parse.parseLinkAttrs(html)
        services = []
        for type_uri, op_endpoint_rel, local_id_rel in discovery_types:
            op_endpoint_url = html_parse.findFirstHref(
                link_attrs, op_endpoint_rel)
            if op_endpoint_url is None:
                continue

            service = cls()
            service.claimed_id = uri
            service.local_id = html_parse.findFirstHref(
                link_attrs, local_id_rel)
            service.server_url = op_endpoint_url
            service.type_uris = [type_uri]

            services.append(service)

        return services
1160449
public static HtmlTree A_ID(String id, Content body) {
        HtmlTree htmltree = new HtmlTree(HtmlTag.A);
        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
        htmltree.addContent(nullCheck(body));
        return htmltree;
    }
560795
function buildMessageHTML(messageText, messageSenderId, messageDateSent, attachmentFileId, messageId, status){
  var messageAttach;
  if(attachmentFileId){
      messageAttach = '<img src="' + QB.content.publicUrl(attachmentFileId) + '/' + '/download.xml?token='+token+'" alt="attachment" class="attachments img-responsive" />';
  }

	var isMessageSticker = stickerpipe.isSticker(messageText);

  var delivered = '<img class="icon-small" src="images/delivered.jpg" alt="" id="delivered_'+messageId+'">';
  var read = '<img class="icon-small" src="images/read.jpg" alt="" id="read_'+messageId+'">';

	var messageTextHtml = messageText;
	if (messageAttach) {
		messageTextHtml = messageAttach;
	} else if (isMessageSticker) {
		messageTextHtml = '<div class="message-sticker-container"></div>';

		stickerpipe.parseStickerFromText(messageText, function(sticker, isAsync) {
			if (isAsync) {
				$('#' + messageId + ' .message-sticker-container').html(sticker.html);
			} else {
				messageTextHtml = sticker.html;
			}
		});
	}

  var messageHtml =
			'<div class="list-group-item" id="'+messageId+'">'+
				'<time datetime="'+messageDateSent+ '" class="pull-right">'
					+jQuery.timeago(messageDateSent)+
				'</time>'+

				'<h4 class="list-group-item-heading">'+messageSenderId+'</h4>'+
				'<p class="list-group-item-text">'+
					messageTextHtml +
				'</p>'
				+delivered+read+
			'</div>';
  return messageHtml;
}
720418
function(ev, items, index) {
                        // Collect new html and mappings
                        var frag = document.createDocumentFragment(),
                            newNodeLists = [],
                            newIndicies = [];
                        // For each new item,
                        can.each(items, function(item, key) {
                            var itemIndex = can.compute(key + index),
                                // get its string content
                                itemHTML = render.call(context, item, itemIndex),
                                gotText = typeof itemHTML === "string",
                                // and convert it into elements.
                                itemFrag = can.frag(itemHTML);
                            // Add those elements to the mappings.

                            itemFrag = gotText ? can.view.hookup(itemFrag) : itemFrag;

                            var childNodes = can.makeArray(itemFrag.childNodes);



                            newNodeLists.push(nodeLists.register(childNodes));
                            // Hookup the fragment (which sets up child live-bindings) and
                            // add it to the collection of all added elements.
                            frag.appendChild(itemFrag);
                            // track indicies;
                            newIndicies.push(itemIndex);
                        });
                        // The position of elements is always after the initial text placeholder node
                        var masterListIndex = index + 1;


                        // Check if we are adding items at the end
                        if (!masterNodeList[masterListIndex]) {
                            elements.after(masterListIndex === 1 ? [text] : [nodeLists.last(masterNodeList[masterListIndex - 1])], frag);
                        } else {
                            // Add elements before the next index's first element.
                            var el = nodeLists.first(masterNodeList[masterListIndex]);
                            can.insertBefore(el.parentNode, frag, el);
                        }
                        splice.apply(masterNodeList, [
                                masterListIndex,
                                0
                            ].concat(newNodeLists));

                        // update indices after insert point
                        splice.apply(indexMap, [
                                index,
                                0
                            ].concat(newIndicies));

                        for (var i = index + newIndicies.length, len = indexMap.length; i < len; i++) {
                            indexMap[i](i);
                        }
                    }
49031
public void doTag()
            throws JspException, IOException
    {
        String value = getBufferBody(true);
        String text = "";
        if (value.length() > 0)
            text = value;

        Object o = getParent();
        assert (o != null);
        if (!(o instanceof TreeItem)) {
            logger.error("Invalid Parent (expected a TreeItem):" + o.getClass().getName());
            return;
        }

        // assign the value to the parent's label value
        TreeItem ti = (TreeItem) o;
        ti.setItemLabel(text);
    }
714550
@Override
	public void doTag() throws JspException, IOException {
		final PageContext pageContext = (PageContext)getJspContext();
		final ServletRequest request = pageContext.getRequest();

		// Get the current capture state
		CaptureLevel captureLevel = CurrentCaptureLevel.getCaptureLevel(request);
		if(captureLevel.compareTo(CaptureLevel.META) >= 0) {
			E elem = createElement();
			element = elem;
			evaluateAttributes(elem, pageContext.getELContext());

			// Set currentNode
			Node parentNode = CurrentNode.getCurrentNode(request);
			CurrentNode.setCurrentNode(request, elem);
			try {
				// Find the optional parent page
				Page currentPage = CurrentPage.getCurrentPage(request);
				if(currentPage != null) currentPage.addElement(elem);

				Long elementKey;
				if(parentNode != null) elementKey = parentNode.addChildElement(elem, this);
				else elementKey = null;
				// Freeze element once body done
				try {
					doBody(elem, captureLevel);
				} finally {
					// Note: Page freezes all of its elements
					if(currentPage == null) elem.freeze();
				}
				// Write now
				if(captureLevel == CaptureLevel.BODY) {
					JspWriter out = pageContext.getOut();
					if(elementKey == null) {
						try {
							writeTo(out, new PageElementContext(pageContext));
						} catch(JspException | IOException | RuntimeException e) {
							throw e;
						} catch(Exception e) {
							throw new JspTagException(e);
						}
					} else {
						// Write an element marker instead
						// TODO: Do not write element marker for empty elements, such as passwordTable at http://localhost:8080/docs/ao/infrastructure/ao/regions/mobile-al/workstations/francis.aoindustries.com/
						NodeBodyWriter.writeElementMarker(elementKey, out);
					}
				}
			} finally {
				// Restore previous currentNode
				CurrentNode.setCurrentNode(request, parentNode);
			}
		}
	}
496364
protected void updateModel(Model value, String xmlTag, Counter counter, Element element)
   {
      Element root = element;
      Counter innerCount = new Counter(counter.getDepth() + 1);
      updateParent(value.getParent(), "parent", innerCount, root);
      findAndReplaceSimpleElement(innerCount, root, "modelVersion", value.getModelVersion(), null);
      findAndReplaceSimpleElement(innerCount, root, "groupId", value.getGroupId(), null);
      findAndReplaceSimpleElement(innerCount, root, "artifactId", value.getArtifactId(), null);
      findAndReplaceSimpleElement(innerCount, root, "packaging", value.getPackaging(), "jar");
      findAndReplaceSimpleElement(innerCount, root, "name", value.getName(), null);
      findAndReplaceSimpleElement(innerCount, root, "version", value.getVersion(), null);
      findAndReplaceSimpleElement(innerCount, root, "description", value.getDescription(), null);
      findAndReplaceSimpleElement(innerCount, root, "url", value.getUrl(), null);
      updatePrerequisites(value.getPrerequisites(), "prerequisites", innerCount, root);
      updateIssueManagement(value.getIssueManagement(), "issueManagement", innerCount, root);
      updateCiManagement(value.getCiManagement(), "ciManagement", innerCount, root);
      findAndReplaceSimpleElement(innerCount, root, "inceptionYear", value.getInceptionYear(), null);
      iterateMailingList(innerCount, root, value.getMailingLists(), "mailingLists", "mailingList");
      iterateDeveloper(innerCount, root, value.getDevelopers(), "developers", "developer");
      iterateContributor(innerCount, root, value.getContributors(), "contributors", "contributor");
      iterateLicense(innerCount, root, value.getLicenses(), "licenses", "license");
      updateScm(value.getScm(), "scm", innerCount, root);
      updateOrganization(value.getOrganization(), "organization", innerCount, root);
      updateBuild(value.getBuild(), "build", innerCount, root);
      iterateProfile(innerCount, root, value.getProfiles(), "profiles", "profile");
      findAndReplaceSimpleLists(innerCount, root, value.getModules(), "modules", "module");
      iterateRepository(innerCount, root, value.getRepositories(), "repositories", "repository");
      iterateRepository(innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository");
      iterateDependency(innerCount, root, value.getDependencies(), "dependencies", "dependency");
      findAndReplaceXpp3DOM(innerCount, root, "reports", (Xpp3Dom) value.getReports());
      updateReporting(value.getReporting(), "reporting", innerCount, root);
      updateDependencyManagement(value.getDependencyManagement(), "dependencyManagement", innerCount, root);
      updateDistributionManagement(value.getDistributionManagement(), "distributionManagement", innerCount, root);
      findAndReplaceProperties(innerCount, root, "properties", value.getProperties());
   }