Error Message saying XML is invalid on SharePoint master page - html

I am branding SharePoint and when I upload the master page I get an error that says
The 'html' start tag on line 162 position 2 does not match the end tag
of 'head'. Line 171, position 3.
So I check my html file and I can't seem to find what's wrong. Here is the html: https://codeshare.io/GbvxJV

I have reviewed your XML file and find out below bugs:
You need to add <html> tag below <!DOCTYPE html> tag.
The second change is, you need to complete your <head> tag (before <body> tag starts) at line number 162, as suggested in error as well.
There are lots of <SPM> tag that are spit in multiple lines. They need to be in single line.
When I make these changes, I was able to convert your HTML file to Master Page.

Related

Using Regular Expressions to Delete a HTML Meta Tag Line of Code

I'm trying to delete a single meta tag line of code from an html file.
The line of code starts with <meta name="topic-breadcrumbs". It can be in either of these forms:
<meta name="topic-breadcrumbs" content="PC-DMIS Hilfe-Kerndatei > Definieren von Hardware > Definieren von Tasterwechslern > Registerkarte Kalibrieren > Kalibrieren des Tasterwechslers ACR3" />
or:
<meta name="topic-breadcrumbs" content="PC-DMIS Hilfe-Kerndatei > Definieren von Hardware > Definieren von Tasterwechslern > Registerkarte Kalibrieren > Kalibrieren des Tasterwechslers ACR3" /><script type="text/javascript" language="JavaScript">
For the second example, I want to delete only the meta tag, leaving the line for the script in place.
This is just one example. each meta tag line will be different as the "content" in the tag refers to chapters and there are hundreds of chapters which is why I want to just capture the opening of the meta tag line of code (<meta name="topic-breadcrumbs") since that will always be the same and then the closing characters />.
I have hundreds of html files that I need to delete this line from. Is there a way using regular expressions in NP++ to automate this? I've looked at several examples here as well as in other forums but I have not found anything specific to my needs.
I would like to match the opening line of the code <meta name="topic-breadcrumbs" and then to the first instance of the meta tag's closing />.
Thanks!
I assume you have all files in one directory or subfolders. Please think about a backup copy for your test!
Open one file in your workspace
Open the dialog e.g. by STRG+F
Try for your needs Find What: (^<meta name="topic-breadcrumbs" content=".+\" \/>)
Choose Regular Expression (be careful, later (!) give a try and test match newline)
Open Find in Files tab e.g. by STRG+Shift+F
Replace with: Nothing
Set Filter
Set Directory
First press Find All and check the results
Press Replace in Files (at your own risk!)
Before:
After:

Which part of the HTML specification cause a URL within angle-brackets to be parsed as an <http:> element with attributes?

Here is my HTML code.
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<head>
<title>Bar</title>
<script>
window.onload = function() {
console.log(document.body.innerHTML)
}
</script>
</head>
<body>
<http://www.example.com/foo/bar/baz.html>
</body>
</html>
I save this code in a file named bar.html and then open the page with Firefox or Chrome. This is the output I see in the console.
<http: www.example.com="" foo="" bar="" baz.html="">
</http:>
Now I understand that my code was incorrect because it had a URL enclosed within < and >.
I want to understand how exactly did the browser parse it as an http: tag with parts of the URL interpreted as HTML attributes.
Is there some part of the HTML specification that leads to this kind of behavior? If so, could you please quote such parts of the HTML specification?
Everything you need to know is in section 8.2.4. In particular:
Up to <http:, the parser is in the tag name state. The element's tag name is http:, including the colon, as evidenced by the </http:> end tag.
The first / switches the parser to the self-closing start tag state.
The second / causes a parse error as described in the link in step 2, switching the parser to the before attribute name state.
The parser enters the attribute name state and continues consuming the URL. This is what causes paths of the path to be treated as attribute names.
When the parser reaches the next /, it switches back to the self-closing start tag state and repeats steps 2 and 3, except that it's not a second / but a different character (that isn't >) that causes the parse error and switches the parser back to the before attribute name state in step 3.
Once the parser finally sees a >, it closes the start tag, emits it, and proceeds as normal.
HTML specification defines HTML concept, but not how to parse it, as far as I know. Parsing algorithm is internal subject of browser's programmers and they do their best to parse HTML with errors even.

Can you help me understand a HTML redirect in a header?

