Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add xhtml example #32

Closed
Rhobal opened this issue Jan 3, 2017 · 3 comments
Closed

Please add xhtml example #32

Rhobal opened this issue Jan 3, 2017 · 3 comments

Comments

@Rhobal
Copy link

Rhobal commented Jan 3, 2017

The example page is very short and is missing an xhtml example. This would be helpful to show how to use namespace for xmlns without prefix.

Example
Xhtml file:

<?xml version="1.0"  encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example</title>
</head>
<body>
<div id="content">Somecontent</div>
</body>
</html>

Matcher usage:

final String NS1 = "http://www.w3.org/1999/xhtml";
String html="<?xml version='1.0'  encoding='utf-8'?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><title>Example</title></head><body><div id='content'>Somecontent</div></body></html>";
Source xhtml = XhtmlMatchers.xhtml(html);
		
assertThat(xhtml, XhtmlMatchers.hasXPath("//ns1:div[@id='content']", NS1));
assertThat(xhtml, XhtmlMatchers.hasXPath("//ns1:div[@id='content'][text()='Somecontent']", NS1));
@dmarkov
Copy link

dmarkov commented Jan 9, 2017

@yegor256 please take a look at it and dispatch (see par.21)

yegor256 added a commit that referenced this issue Aug 24, 2022
@yegor256
Copy link
Member

@Rhobal I explained them a bit in de183f1, thanks for the ticket!

@0crat
Copy link

0crat commented Aug 24, 2022

Job gh:jcabi/jcabi-matchers#32 is not assigned, can't get performer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants