Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 08:47 AM
Laurent R. Therond
Guest
 
Posts: n/a
Default Selective validation or "validation from a standpoint"...

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
  #2  
Old July 20th, 2005, 08:47 AM
Bjoern Hoehrmann
Guest
 
Posts: n/a
Default Re: Selective validation or "validation from a standpoint"...

* Laurent R. Therond wrote in comp.text.xml:[color=blue]
>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?[/color]

With DTDs that is not possible, you need to declare them, etc.
[color=blue]
>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?[/color]

You could use a different schema language or you could strip anything
off the document that is not XHTML, a few lines in XSLT.
  #3  
Old July 20th, 2005, 08:47 AM
Joris Gillis
Guest
 
Posts: n/a
Default Re: Selective validation or "validation from a standpoint"...

>> Is there any kind of validating parser that could ignore the[color=blue][color=green]
>> "another-namespace"-specific markup and simply tell me whether this
>> XHTML document is valid?[/color]
>
> You could use a different schema language or you could strip anything
> off the document that is not XHTML, a few lines in XSLT.[/color]

Those few lines could be:

<?xml version="1.0" ?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output 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>


--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles