473,322 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

XML Namspaces

What did I do wrong?

<?xml version="1.0"?>
<rfs:filesystem xmlns:rfs="http://www.somewebpage.com/rfs"/>
<rfs:root>
<rfs:attr key="name" value="c:\"/>
<rfs:folder>
<rfs:attr key="name" value="Users"/>
<rfs:file>
<rfs:attr key="name" value="pic.jpg"/>
<rfs:attr key="size" value="5675675"/>
<rfs:attr key="lastmod" value="5359573579797693"/>
</rfs:file>
<rfs:folder>
<rfs:attr key="name" value="Chase"/>
<rfs:attr key="compressed" value="true"/>
<rfs:file>
<rfs:attr key="name" value="config.sys"/>
<rfs:attr key="size" value="5678"/>
<rfs:attr key="execute" value="false"/>
</rfs:file>
</rfs:folder>
</rfs:folder>
</rfs:root>
</rfs:filesystem>
Jun 27 '08 #1
8 1377
also, sorry I spelled namespaces wrong
Jun 27 '08 #2
Chase Preuninger wrote:
What did I do wrong?

<?xml version="1.0"?>
<rfs:filesystem xmlns:rfs="http://www.somewebpage.com/rfs"/>
the above is an empty element ending with /so the XML file
ends there, and any following XML elements are in error.
presumably you wanted there not />

David

<rfs:root>
<rfs:attr key="name" value="c:\"/>
<rfs:folder>
<rfs:attr key="name" value="Users"/>
<rfs:file>
<rfs:attr key="name" value="pic.jpg"/>
<rfs:attr key="size" value="5675675"/>
<rfs:attr key="lastmod" value="5359573579797693"/>
</rfs:file>
<rfs:folder>
<rfs:attr key="name" value="Chase"/>
<rfs:attr key="compressed" value="true"/>
<rfs:file>
<rfs:attr key="name" value="config.sys"/>
<rfs:attr key="size" value="5678"/>
<rfs:attr key="execute" value="false"/>
</rfs:file>
</rfs:folder>
</rfs:folder>
</rfs:root>
</rfs:filesystem>

--
http://dpcarlisle.blogspot.com
Jun 27 '08 #3
I also don't get what the purpose of the xmlns is
Jun 27 '08 #4
Chase Preuninger wrote:
I also don't get what the purpose of the xmlns is
Sounds like you need a basic education in what XML Namespaces are.
Reading a good modern XML tutorial might be worthwhile at this point. (I
usually point folks to the articles and tutorials at
http://www.ibm.com/xml, but I admit I'm biased.)

For info specifically about XML Namespaces, see James Clark's description at
http://www.jclark.com/xml/xmlns.htm
or the official (but somewhat harder to read) definition at
http://www.w3.org/TR/REC-xml-names/
Jun 27 '08 #5
I have I big book on XML, I just never really got the entire thing
about the xmlns.
Jun 27 '08 #6
Chase Preuninger wrote:
I have I big book on XML, I just never really got the entire thing
about the xmlns.
Namespaces are a way of managing XML-based grammars so they can be
reliably recognized by applications, and if necessary intermixed in a
single document. The xmlns attributes are used to bind prefixes (which
are just "syntactic sugar" shorthand) to the namespace names (strings
formatted as absolute URI references). Those bindings are scoped, so the
same prefix may mean different URIs in different parts of the program.
It's also possible to set up a default namespace for elements in one of
those parts, just to save a bit of typing. (This sometimes improves
readabilty, sometimes makes it worse.)

The namespace names are formatted as URI references because "we already
know how to manage those so they won't conflict with each other." And
that's all there is to that. The namespace name has no other built-in
meaning beyond being the name for this namespace. There is no guarantee
that there is anything meaningful behind that URI if you try to
dereference it, or what you might find there if anything is present.
Basically, you shouldn't be trying. (The Semantic Web folks said they
would come up with a standard for what a namespace URI might point to. I
haven't heard any concrete proposals, and it's been several years. Don't
hold your breath.)

So namespaces are just an alternative to having to always type a
<gawdaful_long_name_that_you_hope_nobody_else_us ed/>. That really is all
there is to them.
Most modern XML standards assume you're working with namespaced
documents. XML Schema, XPath, XSLT, the Semantic Web stuff, XHTML,
XQuery, and so on all assume namespaces are a prerequisite.

Read some tutorials and/or re-read that section of the book -- or find
another document which explains this better.

Jun 27 '08 #7
Does the xmlns attribute need to have a URI or could it just contain
anything?
Jun 27 '08 #8
Chase Preuninger wrote:
Does the xmlns attribute need to have a URI or could it just contain
anything?
A "namespace name" must conform to the syntax of an Absolute URI
Refrence -- an absolute URI possibly followed by a fragment identifier.

If you really mean the xmlns attribute (xmlns=, as opposed to
xmlns:foo=), that's the default namespace declaration. Same restriction
on its value.
Jun 27 '08 #9

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

Similar topics

1
by: David Tucker | last post by:
i have an xml document that needs to use multiple dtds. each dtd may have the same element names in general but some will differe slightly. I want to use namspaces but every time I do so it...
0
by: jonathon | last post by:
Hi all, I've been reading the manual for BackBase (the AJAX toolkit) and they use 2 new namspaces to add functionality to XHTML pages. If I have <xpm> and <b:foo> tags, how are these read and...
5
by: KJ | last post by:
In an Xml schema: can an element have children which come from another namespace? For example, can this be declared in the schema: <top> <anotherNamespace:a> <aThirdNamespace:b> Hello World...
3
by: Lee Alexander | last post by:
I want to find out all the namespaces for an assembly and convert them into a tree that I can then traverse for use in an autocomplete popup. Now I figure I can do it by running over all the...
4
by: Henke | last post by:
I have this scenario. public class A { public int numbers; public class A() { }
1
by: belangour abdessamad | last post by:
Hi, In the metadata for an exe file for example, there is classes organized in namespaces. the GetExportedTypes methods returns all types. I need to get the names of namspaces and to organize...
2
by: Chua Wen Ching | last post by:
Hi everyone, I want to do something like XMLSpy or may tools like DreamweaverMX. 1) When you type this: Before: ======== <MyCompany> //then the xml editor will automatically add the
0
by: Steven Blair | last post by:
Hi, quick question regarding namspaces. Here is an exmaple of a little project I am working on. I have a GUI, a Business Layer dll and a Database dll. What is the best strategy for naming...
2
by: Beeeeeeeeeeeeves | last post by:
Does C# really HAVE to have namespaces? Isn't there any way I can turn them off? I did a bit of dabbling in VB.NET but have decided not to switch to it permanantly as I've got too much pre-written...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.