OTOH, if you are meaning that XML nodes will be inserted into the
document after they are produce by ML,

and those nodes are in a namespace, then if the tools insertering those
nodes are XML and Namespace aware then they will properly add the
binding as needed.

 

 

----------------------------------------

David A. Lee

Senior Principal Software Engineer

Epocrates, Inc.

[email protected]

812-482-5224

 

 

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Lee, David
Sent: Monday, August 30, 2010 9:28 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] question about namespace as
attribute

 

If you output an element with namespace "m" (not shown here) then I
would expect the binding at that point to be added.

Can you verify that ?

 

 

 

From: [email protected]
[mailto:[email protected]] On Behalf Of helen chen
Sent: Monday, August 30, 2010 9:03 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] question about namespace as
attribute

 

Hi Jason

 

I can see

 <article xmlns="mynamespace"><subnode>test</subnode></article>

But I lost the namespace binding
xmlns:m="http://www.w3.org/1998/Math/MathML";

 

The reason I want to keep this namespace binding is because inside
article node it may contains data that uses this namespace binding, and
it is from the original raw data, I'm doing converting and I don't want
to just lose it. I'm not sure in common ways how people do it.

 

Helen 

 

 

 

 

 

 

On Aug 27, 2010, at 6:39 PM, Jason Hunter wrote:

 

The xmlns="mynamespace" text is written in a format that looks like an
attribute but it's not actually an attribute.  This is an oddity of XML
caused by the fact that namespaces were added after the XML 1.0
specification finalized.

 

That means /@* won't match namespace declarations.

 

MarkLogic outputs namespace declarations automatically at the point
where they're needed.  In your output it's actually there.  I get this:

 

<article xmlns="mynamespace"><subnode>test</subnode></article>

You may not see the xmlns namespace declaration if you use a web
browser's view as XML facility because, inexplicably, browsers often
suppress that.  In CQ hit the Text view instead and you'll see it there.

 

-jh-

 

On Aug 27, 2010, at 12:25 PM, helen chen wrote:

 

If I run the following code, 

 

xquery version "1.0-ml";

 

let $a := <article xmlns:m="http://www.w3.org/1998/Math/MathML";
xmlns="mynamespace"><subnode>test</subnode></article>

 

return

  element {fn:QName("mynamespace","article")}

  {

    $a/@*

    ,

    $a/node()

  }

 

the return I got is 

<article xmlns="mynamespace"><subnode>test</subnode></article>

I missed the namespace definition in the original article node
xmlns:m="http://www.w3.org/1998/Math/MathML";  in my new article node.

 

It looks like the $a/@*  does not put the namespace attribute there.
How can I get all the attributes into my new node dynamically so I know
I didn't miss anything?

 

Thanks, Helen

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to