xml editor

Products

Features

  EPUB
Supported platforms

Supports Windows 7 & Mac OS X Lion

Ready for XML Editor data server software
W3C Member

XPATH question

Questions about XML that are not covered by the other forums should go here.

XPATH question

Postby doncristiano » Fri Feb 05, 2010 11:53 am

Hello

I have one question regarding an XPATH expression . Code:
Code: Select all
<?xml version="1.1" encoding="UTF-8"?>
<foo:root xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:foo="http://foo"  foo:schemaLocation="http://foo file:/c:/c1.xsd"/>

and schema:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://foo" xmlns:foo = "http://foo" elementFormDefault="qualified">
    <xs:element name="root"/>   
    <xs:simpleType name="range">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="17"/>
            <xs:maxInclusive value="18"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>


When I'm executing this XPath:
Code: Select all
17 instance of foo:range

I get the following error
Code: Select all
net.sf.saxon.trans.StaticError: XPath syntax error at char 17 (...). There is no imported schema for namespace http://foo


I do not know where is the mistake. Can you help me please?
Thanks.

Regards
Donoiu Cristian, ro
doncristiano
 
Posts: 1
Joined: Fri Feb 05, 2010 11:41 am

Re: XPATH question

Postby adrian » Fri Feb 05, 2010 3:37 pm

Hi,

I believe you can't use a simple type name after 'instance of' only an atomic type or a kind test:
http://www.w3.org/TR/xpath20/#id-instance-of

By the way is your XML instance another schema in itself? If not, you might have a mistake here.
I see you have another XML schema namespace declaration in the XML file:
Code: Select all
xmlns:xs="http://www.w3.org/2001/XMLSchema"

Usually an XML instance has the XML instance namespace declaration and the schema location, like this:
Code: Select all
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://foo file:/c:/c1.xsd"

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
 
Posts: 854
Joined: Tue May 17, 2005 4:01 pm


Return to General XML Questions

Who is online

Users browsing this forum: No registered users and 0 guests

XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>® XML Editor