Selective validation or "validation from a standpoint"...

L

Laurent R. Therond

Hi,

I searched for something like this, but could not locate any
information. I may have used bad keywords, or it does not make any
sense...

Anyhow, there it goes...

Let's say you overlay an XML document with markup of another
namespace, how would you tell a validating parser to ignore elements
of that other namespace?

Example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Title
</title>
</head>
<body>
<h1>
<another-namespace:insert id="0"/>
</h1>
</body>
</html>

Is there any kind of validating parser that could ignore the
"another-namespace"-specific markup and simply tell me whether this
XHTML document is valid?

Regards,

Laurent
 
B

Bjoern Hoehrmann

* Laurent R. Therond wrote in comp.text.xml:
Let's say you overlay an XML document with markup of another
namespace, how would you tell a validating parser to ignore elements
of that other namespace?

With DTDs that is not possible, you need to declare them, etc.
Is there any kind of validating parser that could ignore the
"another-namespace"-specific markup and simply tell me whether this
XHTML document is valid?

You could use a different schema language or you could strip anything
off the document that is not XHTML, a few lines in XSLT.
 
J

Joris Gillis

Is there any kind of validating parser that could ignore the
You could use a different schema language or you could strip anything
off the document that is not XHTML, a few lines in XSLT.

Those few lines could be:

<?xml version="1.0" ?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:eek:utput method="xml" indent="yes"/>
<xsl:template match="*">
<xsl:copy><xsl:apply-templates select="@*"/><xsl:apply-templates/></xsl:copy>
</xsl:template>

<xsl:template match="@*">
<xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>

<xsl:template match="*[namespace-uri() !='' and namespace-uri() != namespace-uri(/*)] "/>
<xsl:template match="@*[namespace-uri() !='' and namespace-uri() != namespace-uri(/*)] "/>
</xsl:stylesheet>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top