MSBuild to update html tag - msbuild

Here is my html file:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script id="ScriptId" src=""></script>
</body>
</html>
I want to replace empty src by script.js.
I tried with XmlPoke, but my XPath query doesn't work I think or maybe I can't do this way:
<XmlPoke XmlInputPath="test.html"
Query="/html/body/script[id='ScriptId']/src"
Value="script.js"/>
Thanks in advance to help me to update this src value.

Attributes in XPath are prefixed with #.
/html/body/script[#id='ScriptId']/#src
You probably shouldn't be using something designed for XML with HTML as two are not the same, at best, if HTML is well-formed, it'll strip out non-XML stuff like DOCTYPE, at worst it'll blow up.

Related

SEQUENCE in Ical

I am creating two ics files programmatically with the same UID. One file has sequence number "2130669611". When I send a new ICS file with a new(greater sequence number 2230669611, I am getting the error that this is an old entry while the new sequence number is greater than the old one.
Is there a max value of the sequence number for outlook?
File 1
BEGIN:VCALENDAR
VERSION:2.0
PRODID:TTSTTS
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER:MAILTO:XXX#xx.com
ATTENDEE;CN=Manu Bhai;RSVP=TRUE:MAILTO:manu.bhai#xx.com
DTSTART;TZID=UTC+0:20220322T080000Z
DTEND;TZID=UTC+0:20220322T110000Z
LOCATION:>Room.045
TRANSP:OPAQUE
SEQUENCE:2130669611
UID:E00060977P00001158
SUMMARY:Issue with SEQUENCE.
X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML>
< html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body class="defaultFont"> Issue with SEQUENCE </body> </html>
PRIORITY:5
CLASS:PUBLIC
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Issue with SEQUENCE
END:VALARM
END:VEVENT
END:VCALENDAR
File 2
BEGIN:VCALENDAR
VERSION:2.0
PRODID:TTSTTS
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER:MAILTO:XXX#xx.com
ATTENDEE;CN=Manu Bhai;RSVP=TRUE:MAILTO:manu.bhai#xx.com
DTSTART;TZID=UTC+0:20220322T080000Z
DTEND;TZID=UTC+0:20220322T110000Z
LOCATION:>Room.045
TRANSP:OPAQUE
SEQUENCE:2230669611
UID:E00060977P00001158
SUMMARY:Issue with SEQUENCE.
X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML>
< html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body class="defaultFont"> Issue with SEQUENCE </body> </html>
PRIORITY:5
CLASS:PUBLIC
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Issue with SEQUENCE
END:VALARM
END:VEVENT
END:VCALENDAR
SEQUENCE is used to indicate a significant update. Both of your versions look the same. So in that sense the second one is an 'old' entry and not an update.
As far as max numbers go, the RFC5545 specification does not address that, it does state that it starts with 0 and incremented from there. I expect the problem here is that there isn't actually a significant update, like a change in the date or time.
Your syntax also has numerous problems, it is not valid according to the specification. (white space, linelengths, missing DTSTAMP, invalid DTSTART - mixing up form 2 and form 3 of date-time. https://www.rfc-editor.org/rfc/rfc5545#section-3.3.5etc).
Try running your ics through all the ics validators you can find, as they tend to pick up different things at different times. Here are 2:
https://icalendar.org/validator.html
http://ical-validator.herokuapp.com/validate/ (currently bombing out early because of the whitespace in first line)
Finally I am able to find a solution to this problem. SEQUENCE is a 32-bit integer. max value is 2147483647. so if the value is more than this. it will not work.

Where do I find the "the HTMLQuestion schema URL" and CDATA (newbie ... run out of options)

I want to conduct a simple turk survey.
I've made the form, uploaded the images and set the details but I'm not quite sure what's next.
Here is the framework of my form with what I think are the AWS elements needed but:
1) How do I find the "the HTMLQuestion schema URL"?
2) Do I generate the assignmentId or does it get inserted on the POST?
3) Is there something I need to add for CDATA is it is a placeholder for an array?
(Please forgive my ignorance but I may even being asking the wrong questions. I'm just not clear what to do next - especially to test it myself (sandbox). I tried posting in the Turk forum but no replies in two days. I don't expect the AWS manual to be for novices.)
<pre>
<HTMLQuestion xmlns="[the HTMLQuestion schema URL]">
<HTMLContent><![CDATA[
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
<input type='hidden' value='' name='assignmentId' id='assignmentId'/>
... my handwritten form elements ...
</form>
<script language='Javascript'>turkSetAssignmentID();</script>
</body>
</html>
]]>
</HTMLContent>
<FrameHeight>0</FrameHeight>
</HTMLQuestion>
</pre>
Here is the latest link I found so far:
<HTMLQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd">

