473,581 Members | 3,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The referenced element is undefined

Hi!

I'm new to XML schemas; can somebody explain why bar is undefined?

<xs:element name="bar">
<xs:complexType >
<xs:simpleConte nt>
<xs:extension base="xs:string ">
<xs:attribute name="id" type="xs:string " use="required" />
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
</xs:element>

<xs:element name="foo">
<xs:complexType >
<xs:sequence>
<xs:element ref="bar" maxOccurs="unbo unded" />
</xs:sequence>
</xs:complexType>
</xs:element>
Jul 20 '05 #1
4 3284
Hi,

It's probably a namespace issue. If your schema has a target namespace,
you need to either

1. Make that namespace the default namespace, as in:

<xs:schema targetNamespace ="xxx" xmlns="xxx" ....

OR

2. Give that namespace a prefix, and use the prefix in the element
reference, as in:

<xs:schema targetNamespace ="xxx" xmlns:pre="xxx"
....

<xs:element ref="pre:bar" maxOccurs="unbo unded"/>
Hope that helps,
Priscilla

-----------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema (Prentice Hall PTR)
-----------------------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #2
Priscilla Walmsley wrote:
It's probably a namespace issue. If your schema has a target namespace,
you need to either


So the schema (Listing 2) at
http://www-106.ibm.com/developerwork...tml?ca=dnt-520
isn't valid at all?

I actually tried it with an example schema included in the Apache JaxMe
distribution which has this definition:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN"
targetNamespace ="http://ws.apache.org/jaxme/examples/misc/address"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
Jul 20 '05 #3
> So the schema (Listing 2) at
http://www-106.ibm.com/developerwork...2.html?ca=dnt-
520isn't valid at all?


No, I said "If your schema has a target namespace". That one's fine
because it doesn't have a target namespace.

The second example you gave me:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN"
targetNamespace ="http://ws.apache.org/jaxme/examples/misc/address"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">

Using this schema, because it DOES have a target namespace, you DO need
a namespace declaration for the target namespace BUT ONLY IF you are
planning to reference other components (e.g. element ref="xxx:bar").

If you show me your whole schema I can probably explain better...

Priscilla
-----------------------------------------------------
Priscilla Walmsley pr*******@walms ley.com
Author, Definitive XML Schema (Prentice Hall PTR)
-----------------------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4
Priscilla Walmsley wrote:
If you show me your whole schema I can probably explain better...


Got it working thanks. Watch out for another posting of mine :-)
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3952
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does nothing in IE. I'd be greatful for any assistance. Also, if I will have problems the code on Opera or Safari, I'd appreciate any pointers--I don't...
3
1952
by: Razzbar | last post by:
What is the preferred method of removing the tagging of an element without removing the text? IOW, how do I turn this <span>I want to keep this <strong>and this, too</strong> but not strongly</span> into this.. <span>I want to keep this and this, too but not strongly</span>
6
13346
by: Luke Dalessandro | last post by:
I'm not sure if this is the correct forum for platform specific (Mozilla/Firefox) javascript problems, so just shout and point me to the correct newsgroup if I'm being bad. Here's the deal... html file (generated using .NET 2.0 beta2): <form method="post" action="Test2.aspx" id="form1">
1
1743
by: jason.lucey | last post by:
Hi, I cannot get this figured out. I need to get the text out of an element node. In IE, I can do it like this: xNode(0).text but that does not work for Mozilla. And since element nodes return NULL for nodeValue, what am I supposed to do? is there a way to convert an element node into a text node?
1
3999
by: Jean Stax | last post by:
Hi ! I created a sample library project. In my second project I reference this library and make the following call, which returns "undefined value": Type myType = Type.GetType("SampleLib.MyClass"); My guess was that the function fails because my library isn't loaded yet.
2
4930
by: Moses | last post by:
Hi All, Is is possible to catch the error of an undefined element while creating an object for it. Consider we are not having an element with id indicator but we are trying to make the object for it indicator = document.getElementById('indicator');
10
1784
by: rush2 | last post by:
Having an odd issue that I didn't have with Opera until the most recent update to 9.22. I have a DHTML menu that I thought I was done with until yesterday. I have a root node that when a user enters the submenu, the following function is called: function mouseLeaves(element, evt) { if (typeof(evt.toElement)!="undefined" && evt.toElement...
5
3778
by: dmorand | last post by:
I'm trying to validate whether or not an array element has been created. Here is what one of the arrays could look like: commentid = undefined commentid = undefined commentid = 1 commentid = 1 commentid = undefined commentid = 1
4
2114
by: sjkothenbeutel | last post by:
I've been reading through quite a bit regarding this topic but am finding myself confused. Here is the scenario: I have a javascript class defined with methods whereas each has references to "this." As everyone is aware of, when you attach and event from an element to a class method and the class method references "this", the scope of...
0
7886
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7809
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8159
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1413
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.