When looking at a hacked site I found the following redirect:
<html><head><div style='display:none'>http://www.example1.net</div>
<meta http-equiv='refresh' content='1;http://www.example2.org/?q=EDdrug'>
</head><body></body></html>
I found an explanation for how the second part of the redirect worked here:
Redirect from an HTML page
My browser redirects to the 2nd URL. I would like to understand what the first part of this redirect is doing. I am assuming that is probably there for other types of browsers. Can someone explain it to me?
I will explain line by line:
<html><head><div style='display:none'>http://www.example1.net</div>
Here an html page,head part and a div is started using the <html>,<head> and <div> tags. The </div>ends the started div and also it is invisible due to
its attribute <div style='display:none'>.
That's all for the first line and it does not redirect to the url in the first line because it is just served as plain text.Actually by starting a div the head tag is closed.
The second line:
<meta http-equiv='refresh' content='1;http://www.example2.org/?q=EDdrug'>
It does is to redirect to the given URL within the content attribute after a second(content='1;).
The third line:
It closes the html tag and also starts a body tag and closes it without any data inside.It also ends the head tag again which is ended by the use of a tag inside the head tag
If you want more clarification feel free to comment and ask

3 validation errors- unsure of how to correct

Line 10, Column 43: Bad value FRSH Studio for attribute href on element link: Whitespace in path component. Use %20 in place of spaces. <link rel="pingback" href="FRSH Studio" />
--- It is my understanding that this is pulled from my settings in Wordpress. When I change the setting to include the %, I'm given an error stating that "Path component contains a percent sign that is not followed by two hexadecimal digits." How do I fix this?
Line 146, Column 7: End tag for body seen, but there were unclosed elements. </body>
--- I believe this is referring to <div id="container">...
Line 54, Column 20: Unclosed element div. <div id="container">
--- When I close the container using </div><!-- end container --> in the footer, I'm told that it is a stray tag. Where should </div><!-- end container --> be?
Not sure why this was sent away from Wordpress Stackexchange. The site validates as HTML. It is only when validating the site, which is Wordpress, using the URI via w3c's validator that these errors arise.
Put the full code inside the HTML Tidy and make it valid. Use this: http://infohound.net/tidy/
HTML Tidy is a tool for checking and cleaning up HTML source files. It is especially useful for finding and correcting errors in deeply nested HTML, or for making grotesque code legible once more.
This online version enables you use it without installing the client tool on your PC.
The "stray tag" error may be due to the fact that the page is being parsed as XHTML, where every opening tag (e.g. <!-- end container -->) requires a closing tag.
The best HTML validator is here:
http://validator.w3.org/
That will offer an option to clean up with HTML Tidy as others have mentioned.
1) The href has to be a valid link.
<link rel="pingback" href="http://frshstudio.com" />
2/3) Perhaps you have closed it in the wrong place?
Can you please post code?
Your site appears to be generating bad HTML pages.
1) The value for "href" should be a URL.
2) If you have a "div" start tag, then there needs to be a "div" end tag as well. This may be missing.
3) Would need to see the entire source to be helpful.
As someone suggested, you can use http://validator.w3.org/. Another validator (for Windows so it's offline and it does a lot more) is CSE HTML Validator at http://www.htmlvalidator.com/

End tag for element "div" which is not open. HTML validation errors

What do the following error messages mean?
I'm validating my website, but I'm getting these weird messages about tags. I have an opening div at the top of the page, but I still get these errors. Are they false warnings?
# Error Line 195, Column 7: end tag for element "div" which is not open
</div><!-- wrapper -->
The validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.
If this error occurred in a script section of your document, you should probably read this FAQ entry.
# Error Line 195, Column 7: XML Parsing Error: Opening and ending tag mismatch: body line 16 and div
</div><!-- wrapper -->
# Error Line 208, Column 8: XML Parsing Error: Opening and ending tag mismatch: html line 2 and body
</body>
You would have to delete that </div> as it doesn't seem to have an opening match. Try to erase it and revalidate.
You should have an open div tag like
<div></div>
It thinks it found a closing tag with no matching opening () tag.
It may be that the page author deleted the opening tag and forgot to delete the closing tag. It could also be that you have tags mis-nested, something like this:
<h1>
<div ...>
...
</h1>
</div>
Hope that helps.
The most common reason for the validator to say that the tags don't match is that the tags don't match. However, it's not certain that the tag is actually missing. There may be other errors that could cause the ending tag to be skipped. You might for example have a missing ending quote for an attribute in a tag, which would cause the following tags to be part of the attribute value until the next quote in the code.
Verify that the page contains the correct opening and closing tags. You can open the page in something like Firebug in Firefox or Developer Tools in Internet Explorer 8 to see how it displays the tag structure that the browser has parsed.