how do I validate a particular script in persent in page source using selenium?

In page source I have script tags as below,
how to validate in selenium that particular scripts are persent???
<script src="/core/assets/vendor/domready/ready.min.js?v=1.0.8"></script>
<script src="/core/misc/drupalSettingsLoader.js?v=8.4.8"></script>
<script src="/core/misc/drupal.js?v=8.4.8"></script>
<script src="/core/misc/drupal.init.js?v=8.4.8"></script>
you can search for attribute src within a script. i.e. finding element by attribute
driver.findElement(By.xpath("//script[#src='/core/assets/vendor/domready/ready.min.js?v=1.0.8']"))
OR
driver.findElement(By.xpath("//script[contains(#src,'/core/assets/vendor/domready/ready.min.js?v=1.0.8')]")
OR
driver.findElement(By.cssSelector("script[src='/core/assets/vendor/domready/ready.min.js?v=1.0.8']"))

MSSQL read tags from XHTML stored as XML column

I have stored a ~500kb ~10k lines XHTML document as XML datatype. Now I want to extract data from a single table in this document. There seem to be a lot of ways to deal with XML structured data, the most promissing solution (I tried others) seemed to be:
how to get data from html in SQL Server column
When I run this testcode:
DECLARE #HtmlTbl TABLE (ID INT IDENTITY, Html XML)
INSERT INTO #HtmlTbl(Html) VALUES('
<html>
<head>
<title>asdf</title>
</head>
<body>
</body>
</html>
')
SELECT html.query('//title')
FROM #HtmlTbl
WHERE ID = 1
it works pretty well. But if my XHTML looks like this:
INSERT INTO #HtmlTbl(Html) VALUES('
<html xmlns="../www.w3.org/1999/xhtml/index.html">
<head>
<title>asdf</title>
</head>
<body>
</body>
</html>
')
it is already failing and I'm getting empty strings as result. Of course my original XHTML file is much larger and I don't want to run in all those comments and stuff to cause my search to fail.
I'm new to handling XML in MSSQL, maybe someone can tell me a better way to extract the table I'm looking for. The server has SQL Express 2014, thx for help.

libxml2 get inner (X)HTML

I have some sample XHTML data, like this:
<html>
<head>
<style type="text/css">
..snip
</style>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.js"></script>
</head>
<body>
<div id="contentA">
This is sample content <b> that is bolded as well </b>
</div>
</body>
</html>
Now, what I need to do, is using an xmlNode *, get the inner HTML of the div contentA. I have the xmlNode * for it, but how can I get the innerXML of that? I looked at content, but that only returns This is sample content and not the xml in the bold tags. I looked into jQuery for this, but due to limitations on Apple and JavaScript, I cannot use jQuery to get the innerXML of that node.
On another note, Is there another library I should be using to get the inner XML? I looked into TBXML, but that had the same problem.
The content of the div node is not a single text string. It probably consists of:
A text node containing This is sample content (with the preceding new line).
an element node with a tag name of b
A text node containing the trailing new line and the indentation up to the div's closing tag.
The element node for the <b>...</b> will have the text content that is bolded as well.
To get all the text in the div as one string, you'll need to recursively descend through the entire tree of child nodes looking for text content.