NamespaceContext

2 views
Skip to first unread message

tauzell

unread,
Oct 8, 2010, 1:54:04 PM10/8/10
to xmltool
Is there a way to set a NamespaceContext in the api?

Here is what my problem is:

1. I have a DOM object which was parsed with a namespace aware parser.
This is required for validation.
2. I now call XMLDoc.from(document.getFirstChild(), true);

Even though I specify "ignore namespace" it is not ignoring. I
suspect this is because the Node it is created from is namespace
aware. So now my XPath calls like: rawXpathNumber() don't work the
way I want. If I could set a NamespaceContext with my known
namespaces I could put the namespace explicitly into the xpaths.

Mathieu

unread,
Oct 9, 2010, 12:15:44 PM10/9/10
to xmltool
Yes true. When you create a namespace-aware node, it remains namespace-
aware. I also had the same issue and the only way I found to make it
ignoring namespace is by either marshalling and then unmasrhalling
(i.e. > to text and then create xmltag from text).

If you can modify the original dom without impacted anything else, you
can also call the method on xmltag which removes all prefixes and
namespaces. This will transform all your nodes so that there is no
more namespaces and prefixes at all.

Mathieu.
Reply all
Reply to author
Forward
0 new messages