473,411 Members | 2,014 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,411 software developers and data experts.

namespace :/

I have xml document like this:

<?xml version="1.0" encoding="UTF-8" ?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="2303">
<msg lang="pl">foo message</msg>
<value>
<name xmlns="domain">fooo.com</name>
</value>
<extValue>
<value>
<reasonCode xmlns="">9060</reasonCode>
</value>
</extValue>
</result>
</response>
</epp>

I can succesfully process with Xalan all its nodes, but this "weird" one:

<name xmlns="domain">fooo.com</name>

what the hell its namespace is?? in other words I need to know how looks the
"match" attribute for it ?
match="name"
match="domain:name"
.....
??
only match="*" can get it, but of course it is no solution
I have no idea to get this working :(( Please help.

thx
Jul 20 '05 #1
9 1262
virtual wrote:
I have xml document like this:

<?xml version="1.0" encoding="UTF-8" ?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<response>
<result code="2303">
<msg lang="pl">foo message</msg>
<value>
<name xmlns="domain">fooo.com</name>
</value>
<extValue>
<value>
<reasonCode xmlns="">9060</reasonCode>
</value>
</extValue>
</result>
</response>
</epp>

I can succesfully process with Xalan all its nodes, but this "weird" one:

<name xmlns="domain">fooo.com</name>

what the hell its namespace is?? in other words I need to know how looks the
"match" attribute for it ?
match="name"
match="domain:name"
....
??
only match="*" can get it, but of course it is no solution
I have no idea to get this working :(( Please help.

thx


hi,

i assume that you are using xslt...

you *must* define a prefix in your stylesheet to match an element bound
to a namespace, even if it is unprefixed in the source document, like this :
match="foo:name"
if the host element or one of its ancestor declares xmlns:foo="domain"

if your are not using xslt and your matching pattern is processed by an
xpath engine, see the documentation of your tool for binding prefixes to
namespace uris (because you 'll have to use a prefix too)
--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
Jul 20 '05 #2
> i assume that you are using xslt...

yes you're right
you *must* define a prefix in your stylesheet to match an element bound
to a namespace, even if it is unprefixed in the source document, like this : match="foo:name"
if the host element or one of its ancestor declares xmlns:foo="domain"


i know and it's already done. i declare xmlns="domain" in xsl stylesheet,
but althought it doesn't work. and notice that without this declaration xslt
processor would raise exception i suppose, anyway it is not the way to solve
this problem, this node is still anmatched :(

Jul 20 '05 #3
virtual wrote:
i assume that you are using xslt...

yes you're right

you *must* define a prefix in your stylesheet to match an element bound
to a namespace, even if it is unprefixed in the source document, like this


:
match="foo:name"
if the host element or one of its ancestor declares xmlns:foo="domain"

i know and it's already done. i declare xmlns="domain" in xsl stylesheet,


try it with a prefix !
xmlns:foo="domain"

and

match="foo:name"

it will work
but althought it doesn't work. and notice that without this declaration xslt
processor would raise exception i suppose, anyway it is not the way to solve
this problem, this node is still anmatched :(


the declaration you defined doesn't use a prefix; it applied only on
litteral elements produced in the output tree; if you want to apply a
namespace uri on xpath expressions and patterns, you really *must* use a
*prefix*, like shown above

--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
Jul 20 '05 #4
Hello, virtual!
You wrote on Thu, 15 Apr 2004 10:37:21 +0200:
[Sorry, skipped]

<xsl:template match="n:name" xmlns:n="domain">
....
</xsl:template>

With best regards, Alex Shirshov.
Jul 20 '05 #5
virtual wrote:
i assume that you are using xslt...

yes you're right

you *must* define a prefix in your stylesheet to match an element bound
to a namespace, even if it is unprefixed in the source document, like this


:
match="foo:name"
if the host element or one of its ancestor declares xmlns:foo="domain"

i know and it's already done. i declare xmlns="domain" in xsl stylesheet,
but althought it doesn't work. and notice that without this declaration xslt
processor would raise exception i suppose,


no, the processor don't know which entries are supposed to be processed;
if a "wrong" document is used to feed a stylesheet, its elements won't
be matched (howver, the default templates may be applied)

anyway it is not the way to solve this problem, this node is still anmatched :(

--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
Jul 20 '05 #6
> try it with a prefix !
xmlns:foo="domain"
i wrote that with mistake in hurry, of course it should be with prefix and
of course it was (in document)
and

match="foo:name"

it will work


no it would not
but althought it doesn't work. and notice that without this declaration xslt processor would raise exception i suppose, anyway it is not the way to solve this problem, this node is still anmatched :(


the declaration you defined doesn't use a prefix; it applied only on
litteral elements produced in the output tree; if you want to apply a
namespace uri on xpath expressions and patterns, you really *must* use a
*prefix*, like shown above


basically you are right, but receipt you serve doesn't work. anyway thx for
good will :)

Jul 20 '05 #7
> [Sorry, skipped]

<xsl:template match="n:name" xmlns:n="domain">
...
</xsl:template>

With best regards, Alex Shirshov.


yeaaah!!!! you are great Alex :) it definetely works, but to be honest I
would never get to know this trick, really.
it is pretty sick namespace stuff and I read (let's say "watched") all
books form o'reilly/wrox/maning/whatever I had and found nothing about such
a case like mine

thanx anyway, cheers
Jul 20 '05 #8
Hello, virtual!
You wrote on Thu, 15 Apr 2004 11:24:28 +0200:
[Sorry, skipped]

v> yeaaah!!!! you are great Alex :) it definetely works, but to be honest I
v> would never get to know this trick, really.
v> it is pretty sick namespace stuff and I read (let's say "watched") all
v> books form o'reilly/wrox/maning/whatever I had and found nothing about
v> such a case like mine

XSL(T) is xml, so all rules of xml specification (encoding, naming), xml
namespace specification and other related papers apply to it.

With best regards, Alex Shirshov.
Jul 20 '05 #9
In article <c5**********@news.onet.pl>, virtual <bk***@poczta.onet.pl> wrote:
i know and it's already done. i declare xmlns="domain" in xsl stylesheet,
but althought it doesn't work. and notice that without this declaration xslt
processor would raise exception i suppose, anyway it is not the way to solve
this problem, this node is still anmatched :(


The default namespace declaration is not used when interpreting XPath
expressions. To refer to an element in a namespace, you must use a
prefix in the stylesheet.

-- Richard
Jul 20 '05 #10

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

Similar topics

1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
3
by: Mike Dickens | last post by:
hi, i'm sure this has come up before but havn't managed to find an answer. if i have the following xslt <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet method="xml" version="1.0"...
6
by: Don Wash | last post by:
Hi There! I just need some advice on Namespace management for creating reusable VB.NET applications. I would like my applications to have this namespace structure... Namespace MyCompany ...
8
by: Petter Reinholdtsen | last post by:
I ran into a problem on HP-UX 11.00 the other day, where it refused to compile a program using 'using namespace std;' at the top. The reason seem to be that the compiler refuses to accept 'using...
2
by: puzzlecracker | last post by:
after reading some of the post I found out something rather radical to my previous understanding: that when you do #include<iostream> #include<string> #include<vector> etc compiler puts...
2
by: Tony Johansson | last post by:
Hello! I'm reading a book about C++ and there is something that I don't understand so I ask you. Below I have the text from the book and the code from the file where main is located and some...
7
by: Kevin Newman | last post by:
I've been toying with a namespace manager, and wanted to get some input. So what do you think? if (typeof com == 'undefined') var com = {}; if (!com.unFocus) com.unFocus = {}; ...
14
by: Tiraman | last post by:
Hi , I would like to use nested namespace . I have 3 namespace as dll's : Namespace A Namespace B Namespace C And i want to have some namespace that contain them all , some thing like
2
by: Jeff Brown | last post by:
Hi, I suspect that this isn't possible, but I figured I'd ask. My project has a root namespace, let's say it's "Root", that applies to almost every source file (which is why I've set it as the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.