Subject: Problem of XML validation

From: Cridlig Vincent <[email-masked]>
Date: Sun, 19 Mar 2006 18:33:07 +0100

Hi,

This is to report a possible issue in the Netconf XML schema. I try to 
validate a simple get-config message but I get some errors.
I use the Netconf schema and some sample messages from draft 12.
I tested two "standard" XML schema validator implementations:
- the one from the C library libxml2
- the one from the Java library JAXP.
Twice, I got the result that the <filter> element should be empty.

I think the problem comes from the following complexType. It is the 
exact definition of an empty element.
See http://www.w3schools.com/schema/schema_complex_empty.asp

<xs:complexType name="filterInlineType">
  <xs:complexContent>
    <xs:restriction base="xs:anyType">
      <xs:attribute name="type" type="FilterType" default="subtree"/>
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

I changed it to the following :

<xs:complexType name="filterInlineType">
  <xs:complexContent>
    <xs:restriction base="xs:anyType">
      <xs:sequence>
        <xs:any processContents="skip"/>
      </xs:sequence>
      <xs:attribute name="type" type="FilterType" default="subtree"/>
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

I put processContents="skip" to not validate the content, especially because a subtree filter may be correct but not xml valid.
But now the problem is that it does not allow text content, only elements (like top). This is a problem for xpath capabilities.
I don't know how to solve it.

Does somebody experiment the same problems ?

Best regards,
Vincent

		
___________________________________________________________________________ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

--
to unsubscribe send a message to [email-masked] with
the word 'unsubscribe' in a single line as the message text body.
archive: <http://ops.ietf.org/lists/netconf/>

---

From: "Rob Enns" <[email-masked]>
Date: Thu, 23 Mar 2006 14:08:53 -0800

Putting the xpath expression in an attribute would work,
for example:

     <rpc message-id="101"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <get-config>
         <source>
           <running/>
         </source>
         <!-- get the user named fred -->
         <filter type="xpath" select="top/users/user[name='fred']"/>
       </get-config>
     </rpc>

The RFC-Ed updates would be:

On page 34:
OLD:
         If the NETCONF peer supports the :xpath capability
         (Section 8.9), the value "xpath" may be used to indicate that
         the filter element contains an XPath expression.

NEW:
         If the NETCONF peer supports the :xpath capability
         (Section 8.9), the value "xpath" may be used to indicate that
         the select attribute on the filter element contains an XPath
         expression.

On page 50:
OLD:
         If the NETCONF peer supports the :xpath capability
         (Section 8.9), the value 'xpath' may be used to indicate that
         the filter element contains an XPath expression.

NEW:
         If the NETCONF peer supports the :xpath capability
         (Section 8.9), the value "xpath" may be used to indicate that
         the select attribute on the filter element contains an XPath
         expression.

On page 67:
OLD:
   The :xpath capability modifies the <get> and <get-config> operations
   to accept the value "xpath" in the type attribute of the filter
   element.  When the type attribute is set to "xpath", the contents of
   the filter element will be treated as an xpath expression and used to
   filter the returned data.

NEW:
   The :xpath capability modifies the <get> and <get-config> operations
   to accept the value "xpath" in the type attribute of the filter
   element.  When the type attribute is set to "xpath", a select
   attribute MUST be present on the filter element.  The select
   attribute will be treated as an XPath expression and used to filter
   the returned data.  The filter element itself MUST be empty in this
   case.

On page 67:
OLD:
         <filter type="xpath"> <!-- get the user named fred -->
           top/users/user[name="fred"]
         </filter>

NEW:
         <!-- get the user named fred -->
         <filter type="xpath" select="top/users/user[name='fred']"/>

On page 81:
OLD:
           <xs:attribute name="type"
                         type="FilterType" default="subtree"/>

NEW:
           <xs:attribute name="type"
                         type="FilterType" default="subtree"/>
           <!-- if type="xpath", the xpath expression
           appears in the select element -->
           <xs:attribute name="select"/> 

> -----Original Message-----
> From: [email-masked] 
> [mailto:[email-masked]] On Behalf Of Cridlig Vincent
> Sent: Sunday, March 19, 2006 9:33 AM
> To: [email-masked]
> Subject: Problem of XML validation
> 
> Hi,
> 
> I put processContents="skip" to not validate the content, 
> especially because a subtree filter may be correct but not xml valid.
> But now the problem is that it does not allow text content, 
> only elements (like top). This is a problem for xpath capabilities.
> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! 
> Découvez les tarifs exceptionnels pour appeler la France et 
> l'international.