|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Fwd: xmlns ignoreSérgio Mariano Dias sergiomariano at gmail.comTue Sep 15 11:07:15 PDT 2009
Hi,
This is a complete code test:
//---------------------------------------------------------------------------------------------------------------------------------
Processor proc = new Processor(false);
XQueryCompiler comp = proc.newXQueryCompiler();
XdmNode source = proc.newDocumentBuilder().build(new
StreamSource(inputFile));
XQueryExecutable exp = comp.compile("/NFe/infNFe/ide/natOp");
XQueryEvaluator eval = exp.load();
eval.setContextItem(source);
XdmItem i =eval.evaluateSingle();
System.out.println(i.getStringValue());
XdmValue v = eval.evaluate();
System.out.println(v.size());
//---------------------------------------------------------------------------------------------------------------------------------
that is the xml file:
//---------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
<infNFe Id="NFe2907" versao="1.10">
<ide>
<cUF>29</cUF>
<cNF>123658</cNF>
<natOp>Venda - direta</natOp>
....
//---------------------------------------------------------------------------------------------------------------------------------
The ""http://www.portalfiscal.inf.br/nfe"" return page not found. If I
remove the addres, the program return the correct value. That is way a fink
to ignore the addres. Is that possible?
Regards,
2009/9/11 David Carlisle <http://x-query.com/mailman/listinfo/talk>
>
> > I have a problem to ignore a xmls attribute in a tag and did not found
> > information how to ignore this attribute. Somebody can help me.
>
> A namespace declaration is not an attribute in the XDM model used by
> XPath and Xquery. The name of an element includes the namespace.
>
> Most likely the part of teh code that you don't show
>
> = comp.compile("/.../... ...");
>
> is selecting elements in no-namespace, and you should change it to
> select elements in the namespace used in your xml source.
>
> either by using a prefix
> /p:aa/p:bb
>
> and binding p to the namespace used in the source, or by setting the
> default namespace in the xquery to that used in the source.
>
>
> David
>
>
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> ________________________________________________________________________
>
--
Sérgio Mariano
--
Sérgio Mariano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20090915/5063b3b0/attachment-0001.htm
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






